diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2005-05-07 06:56:01 +0000 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2005-05-07 06:56:01 +0000 |
commit | e7c899014c3e0b0850fa2b12627d1207998a2bdd (patch) | |
tree | b0331fc8528d358e4762b18b0c2face50b4ae651 /src | |
parent | f88b75b241a23aba7a4bceb84f78cfa4caa1934c (diff) | |
download | weechat-e7c899014c3e0b0850fa2b12627d1207998a2bdd.zip |
Fixed nicklist sort mode: now modes are not cumulated any more (so for example all op will be sorted together)
Diffstat (limited to 'src')
-rw-r--r-- | src/irc/irc-nick.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/irc/irc-nick.c b/src/irc/irc-nick.c index 03c511947..af845e3f2 100644 --- a/src/irc/irc-nick.c +++ b/src/irc/irc-nick.c @@ -52,6 +52,26 @@ nick_find_color (t_irc_nick *nick) } /* + * nick_score_for_sort: return score for sorting nick, according to privileges + */ + +int +nick_score_for_sort (t_irc_nick *nick) +{ + if (nick->is_chanowner) + return -32; + if (nick->is_chanadmin) + return -16; + if (nick->is_op) + return -8; + if (nick->is_halfop) + return -4; + if (nick->has_voice) + return -2; + return 0; +} + +/* * nick_compare: compare two nicks * return: -1 is nick1 < nick2 * 0 if nick1 = nick2 @@ -64,10 +84,8 @@ nick_compare (t_irc_nick *nick1, t_irc_nick *nick2) { int score1, score2, comp; - score1 = - ( (nick1->is_chanowner * 32) + (nick1->is_chanadmin * 16) + - (nick1->is_op * 8) + (nick1->is_halfop * 4) + (nick1->has_voice * 2) ); - score2 = - ( (nick2->is_chanowner * 32) + (nick2->is_chanadmin * 16) + - (nick2->is_op * 8) + (nick2->is_halfop * 4) + (nick2->has_voice * 2) ); + score1 = nick_score_for_sort (nick1); + score2 = nick_score_for_sort (nick2); comp = strcasecmp(nick1->nick, nick2->nick); if (comp > 0) |