summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/irc/core/channel-events.c21
-rw-r--r--src/irc/core/irc-channels.c18
2 files changed, 13 insertions, 26 deletions
diff --git a/src/irc/core/channel-events.c b/src/irc/core/channel-events.c
index a296938d..02fe0242 100644
--- a/src/irc/core/channel-events.c
+++ b/src/irc/core/channel-events.c
@@ -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);
}
diff --git a/src/irc/core/irc-channels.c b/src/irc/core/irc-channels.c
index 3e6b2378..d6acf6ae 100644
--- a/src/irc/core/irc-channels.c
+++ b/src/irc/core/irc-channels.c
@@ -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;
}