diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2008-03-15 09:50:37 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2008-03-15 09:50:37 +0100 |
commit | 08522770e8cbad5b9c057c8743b13169a986b1bb (patch) | |
tree | e7df05f6ce6628cbe0e4aadb978754387852f263 /src/plugins/irc/irc-nick.c | |
parent | 13c6866c80521bbd7ed0874b0966c5bb71f80531 (diff) | |
download | weechat-08522770e8cbad5b9c057c8743b13169a986b1bb.zip |
New format for many IRC protocol commands, bugs fixed in IRC plugin
Diffstat (limited to 'src/plugins/irc/irc-nick.c')
-rw-r--r-- | src/plugins/irc/irc-nick.c | 47 |
1 files changed, 43 insertions, 4 deletions
diff --git a/src/plugins/irc/irc-nick.c b/src/plugins/irc/irc-nick.c index 6cf854ea4..e5ba83646 100644 --- a/src/plugins/irc/irc-nick.c +++ b/src/plugins/irc/irc-nick.c @@ -148,6 +148,14 @@ irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel, ptr_nick = irc_nick_search (channel, nick_name); if (ptr_nick) { + /* remove old nick from nicklist */ + irc_nick_get_gui_infos (channel->buffer, ptr_nick, &prefix, + &prefix_color, &ptr_group); + weechat_nicklist_remove_nick (channel->buffer, + weechat_nicklist_search_nick (channel->buffer, + ptr_group, + ptr_nick->name)); + /* update nick */ IRC_NICK_SET_FLAG(ptr_nick, is_chanowner, IRC_NICK_CHANOWNER); IRC_NICK_SET_FLAG(ptr_nick, is_chanadmin, IRC_NICK_CHANADMIN); @@ -157,12 +165,9 @@ irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel, IRC_NICK_SET_FLAG(ptr_nick, has_voice, IRC_NICK_VOICE); IRC_NICK_SET_FLAG(ptr_nick, is_chanuser, IRC_NICK_CHANUSER); + /* add new nick in nicklist */ irc_nick_get_gui_infos (channel->buffer, ptr_nick, &prefix, &prefix_color, &ptr_group); - weechat_nicklist_remove_nick (channel->buffer, - weechat_nicklist_search_nick (channel->buffer, - ptr_group, - ptr_nick->name)); snprintf (str_prefix_color, sizeof (str_prefix_color), "color_nicklist_prefix%d", prefix_color); @@ -270,6 +275,40 @@ irc_nick_change (struct t_irc_server *server, struct t_irc_channel *channel, } /* + * irc_nick_set: set a flag for a nick + */ + +void +irc_nick_set (struct t_irc_channel *channel, + struct t_irc_nick *nick, int set, int flag) +{ + char prefix, str_prefix_color[64]; + int prefix_color; + + struct t_gui_nick_group *ptr_group; + /* remove nick from nicklist */ + irc_nick_get_gui_infos (channel->buffer, nick, &prefix, + &prefix_color, &ptr_group); + weechat_nicklist_remove_nick (channel->buffer, + weechat_nicklist_search_nick (channel->buffer, + ptr_group, + nick->name)); + + /* set flag */ + IRC_NICK_SET_FLAG(nick, set, flag); + + /* add nick in nicklist */ + irc_nick_get_gui_infos (channel->buffer, nick, &prefix, + &prefix_color, &ptr_group); + snprintf (str_prefix_color, sizeof (str_prefix_color), + "color_nicklist_prefix%d", + prefix_color); + weechat_nicklist_add_nick (channel->buffer, ptr_group, + nick->name, nick->color, + prefix, str_prefix_color, 1); +} + +/* * irc_nick_free: free a nick and remove it from nicks list */ |