diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2010-05-29 09:18:19 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2010-05-29 09:18:19 +0200 |
commit | b36ed393886c6b6a8fec6397b37b555dd4922592 (patch) | |
tree | 369ba3df6c16eb3bcf22c813022dc0a3df489206 /src/plugins/irc | |
parent | f93eec488e1826d9fb1a49a8aecbaa6b4ab2647b (diff) | |
download | weechat-b36ed393886c6b6a8fec6397b37b555dd4922592.zip |
Fix bug with nick prefix '*' (chan founder) on some IRC servers (bug #29890)
Diffstat (limited to 'src/plugins/irc')
-rw-r--r-- | src/plugins/irc/irc-bar-item.c | 4 | ||||
-rw-r--r-- | src/plugins/irc/irc-channel.c | 2 | ||||
-rw-r--r-- | src/plugins/irc/irc-input.c | 3 | ||||
-rw-r--r-- | src/plugins/irc/irc-mode.c | 83 | ||||
-rw-r--r-- | src/plugins/irc/irc-mode.h | 8 | ||||
-rw-r--r-- | src/plugins/irc/irc-nick.c | 48 | ||||
-rw-r--r-- | src/plugins/irc/irc-nick.h | 16 | ||||
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 27 | ||||
-rw-r--r-- | src/plugins/irc/irc-server.c | 2 | ||||
-rw-r--r-- | src/plugins/irc/irc-server.h | 6 |
10 files changed, 128 insertions, 71 deletions
diff --git a/src/plugins/irc/irc-bar-item.c b/src/plugins/irc/irc-bar-item.c index c791e674a..c34723478 100644 --- a/src/plugins/irc/irc-bar-item.c +++ b/src/plugins/irc/irc-bar-item.c @@ -434,8 +434,8 @@ irc_bar_item_input_prompt (void *data, struct t_gui_bar_item *item, { prefix[0] = '\0'; prefix[1] = '\0'; - irc_nick_get_gui_infos (ptr_nick, &prefix[0], &prefix_color, - NULL, NULL); + irc_nick_get_gui_infos (server, ptr_nick, + &prefix[0], &prefix_color, NULL, NULL); if (prefix[0] != ' ') { snprintf (str_prefix_color, sizeof (str_prefix_color), diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c index 74ba350c2..60362d44f 100644 --- a/src/plugins/irc/irc-channel.c +++ b/src/plugins/irc/irc-channel.c @@ -759,7 +759,7 @@ irc_channel_free (struct t_irc_server *server, struct t_irc_channel *channel) free (channel->modes); if (channel->key) free (channel->key); - irc_nick_free_all (channel); + irc_nick_free_all (server, channel); if (channel->away_message) free (channel->away_message); if (channel->pv_remote_nick_color) diff --git a/src/plugins/irc/irc-input.c b/src/plugins/irc/irc-input.c index f15e13b92..48464d03b 100644 --- a/src/plugins/irc/irc-input.c +++ b/src/plugins/irc/irc-input.c @@ -61,7 +61,8 @@ irc_input_user_message_display (struct t_gui_buffer *buffer, const char *text) weechat_printf_tags (buffer, irc_protocol_tags ("privmsg", "no_highlight"), "%s%s", - irc_nick_as_prefix ((ptr_nick) ? ptr_nick : NULL, + irc_nick_as_prefix (ptr_server, + (ptr_nick) ? ptr_nick : NULL, (ptr_nick) ? NULL : ptr_server->nick, IRC_COLOR_CHAT_NICK_SELF), (text_decoded) ? text_decoded : text); diff --git a/src/plugins/irc/irc-mode.c b/src/plugins/irc/irc-mode.c index 682db6d19..6c28cef65 100644 --- a/src/plugins/irc/irc-mode.c +++ b/src/plugins/irc/irc-mode.c @@ -124,7 +124,7 @@ irc_mode_channel_set (struct t_irc_server *server, case 'a': /* channel admin (unrealircd specific flag) */ ptr_arg = ((current_arg >= 0) && (current_arg < argc)) ? argv[current_arg] : NULL; - mode = irc_mode_get_nick_prefix (server, "a", '~'); + mode = irc_mode_get_nick_attr (server, "a", '~'); if (mode >= 0) { irc_mode_channel_set_nick (server, channel, ptr_arg, @@ -140,7 +140,7 @@ irc_mode_channel_set (struct t_irc_server *server, case 'h': /* half-op */ ptr_arg = ((current_arg >= 0) && (current_arg < argc)) ? argv[current_arg] : NULL; - mode = irc_mode_get_nick_prefix (server, "h", '%'); + mode = irc_mode_get_nick_attr (server, "h", '%'); if (mode >= 0) { irc_mode_channel_set_nick (server, channel, ptr_arg, @@ -180,7 +180,7 @@ irc_mode_channel_set (struct t_irc_server *server, case 'o': /* op */ ptr_arg = ((current_arg >= 0) && (current_arg < argc)) ? argv[current_arg] : NULL; - mode = irc_mode_get_nick_prefix (server, "o", '@'); + mode = irc_mode_get_nick_attr (server, "o", '@'); if (mode >= 0) { irc_mode_channel_set_nick (server, channel, ptr_arg, @@ -191,7 +191,7 @@ irc_mode_channel_set (struct t_irc_server *server, case 'q': /* channel owner (unrealircd specific flag) */ ptr_arg = ((current_arg >= 0) && (current_arg < argc)) ? argv[current_arg] : NULL; - mode = irc_mode_get_nick_prefix (server, "q", '~'); + mode = irc_mode_get_nick_attr (server, "q", '~'); if (mode >= 0) { irc_mode_channel_set_nick (server, channel, ptr_arg, @@ -202,7 +202,7 @@ irc_mode_channel_set (struct t_irc_server *server, case 'u': /* channel user */ ptr_arg = ((current_arg >= 0) && (current_arg < argc)) ? argv[current_arg] : NULL; - mode = irc_mode_get_nick_prefix (server, "u", '-'); + mode = irc_mode_get_nick_attr (server, "u", '-'); if (mode >= 0) { irc_mode_channel_set_nick (server, channel, ptr_arg, @@ -213,7 +213,7 @@ irc_mode_channel_set (struct t_irc_server *server, case 'v': /* voice */ ptr_arg = ((current_arg >= 0) && (current_arg < argc)) ? argv[current_arg] : NULL; - mode = irc_mode_get_nick_prefix (server, "v", '+'); + mode = irc_mode_get_nick_attr (server, "v", '+'); if (mode >= 0) { irc_mode_channel_set_nick (server, channel, ptr_arg, @@ -328,12 +328,12 @@ irc_mode_user_set (struct t_irc_server *server, const char *modes) } /* - * irc_mode_get_prefix_value: get internal value for prefix - * return -1 if prefix is unknown + * irc_mode_prefix_to_nick_attr: get nick attribute for prefix + * return -1 if prefix is unknown */ int -irc_mode_get_prefix_value (char prefix) +irc_mode_prefix_to_nick_attr (char prefix) { switch (prefix) { @@ -341,6 +341,8 @@ irc_mode_get_prefix_value (char prefix) return IRC_NICK_OP; case '~': /* channel owner */ return IRC_NICK_CHANOWNER; + case '*': /* channel owner */ + return IRC_NICK_CHANOWNER; case '&': /* channel admin */ return IRC_NICK_CHANADMIN; case '!': /* channel admin (2) */ @@ -357,16 +359,16 @@ irc_mode_get_prefix_value (char prefix) } /* - * irc_mode_get_nick_prefix: return nick prefix, if allowed by server - * return -1 if not allowed - * for example : - * IRC: 005 (...) PREFIX=(ov)@+ - * => allowed prefixes: @+ + * irc_mode_get_nick_attr: return nick attribute for mode, if allowed by server + * return -1 if not allowed + * for example : + * IRC: 005 (...) PREFIX=(ohv)@%+ + * => allowed modes: ohv */ int -irc_mode_get_nick_prefix (struct t_irc_server *server, char *mode, - char prefix) +irc_mode_get_nick_attr (struct t_irc_server *server, char *mode, + char prefix) { char str[2], *pos, *ptr_prefixes, *pos_mode; int index; @@ -376,10 +378,10 @@ irc_mode_get_nick_prefix (struct t_irc_server *server, char *mode, { str[0] = prefix; str[1] = '\0'; - pos = strpbrk (str, IRC_NICK_DEFAULT_PREFIXES_LIST); + pos = strpbrk (str, IRC_MODE_NICK_DEFAULT_PREFIXES_LIST); if (!pos) return -1; - return irc_mode_get_prefix_value (pos[0]); + return irc_mode_prefix_to_nick_attr (pos[0]); } /* find start of prefixes, after "(...)" */ @@ -396,7 +398,7 @@ irc_mode_get_nick_prefix (struct t_irc_server *server, char *mode, index = pos_mode - server->prefix - 1; if (pos_mode && (index < (int)strlen (ptr_prefixes))) { - return irc_mode_get_prefix_value (ptr_prefixes[index]); + return irc_mode_prefix_to_nick_attr (ptr_prefixes[index]); } } } @@ -408,5 +410,46 @@ irc_mode_get_nick_prefix (struct t_irc_server *server, char *mode, if (!pos) return -1; - return irc_mode_get_prefix_value (pos[0]); + return irc_mode_prefix_to_nick_attr (pos[0]); +} + +/* + * irc_mode_get_prefix: return prefix for mode + * for example if prefixes are: + * IRC: 005 (...) PREFIX=(ohv)@%+ + * 'o' will return '@' + * 'h' will return '%' + * 'v' will return '+' + */ + +char +irc_mode_get_prefix (struct t_irc_server *server, char mode, + char default_prefix) +{ + char *ptr_prefixes, *pos_mode; + int index; + + if (!server->prefix) + return default_prefix; + + /* find start of prefixes, after "(...)" */ + ptr_prefixes = strchr (server->prefix, ')'); + if (ptr_prefixes) + ptr_prefixes++; + + if (!ptr_prefixes || !ptr_prefixes[0]) + return default_prefix; + + /* search prefix for mode */ + pos_mode = strchr (server->prefix + 1, mode); + if (pos_mode && (pos_mode < ptr_prefixes)) + { + index = pos_mode - server->prefix - 1; + if (pos_mode && (index < (int)strlen (ptr_prefixes))) + { + return ptr_prefixes[index]; + } + } + + return default_prefix; } diff --git a/src/plugins/irc/irc-mode.h b/src/plugins/irc/irc-mode.h index bf52d5414..a6969071a 100644 --- a/src/plugins/irc/irc-mode.h +++ b/src/plugins/irc/irc-mode.h @@ -20,6 +20,8 @@ #ifndef __WEECHAT_IRC_MODE_H #define __WEECHAT_IRC_MODE_H 1 +#define IRC_MODE_NICK_DEFAULT_PREFIXES_LIST "@%+~*&!-" + struct t_irc_server; struct t_irc_channel; @@ -27,7 +29,9 @@ extern int irc_mode_channel_set (struct t_irc_server *server, struct t_irc_channel *channel, const char *modes); extern void irc_mode_user_set (struct t_irc_server *server, const char *modes); -extern int irc_mode_get_nick_prefix (struct t_irc_server *server, char *mode, - char prefix); +extern int irc_mode_get_nick_attr (struct t_irc_server *server, char *mode, + char prefix); +extern char irc_mode_get_prefix (struct t_irc_server *server, char mode, + char default_prefix); #endif /* irc-mode.h */ diff --git a/src/plugins/irc/irc-nick.c b/src/plugins/irc/irc-nick.c index 1e82a1d84..c0c4975c6 100644 --- a/src/plugins/irc/irc-nick.c +++ b/src/plugins/irc/irc-nick.c @@ -31,6 +31,7 @@ #include "irc-nick.h" #include "irc-color.h" #include "irc-config.h" +#include "irc-mode.h" #include "irc-server.h" #include "irc-channel.h" @@ -121,7 +122,8 @@ irc_nick_find_color (const char *nickname) */ void -irc_nick_get_gui_infos (struct t_irc_nick *nick, +irc_nick_get_gui_infos (struct t_irc_server *server, + struct t_irc_nick *nick, char *prefix, int *prefix_color, struct t_gui_buffer *buffer, struct t_gui_nick_group **group) @@ -129,7 +131,7 @@ irc_nick_get_gui_infos (struct t_irc_nick *nick, if (nick->flags & IRC_NICK_CHANOWNER) { if (prefix) - prefix[0] = '~'; + prefix[0] = irc_mode_get_prefix (server, 'q', '~'); if (prefix_color) *prefix_color = 1; if (buffer && group) @@ -139,7 +141,7 @@ irc_nick_get_gui_infos (struct t_irc_nick *nick, else if (nick->flags & IRC_NICK_CHANADMIN) { if (prefix) - prefix[0] = '&'; + prefix[0] = irc_mode_get_prefix (server, 'a', '&'); if (prefix_color) *prefix_color = 1; if (buffer && group) @@ -149,7 +151,7 @@ irc_nick_get_gui_infos (struct t_irc_nick *nick, else if (nick->flags & IRC_NICK_CHANADMIN2) { if (prefix) - prefix[0] = '!'; + prefix[0] = irc_mode_get_prefix (server, 'a', '!'); if (prefix_color) *prefix_color = 1; if (buffer && group) @@ -159,7 +161,7 @@ irc_nick_get_gui_infos (struct t_irc_nick *nick, else if (nick->flags & IRC_NICK_OP) { if (prefix) - prefix[0] = '@'; + prefix[0] = irc_mode_get_prefix (server, 'o', '@'); if (prefix_color) *prefix_color = 1; if (buffer && group) @@ -169,7 +171,7 @@ irc_nick_get_gui_infos (struct t_irc_nick *nick, else if (nick->flags & IRC_NICK_HALFOP) { if (prefix) - prefix[0] = '%'; + prefix[0] = irc_mode_get_prefix (server, 'h', '%'); if (prefix_color) *prefix_color = 2; if (buffer && group) @@ -179,7 +181,7 @@ irc_nick_get_gui_infos (struct t_irc_nick *nick, else if (nick->flags & IRC_NICK_VOICE) { if (prefix) - prefix[0] = '+'; + prefix[0] = irc_mode_get_prefix (server, 'v', '+'); if (prefix_color) *prefix_color = 3; if (buffer && group) @@ -189,7 +191,7 @@ irc_nick_get_gui_infos (struct t_irc_nick *nick, else if (nick->flags & IRC_NICK_CHANUSER) { if (prefix) - prefix[0] = '-'; + prefix[0] = irc_mode_get_prefix (server, 'u', '-'); if (prefix_color) *prefix_color = 4; if (buffer && group) @@ -228,7 +230,7 @@ irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel, if (ptr_nick) { /* remove old nick from nicklist */ - irc_nick_get_gui_infos (ptr_nick, prefix, + irc_nick_get_gui_infos (server, ptr_nick, prefix, &prefix_color, channel->buffer, &ptr_group); weechat_nicklist_remove_nick (channel->buffer, weechat_nicklist_search_nick (channel->buffer, @@ -248,7 +250,7 @@ irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel, /* add new nick in nicklist */ prefix[0] = ' '; prefix[1] = '\0'; - irc_nick_get_gui_infos (ptr_nick, prefix, + irc_nick_get_gui_infos (server, ptr_nick, prefix, &prefix_color, channel->buffer, &ptr_group); snprintf (str_prefix_color, sizeof (str_prefix_color), "weechat.color.nicklist_prefix%d", @@ -299,7 +301,7 @@ irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel, /* add nick to buffer nicklist */ prefix[0] = ' '; prefix[1] = '\0'; - irc_nick_get_gui_infos (new_nick, prefix, &prefix_color, + irc_nick_get_gui_infos (server, new_nick, prefix, &prefix_color, channel->buffer, &ptr_group); snprintf (str_prefix_color, sizeof (str_prefix_color), "weechat.color.nicklist_prefix%d", @@ -327,7 +329,7 @@ irc_nick_change (struct t_irc_server *server, struct t_irc_channel *channel, char prefix[2], str_prefix_color[64]; /* remove nick from nicklist */ - irc_nick_get_gui_infos (nick, prefix, &prefix_color, + irc_nick_get_gui_infos (server, nick, prefix, &prefix_color, channel->buffer, &ptr_group); weechat_nicklist_remove_nick (channel->buffer, weechat_nicklist_search_nick (channel->buffer, @@ -351,7 +353,7 @@ irc_nick_change (struct t_irc_server *server, struct t_irc_channel *channel, /* add nick in nicklist */ prefix[0] = ' '; prefix[1] = '\0'; - irc_nick_get_gui_infos (nick, prefix, &prefix_color, + irc_nick_get_gui_infos (server, nick, prefix, &prefix_color, channel->buffer, &ptr_group); snprintf (str_prefix_color, sizeof (str_prefix_color), "weechat.color.nicklist_prefix%d", @@ -376,7 +378,7 @@ irc_nick_set (struct t_irc_server *server, struct t_irc_channel *channel, struct t_gui_nick_group *ptr_group; /* remove nick from nicklist */ - irc_nick_get_gui_infos (nick, prefix, &prefix_color, + irc_nick_get_gui_infos (server, nick, prefix, &prefix_color, channel->buffer, &ptr_group); weechat_nicklist_remove_nick (channel->buffer, weechat_nicklist_search_nick (channel->buffer, @@ -389,7 +391,7 @@ irc_nick_set (struct t_irc_server *server, struct t_irc_channel *channel, /* add nick in nicklist */ prefix[0] = ' '; prefix[1] = '\0'; - irc_nick_get_gui_infos (nick, prefix, &prefix_color, + irc_nick_get_gui_infos (server, nick, prefix, &prefix_color, channel->buffer, &ptr_group); snprintf (str_prefix_color, sizeof (str_prefix_color), "weechat.color.nicklist_prefix%d", @@ -409,7 +411,8 @@ irc_nick_set (struct t_irc_server *server, struct t_irc_channel *channel, */ void -irc_nick_free (struct t_irc_channel *channel, struct t_irc_nick *nick) +irc_nick_free (struct t_irc_server *server, struct t_irc_channel *channel, + struct t_irc_nick *nick) { struct t_irc_nick *new_nicks; char prefix; @@ -420,7 +423,7 @@ irc_nick_free (struct t_irc_channel *channel, struct t_irc_nick *nick) return; /* remove nick from nicklist */ - irc_nick_get_gui_infos (nick, &prefix, &prefix_color, + irc_nick_get_gui_infos (server, nick, &prefix, &prefix_color, channel->buffer, &ptr_group); weechat_nicklist_remove_nick (channel->buffer, weechat_nicklist_search_nick (channel->buffer, @@ -460,7 +463,7 @@ irc_nick_free (struct t_irc_channel *channel, struct t_irc_nick *nick) */ void -irc_nick_free_all (struct t_irc_channel *channel) +irc_nick_free_all (struct t_irc_server *server, struct t_irc_channel *channel) { if (!channel) return; @@ -468,7 +471,7 @@ irc_nick_free_all (struct t_irc_channel *channel) /* remove all nicks for the channel */ while (channel->nicks) { - irc_nick_free (channel, channel->nicks); + irc_nick_free (server, channel, channel->nicks); } /* sould be zero, but prevent any bug :D */ @@ -560,8 +563,8 @@ irc_nick_set_away (struct t_irc_server *server, struct t_irc_channel *channel, */ char * -irc_nick_as_prefix (struct t_irc_nick *nick, const char *nickname, - const char *force_color) +irc_nick_as_prefix (struct t_irc_server *server, struct t_irc_nick *nick, + const char *nickname, const char *force_color) { static char result[256]; char prefix[2], str_prefix_color[64]; @@ -573,7 +576,8 @@ irc_nick_as_prefix (struct t_irc_nick *nick, const char *nickname, { if (nick) { - irc_nick_get_gui_infos (nick, &prefix[0], &prefix_color, NULL, NULL); + irc_nick_get_gui_infos (server, nick, &prefix[0], &prefix_color, + NULL, NULL); if ((prefix[0] == ' ') && !weechat_config_boolean (weechat_config_get ("weechat.look.nickmode_empty"))) prefix[0] = '\0'; diff --git a/src/plugins/irc/irc-nick.h b/src/plugins/irc/irc-nick.h index 38705203e..093591094 100644 --- a/src/plugins/irc/irc-nick.h +++ b/src/plugins/irc/irc-nick.h @@ -20,8 +20,7 @@ #ifndef __WEECHAT_IRC_NICK_H #define __WEECHAT_IRC_NICK_H 1 -#define IRC_NICK_DEFAULT_PREFIXES_LIST "@%+~&!-" -#define IRC_NICK_VALID_CHARS "abcdefghijklmnopqrstuvwxyzABCDEFGHI" \ +#define IRC_NICK_VALID_CHARS "abcdefghijklmnopqrstuvwxyzABCDEFGHI" \ "JKLMNOPQRSTUVWXYZ0123456789-[]\\`_^{|}" #define IRC_NICK_CHANOWNER 1 @@ -71,7 +70,8 @@ extern int irc_nick_valid (struct t_irc_channel *channel, struct t_irc_nick *nick); extern int irc_nick_is_nick (const char *string); extern const char *irc_nick_find_color (const char *nickname); -extern void irc_nick_get_gui_infos (struct t_irc_nick *nick, +extern void irc_nick_get_gui_infos (struct t_irc_server *server, + struct t_irc_nick *nick, char *prefix, int *prefix_color, struct t_gui_buffer *buffer, struct t_gui_nick_group **group); @@ -92,9 +92,11 @@ extern void irc_nick_change (struct t_irc_server *server, extern void irc_nick_set (struct t_irc_server *server, struct t_irc_channel *channel, struct t_irc_nick *nick, int set, int flag); -extern void irc_nick_free (struct t_irc_channel *channel, +extern void irc_nick_free (struct t_irc_server *server, + struct t_irc_channel *channel, struct t_irc_nick *nick); -extern void irc_nick_free_all (struct t_irc_channel *channel); +extern void irc_nick_free_all (struct t_irc_server *server, + struct t_irc_channel *channel); extern struct t_irc_nick *irc_nick_search (struct t_irc_channel *channel, const char *nickname); extern void irc_nick_count (struct t_irc_channel *channel, int *total, @@ -103,7 +105,9 @@ extern void irc_nick_count (struct t_irc_channel *channel, int *total, extern void irc_nick_set_away (struct t_irc_server *server, struct t_irc_channel *channel, struct t_irc_nick *nick, int is_away); -extern char *irc_nick_as_prefix (struct t_irc_nick *nick, const char *nickname, +extern char *irc_nick_as_prefix (struct t_irc_server *server, + struct t_irc_nick *nick, + const char *nickname, const char *force_color); extern const char * irc_nick_color_for_pv (struct t_irc_channel *channel, const char *nickname); diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 40de6c864..4911e1ab3 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -687,7 +687,7 @@ IRC_PROTOCOL_CALLBACK(kick) * my nick was kicked => free all nicks, channel is not active any * more */ - irc_nick_free_all (ptr_channel); + irc_nick_free_all (server, ptr_channel); if (IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AUTOREJOIN)) { if (IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AUTOREJOIN_DELAY) == 0) @@ -713,7 +713,7 @@ IRC_PROTOCOL_CALLBACK(kick) * nick */ if (ptr_nick_kicked) - irc_nick_free (ptr_channel, ptr_nick_kicked); + irc_nick_free (server, ptr_channel, ptr_nick_kicked); } return WEECHAT_RC_OK; @@ -782,7 +782,7 @@ IRC_PROTOCOL_CALLBACK(kill) * my nick was killed => free all nicks, channel is not active any * more */ - irc_nick_free_all (ptr_channel); + irc_nick_free_all (server, ptr_channel); } else { @@ -791,7 +791,7 @@ IRC_PROTOCOL_CALLBACK(kill) * nick */ if (ptr_nick_killed) - irc_nick_free (ptr_channel, ptr_nick_killed); + irc_nick_free (server, ptr_channel, ptr_nick_killed); } } @@ -1096,7 +1096,7 @@ IRC_PROTOCOL_CALLBACK(notice) irc_protocol_tags (command, "notify_private"), "%s%s", - irc_nick_as_prefix (NULL, nick, + irc_nick_as_prefix (server, NULL, nick, irc_nick_color_for_pv (ptr_channel, nick)), pos_args); if ((ptr_channel->type == IRC_CHANNEL_TYPE_PRIVATE) @@ -1259,7 +1259,7 @@ IRC_PROTOCOL_CALLBACK(part) /* part request was issued by local client ? */ if (local_part) { - irc_nick_free_all (ptr_channel); + irc_nick_free_all (server, ptr_channel); /* cycling ? => rejoin channel immediately */ if (ptr_channel->cycle) @@ -1291,7 +1291,7 @@ IRC_PROTOCOL_CALLBACK(part) } } else - irc_nick_free (ptr_channel, ptr_nick); + irc_nick_free (server, ptr_channel, ptr_nick); } } @@ -1402,7 +1402,7 @@ IRC_PROTOCOL_CALLBACK(privmsg) irc_protocol_tags (command, "notify_message"), "%s%s", - irc_nick_as_prefix (ptr_nick, + irc_nick_as_prefix (server, ptr_nick, (ptr_nick) ? NULL : nick, NULL), pos_args); @@ -1470,8 +1470,7 @@ IRC_PROTOCOL_CALLBACK(privmsg) "notify_private,no_highlight" : "notify_private"), "%s%s", - irc_nick_as_prefix (NULL, - nick, + irc_nick_as_prefix (server, NULL, nick, (nick_is_me) ? IRC_COLOR_CHAT_NICK_SELF : irc_nick_color_for_pv (ptr_channel, nick)), pos_args); @@ -1584,7 +1583,7 @@ IRC_PROTOCOL_CALLBACK(quit) } } if (ptr_nick) - irc_nick_free (ptr_channel, ptr_nick); + irc_nick_free (server, ptr_channel, ptr_nick); } } @@ -3268,7 +3267,7 @@ IRC_PROTOCOL_CALLBACK(353) { prefix_found = 0; - if (irc_mode_get_nick_prefix (server, NULL, pos_nick[0]) >= 0) + if (irc_mode_get_nick_attr (server, NULL, pos_nick[0]) >= 0) { prefix_found = 1; switch (pos_nick[0]) @@ -3281,6 +3280,10 @@ IRC_PROTOCOL_CALLBACK(353) is_chanowner = 1; color = IRC_COLOR_NICKLIST_PREFIX1; break; + case '*': /* channel owner */ + is_chanowner = 1; + color = IRC_COLOR_NICKLIST_PREFIX1; + break; case '&': /* channel admin */ is_chanadmin = 1; color = IRC_COLOR_NICKLIST_PREFIX1; diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index 3976ff21d..704aa9eb4 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -2996,7 +2996,7 @@ irc_server_disconnect (struct t_irc_server *server, int reconnect) for (ptr_channel = server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel) { - irc_nick_free_all (ptr_channel); + irc_nick_free_all (server, ptr_channel); weechat_printf (ptr_channel->buffer, _("%s%s: disconnected from server"), "", diff --git a/src/plugins/irc/irc-server.h b/src/plugins/irc/irc-server.h index 9e202bf80..bf9bfefda 100644 --- a/src/plugins/irc/irc-server.h +++ b/src/plugins/irc/irc-server.h @@ -82,10 +82,8 @@ enum t_irc_server_option weechat_config_string(irc_config_server_default[__index]) \ : weechat_config_string_default(irc_config_server_default[__index]))) -#define IRC_SERVER_DEFAULT_PORT 6667 -#define IRC_SERVER_DEFAULT_PREFIXES_LIST "@%+~&!-" -#define IRC_SERVER_DEFAULT_NICKS "weechat1,weechat2,weechat3," \ - "weechat4,weechat5" +#define IRC_SERVER_DEFAULT_PORT 6667 +#define IRC_SERVER_DEFAULT_NICKS "weechat1,weechat2,weechat3,weechat4,weechat5" #define IRC_SERVER_OUTQUEUE_PRIO_HIGH 1 #define IRC_SERVER_OUTQUEUE_PRIO_LOW 2 |