diff options
author | Timo Sirainen <cras@irssi.org> | 2001-02-19 04:33:39 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-02-19 04:33:39 +0000 |
commit | f453e84436dc6e452b1f1be40611d1b11c57051d (patch) | |
tree | 29b22d389522fdf0958cca75f86b79538509da7b /src/fe-common/irc/fe-netsplit.c | |
parent | 19dff227d804e17c85afb38e3621cd60856bc50e (diff) | |
download | irssi-f453e84436dc6e452b1f1be40611d1b11c57051d.zip |
/NETSPLIT prints nicks now sorted and prints @ or + before channel if
user was opped/voiced before split.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1251 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common/irc/fe-netsplit.c')
-rw-r--r-- | src/fe-common/irc/fe-netsplit.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/src/fe-common/irc/fe-netsplit.c b/src/fe-common/irc/fe-netsplit.c index 6919672f..513a1ec4 100644 --- a/src/fe-common/irc/fe-netsplit.c +++ b/src/fe-common/irc/fe-netsplit.c @@ -289,19 +289,39 @@ static void sig_netsplit_servers(void) } } -static void split_print(const char *nick, NETSPLIT_REC *rec) +static int split_equal(NETSPLIT_REC *n1, NETSPLIT_REC *n2) +{ + return g_strcasecmp(n1->nick, n2->nick); +} + +static void split_get(void *key, NETSPLIT_REC *rec, GSList **list) +{ + *list = g_slist_insert_sorted(*list, rec, + (GCompareFunc) split_equal); +} + +static void split_print(NETSPLIT_REC *rec) { NETSPLIT_CHAN_REC *chan; + char *chanstr; chan = rec->channels->data; + chanstr = chan == NULL ? "" : + g_strconcat(chan->nick.op ? "@" : + (chan->nick.voice ? "+" : ""), chan->name, NULL); + printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, IRCTXT_NETSPLITS_LINE, - rec->nick, chan == NULL ? "" : chan->name, - rec->server->server, rec->server->destserver); + rec->nick, chanstr, rec->server->server, + rec->server->destserver); + + g_free(chanstr); } /* SYNTAX: NETSPLIT */ static void cmd_netsplit(const char *data, IRC_SERVER_REC *server) { + GSList *list; + if (!IS_IRC_SERVER(server) || !server->connected) cmd_return_error(CMDERR_NOT_CONNECTED); @@ -312,7 +332,12 @@ static void cmd_netsplit(const char *data, IRC_SERVER_REC *server) } printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, IRCTXT_NETSPLITS_HEADER); - g_hash_table_foreach(server->splits, (GHFunc) split_print, NULL); + + list = NULL; + g_hash_table_foreach(server->splits, (GHFunc) split_get, &list); + g_slist_foreach(list, (GFunc) split_print, NULL); + g_slist_free(list); + printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, IRCTXT_NETSPLITS_FOOTER); } |