diff options
author | Wouter Coekaerts <coekie@irssi.org> | 2010-07-24 14:36:55 +0000 |
---|---|---|
committer | coekie <coekie@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2010-07-24 14:36:55 +0000 |
commit | 350b346c844a2b10b27c64b0a65f83e72d224f89 (patch) | |
tree | 63cea61c5f6e7f6c474dff326199d458eb63a2fc /src/irc | |
parent | ab33ac15afdc505f6bb934b713270caba321197b (diff) | |
download | irssi-350b346c844a2b10b27c64b0a65f83e72d224f89.zip |
Add prefixes to irc_nicklist_insert() so that nickrec.prefixes is accurate in the
"nicklist new" signal.
Fixes the nicklist sorting on xirssi.
Patch by nenolod.
git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@5184 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/irc')
-rw-r--r-- | src/irc/core/irc-nicklist.c | 12 | ||||
-rw-r--r-- | src/irc/core/irc-nicklist.h | 3 | ||||
-rw-r--r-- | src/irc/core/irc-session.c | 5 | ||||
-rw-r--r-- | src/irc/core/massjoin.c | 2 |
4 files changed, 12 insertions, 10 deletions
diff --git a/src/irc/core/irc-nicklist.c b/src/irc/core/irc-nicklist.c index 81bb6cfe..f16bd870 100644 --- a/src/irc/core/irc-nicklist.c +++ b/src/irc/core/irc-nicklist.c @@ -31,7 +31,8 @@ /* Add new nick to list */ NICK_REC *irc_nicklist_insert(IRC_CHANNEL_REC *channel, const char *nick, - int op, int halfop, int voice, int send_massjoin) + int op, int halfop, int voice, int send_massjoin, + char *prefixes) { NICK_REC *rec; @@ -46,6 +47,10 @@ NICK_REC *irc_nicklist_insert(IRC_CHANNEL_REC *channel, const char *nick, if (voice) rec->voice = TRUE; rec->send_massjoin = send_massjoin; + if (prefixes != NULL) { + strocpy(rec->prefixes, prefixes, sizeof(rec->prefixes)); + } + nicklist_insert(CHANNEL(channel), rec); return rec; } @@ -159,8 +164,7 @@ static void event_names_list(IRC_SERVER_REC *server, const char *data) if (nicklist_find((CHANNEL_REC *) chanrec, ptr) == NULL) { rec = irc_nicklist_insert(chanrec, ptr, op, halfop, - voice, FALSE); - memcpy(rec->prefixes, prefixes, sizeof(rec->prefixes)); + voice, FALSE, prefixes); } } @@ -187,7 +191,7 @@ static void event_end_of_names(IRC_SERVER_REC *server, const char *data) nicks = g_hash_table_size(chanrec->nicks); ownnick = irc_nicklist_insert(chanrec, server->nick, nicks == 0, FALSE, - FALSE, FALSE); + FALSE, FALSE, NULL); } nicklist_set_own(CHANNEL(chanrec), ownnick); chanrec->chanop = chanrec->ownnick->op; diff --git a/src/irc/core/irc-nicklist.h b/src/irc/core/irc-nicklist.h index dd3d3237..b360d542 100644 --- a/src/irc/core/irc-nicklist.h +++ b/src/irc/core/irc-nicklist.h @@ -5,7 +5,8 @@ /* Add new nick to list */ NICK_REC *irc_nicklist_insert(IRC_CHANNEL_REC *channel, const char *nick, - int op, int halfop, int voice, int send_massjoin); + int op, int halfop, int voice, int send_massjoin, + char *prefixes); /* Remove all "extra" characters from `nick'. Like _nick_ -> nick */ char *irc_nick_strip(const char *nick); diff --git a/src/irc/core/irc-session.c b/src/irc/core/irc-session.c index 21fc5fc7..3c50e312 100644 --- a/src/irc/core/irc-session.c +++ b/src/irc/core/irc-session.c @@ -129,7 +129,6 @@ static void sig_session_restore_nick(IRC_CHANNEL_REC *channel, op = config_node_get_bool(node, "op", FALSE); voice = config_node_get_bool(node, "voice", FALSE); halfop = config_node_get_bool(node, "halfop", FALSE); - nickrec = irc_nicklist_insert(channel, nick, op, halfop, voice, FALSE); prefixes = config_node_get_str(node, "prefixes", NULL); if (prefixes == NULL || *prefixes == '\0') { /* upgrading from old irssi or from an in-between @@ -146,9 +145,7 @@ static void sig_session_restore_nick(IRC_CHANNEL_REC *channel, newprefixes[i] = '\0'; prefixes = newprefixes; } - strocpy(nickrec->prefixes, - prefixes, - sizeof(nickrec->prefixes)); + nickrec = irc_nicklist_insert(channel, nick, op, halfop, voice, FALSE, prefixes); } static void session_restore_channel(IRC_CHANNEL_REC *channel) diff --git a/src/irc/core/massjoin.c b/src/irc/core/massjoin.c index 1e321083..1322db7d 100644 --- a/src/irc/core/massjoin.c +++ b/src/irc/core/massjoin.c @@ -65,7 +65,7 @@ static void event_join(IRC_SERVER_REC *server, const char *data, } /* add user to nicklist */ - nickrec = irc_nicklist_insert(chanrec, nick, FALSE, FALSE, FALSE, TRUE); + nickrec = irc_nicklist_insert(chanrec, nick, FALSE, FALSE, FALSE, TRUE, NULL); nicklist_set_host(CHANNEL(chanrec), nickrec, address); if (chanrec->massjoins == 0) { |