summaryrefslogtreecommitdiff
path: root/src/irc
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-03-14 23:01:57 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-03-14 23:01:57 +0000
commitbd7e173c63c447d7b427c0f143960feef6bbe030 (patch)
tree5afe745854a26e414a7ed1193e0a561b18c97c2d /src/irc
parent2a1b4c0a170bf18944b4b15905194c62aafd7472 (diff)
downloadirssi-bd7e173c63c447d7b427c0f143960feef6bbe030.zip
Fixed that "nick already in split list, how?" bug with a patch from fuchs.
I didn't realize someone else could change nick to one in the split list. :) git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2614 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/irc')
-rw-r--r--src/irc/core/netsplit.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/irc/core/netsplit.c b/src/irc/core/netsplit.c
index d19c404b..c7018ec1 100644
--- a/src/irc/core/netsplit.c
+++ b/src/irc/core/netsplit.c
@@ -103,11 +103,6 @@ static NETSPLIT_REC *netsplit_add(IRC_SERVER_REC *server, const char *nick,
g_return_val_if_fail(nick != NULL, NULL);
g_return_val_if_fail(address != NULL, NULL);
- if (g_hash_table_lookup(server->splits, nick) != NULL) {
- g_warning("%s is already in split list (how?)", nick);
- return NULL;
- }
-
/* get splitted servers */
dupservers = g_strdup(servers);
p = strchr(dupservers, ' ');
@@ -356,6 +351,24 @@ static void event_quit(IRC_SERVER_REC *server, const char *data,
}
}
+static void event_nick(IRC_SERVER_REC *server, const char *data)
+{
+ NETSPLIT_REC *rec;
+ char *params, *nick;
+
+ params = event_get_params(data, 1, &nick);
+
+ /* remove nick from split list when somebody changed
+ nick to this one during split */
+ rec = g_hash_table_lookup(server->splits, nick);
+ if (rec != NULL) {
+ g_hash_table_remove(server->splits, rec->nick);
+ netsplit_destroy(server, rec);
+ }
+
+ g_free(params);
+}
+
static void sig_disconnected(IRC_SERVER_REC *server)
{
g_return_if_fail(server != NULL);
@@ -404,6 +417,7 @@ void netsplit_init(void)
signal_add_first("event join", (SIGNAL_FUNC) event_join);
signal_add_last("event join", (SIGNAL_FUNC) event_join_last);
signal_add_first("event quit", (SIGNAL_FUNC) event_quit);
+ signal_add("event nick", (SIGNAL_FUNC) event_nick);
signal_add("server disconnected", (SIGNAL_FUNC) sig_disconnected);
}
@@ -413,5 +427,6 @@ void netsplit_deinit(void)
signal_remove("event join", (SIGNAL_FUNC) event_join);
signal_remove("event join", (SIGNAL_FUNC) event_join_last);
signal_remove("event quit", (SIGNAL_FUNC) event_quit);
+ signal_remove("event nick", (SIGNAL_FUNC) event_nick);
signal_remove("server disconnected", (SIGNAL_FUNC) sig_disconnected);
}