mirror of
https://github.com/irssi/irssi.git
synced 2024-11-03 04:27:19 -05:00
new !channel support was buggy, as I tried it only with channel names having
less than 5 chars :) Now it works so that if you join !channel, you see it as !channel. If you join !ABCDEchannel, you'll again see that. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2802 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
c8187a9a76
commit
ede752530e
@ -210,7 +210,7 @@ static IRC_CHANNEL_REC *channel_find_unjoined(IRC_SERVER_REC *server,
|
||||
|
||||
static void event_join(IRC_SERVER_REC *server, const char *data, const char *nick, const char *address)
|
||||
{
|
||||
char *params, *channel, *tmp;
|
||||
char *params, *channel, *tmp, *shortchan;
|
||||
IRC_CHANNEL_REC *chanrec;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
@ -227,41 +227,46 @@ static void event_join(IRC_SERVER_REC *server, const char *data, const char *nic
|
||||
tmp = strchr(channel, 7); /* ^G does something weird.. */
|
||||
if (tmp != NULL) *tmp = '\0';
|
||||
|
||||
if (*channel == '!') {
|
||||
if (*channel != '!')
|
||||
shortchan = NULL;
|
||||
else {
|
||||
/* !channels have 5 chars long identification string before
|
||||
it's name, it's not known when /join is called so rename
|
||||
!channel here to !ABCDEchannel */
|
||||
char *shortchan;
|
||||
|
||||
shortchan = g_strdup_printf("!%s", channel+6);
|
||||
chanrec = channel_find_unjoined(server, shortchan);
|
||||
if (chanrec != NULL) {
|
||||
g_free(chanrec->name);
|
||||
chanrec->name = g_strdup(channel);
|
||||
}
|
||||
|
||||
g_free(shortchan);
|
||||
}
|
||||
|
||||
chanrec = irc_channel_find(server, channel);
|
||||
if (chanrec != NULL && chanrec->joined) {
|
||||
/* already joined this channel - this check was added
|
||||
here because of broken irssi proxy :) */
|
||||
g_free(shortchan);
|
||||
g_free(params);
|
||||
return;
|
||||
}
|
||||
|
||||
chanrec = channel_find_unjoined(server, channel);
|
||||
if (chanrec == NULL) {
|
||||
/* look again, because of the channel name cut issues. */
|
||||
chanrec = channel_find_unjoined(server, channel);
|
||||
}
|
||||
|
||||
if (chanrec == NULL) {
|
||||
/* didn't get here with /join command.. */
|
||||
chanrec = irc_channel_create(server, channel, NULL, TRUE);
|
||||
chanrec = irc_channel_create(server, channel, shortchan, TRUE);
|
||||
}
|
||||
|
||||
chanrec->joined = TRUE;
|
||||
if (strcmp(chanrec->name, channel) != 0) {
|
||||
g_free(chanrec->name);
|
||||
chanrec->name = g_strdup(channel);
|
||||
}
|
||||
|
||||
g_free(shortchan);
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,6 @@ IRC_CHANNEL_REC *irc_channel_create(IRC_SERVER_REC *server, const char *name,
|
||||
const char *visible_name, int automatic)
|
||||
{
|
||||
IRC_CHANNEL_REC *rec;
|
||||
char *new_name;
|
||||
|
||||
g_return_val_if_fail(server == NULL || IS_IRC_SERVER(server), NULL);
|
||||
g_return_val_if_fail(name != NULL, NULL);
|
||||
@ -56,25 +55,8 @@ IRC_CHANNEL_REC *irc_channel_create(IRC_SERVER_REC *server, const char *name,
|
||||
rec = g_new0(IRC_CHANNEL_REC, 1);
|
||||
if (*name == '+') rec->no_modes = TRUE;
|
||||
|
||||
new_name = NULL;
|
||||
if (visible_name == NULL) {
|
||||
/* !?????channel -> !channel */
|
||||
new_name = *name == '!' && strlen(name) >= 1+5 ?
|
||||
g_strconcat("!", name+1+5, NULL) :
|
||||
g_strdup(name);
|
||||
|
||||
if (irc_channel_find(server, new_name) != NULL) {
|
||||
/* this was second !channel with same name,
|
||||
show the channel id after all */
|
||||
g_free_and_null(new_name);
|
||||
}
|
||||
|
||||
visible_name = new_name;
|
||||
}
|
||||
|
||||
channel_init((CHANNEL_REC *) rec, (SERVER_REC *) server,
|
||||
name, visible_name, automatic);
|
||||
g_free(new_name);
|
||||
return rec;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user