diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2009-02-17 19:23:16 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2009-02-17 19:23:16 +0100 |
commit | b5f27d3fead4740099054f82e9a246ebd8a6ae9d (patch) | |
tree | 4f8a31924c4fc4b3cda8af53ba9d06809d23bfb4 /src | |
parent | eaf3319ed342d008893c613817cc5dc13449098c (diff) | |
download | weechat-b5f27d3fead4740099054f82e9a246ebd8a6ae9d.zip |
Use string instead of char for prefixes in nicklist
Diffstat (limited to 'src')
-rw-r--r-- | src/core/wee-upgrade.c | 5 | ||||
-rw-r--r-- | src/gui/gui-bar-item.c | 7 | ||||
-rw-r--r-- | src/gui/gui-nicklist.c | 14 | ||||
-rw-r--r-- | src/gui/gui-nicklist.h | 11 | ||||
-rw-r--r-- | src/plugins/irc/irc-nick.c | 44 | ||||
-rw-r--r-- | src/plugins/jabber/jabber-buddy.c | 44 | ||||
-rw-r--r-- | src/plugins/scripts/lua/weechat-lua-api.c | 9 | ||||
-rw-r--r-- | src/plugins/scripts/perl/weechat-perl-api.c | 12 | ||||
-rw-r--r-- | src/plugins/scripts/python/weechat-python-api.c | 8 | ||||
-rw-r--r-- | src/plugins/scripts/ruby/weechat-ruby-api.c | 11 | ||||
-rw-r--r-- | src/plugins/scripts/tcl/weechat-tcl-api.c | 14 | ||||
-rw-r--r-- | src/plugins/weechat-plugin.h | 2 |
12 files changed, 85 insertions, 96 deletions
diff --git a/src/core/wee-upgrade.c b/src/core/wee-upgrade.c index e01d4c83d..cf5c49345 100644 --- a/src/core/wee-upgrade.c +++ b/src/core/wee-upgrade.c @@ -280,7 +280,7 @@ int upgrade_weechat_read_cb (int object_id, struct t_infolist *infolist) { - const char *key, *var_name, *type, *name, *prefix, *group_name; + const char *key, *var_name, *type, *name, *group_name; char option_name[64], *option_key, *option_var; struct t_gui_nick_group *ptr_group; struct t_gui_buffer *ptr_buffer; @@ -482,13 +482,12 @@ upgrade_weechat_read_cb (int object_id, ptr_group = gui_nicklist_search_group (upgrade_current_buffer, NULL, group_name); - prefix = infolist_string (infolist, "prefix"); gui_nicklist_add_nick ( upgrade_current_buffer, ptr_group, infolist_string (infolist, "name"), infolist_string (infolist, "color"), - (prefix) ? prefix[0] : ' ', + infolist_string (infolist, "prefix"), infolist_string (infolist, "prefix_color"), infolist_integer (infolist, "visible")); } diff --git a/src/gui/gui-bar-item.c b/src/gui/gui-bar-item.c index 66ba2db3b..4892a2027 100644 --- a/src/gui/gui-bar-item.c +++ b/src/gui/gui-bar-item.c @@ -1108,7 +1108,7 @@ gui_bar_item_default_buffer_nicklist (void *data, struct t_gui_bar_item *item, struct t_gui_nick *ptr_nick; struct t_config_option *ptr_option; int i, length; - char *buf, str_prefix[2]; + char *buf; /* make C compiler happy */ (void) data; @@ -1176,9 +1176,8 @@ gui_bar_item_default_buffer_nicklist (void *data, struct t_gui_bar_item *item, { strcat (buf, gui_color_get_custom (ptr_nick->prefix_color)); } - str_prefix[0] = ptr_nick->prefix; - str_prefix[1] = '\0'; - strcat (buf, str_prefix); + if (ptr_nick->prefix) + strcat (buf, ptr_nick->prefix); if (strchr (ptr_nick->color, '.')) { config_file_search_with_string (ptr_nick->color, diff --git a/src/gui/gui-nicklist.c b/src/gui/gui-nicklist.c index a0065703d..c8df3ad00 100644 --- a/src/gui/gui-nicklist.c +++ b/src/gui/gui-nicklist.c @@ -304,8 +304,9 @@ gui_nicklist_search_nick (struct t_gui_buffer *buffer, struct t_gui_nick * gui_nicklist_add_nick (struct t_gui_buffer *buffer, - struct t_gui_nick_group *group, const char *name, - const char *color, char prefix, const char *prefix_color, + struct t_gui_nick_group *group, + const char *name, const char *color, + const char *prefix, const char *prefix_color, int visible) { struct t_gui_nick *new_nick; @@ -320,7 +321,7 @@ gui_nicklist_add_nick (struct t_gui_buffer *buffer, new_nick->group = (group) ? group : buffer->nicklist_root; new_nick->name = strdup (name); new_nick->color = (color) ? strdup (color) : NULL; - new_nick->prefix = prefix; + new_nick->prefix = (prefix) ? strdup (prefix) : NULL; new_nick->prefix_color = (prefix_color) ? strdup (prefix_color) : NULL; new_nick->visible = visible; @@ -360,6 +361,8 @@ gui_nicklist_remove_nick (struct t_gui_buffer *buffer, free (nick->name); if (nick->color) free (nick->color); + if (nick->prefix) + free (nick->prefix); if (nick->prefix_color) free (nick->prefix_color); @@ -619,7 +622,6 @@ gui_nicklist_add_to_infolist (struct t_infolist *infolist, struct t_infolist_item *ptr_item; struct t_gui_nick_group *ptr_group; struct t_gui_nick *ptr_nick; - char prefix[2]; if (!infolist || !buffer) return 0; @@ -646,9 +648,7 @@ gui_nicklist_add_to_infolist (struct t_infolist *infolist, return 0; if (!infolist_new_var_string (ptr_item, "color", ptr_nick->color)) return 0; - prefix[0] = ptr_nick->prefix; - prefix[1] = '\0'; - if (!infolist_new_var_string (ptr_item, "prefix", prefix)) + if (!infolist_new_var_string (ptr_item, "prefix", ptr_nick->prefix)) return 0; if (!infolist_new_var_string (ptr_item, "prefix_color", ptr_nick->prefix_color)) return 0; diff --git a/src/gui/gui-nicklist.h b/src/gui/gui-nicklist.h index 80fdb04f7..3d99a87c9 100644 --- a/src/gui/gui-nicklist.h +++ b/src/gui/gui-nicklist.h @@ -43,7 +43,7 @@ struct t_gui_nick struct t_gui_nick_group *group; /* group which contains nick */ char *name; /* nick name */ char *color; /* color for nick in nicklist */ - char prefix; /* prefix for nick (for admins, ..) */ + char *prefix; /* prefix for nick (for admins, ..) */ char *prefix_color; /* color for prefix */ int visible; /* 1 if nick is displayed */ struct t_gui_nick *prev_nick; /* link to previous nick */ @@ -57,15 +57,18 @@ extern struct t_gui_nick_group *gui_nicklist_search_group (struct t_gui_buffer * const char *name); extern struct t_gui_nick_group *gui_nicklist_add_group (struct t_gui_buffer *buffer, struct t_gui_nick_group *parent_group, - const char *name, const char *color, + const char *name, + const char *color, int visible); extern struct t_gui_nick *gui_nicklist_search_nick (struct t_gui_buffer *buffer, struct t_gui_nick_group *from_group, const char *name); extern struct t_gui_nick *gui_nicklist_add_nick (struct t_gui_buffer *buffer, struct t_gui_nick_group *group, - const char *name, const char *color, - char prefix, const char *prefix_color, + const char *name, + const char *color, + const char *prefix, + const char *prefix_color, int visible); extern void gui_nicklist_remove_group (struct t_gui_buffer *buffer, struct t_gui_nick_group *group); diff --git a/src/plugins/irc/irc-nick.c b/src/plugins/irc/irc-nick.c index 0e6ee32ec..c87c7fd3a 100644 --- a/src/plugins/irc/irc-nick.c +++ b/src/plugins/irc/irc-nick.c @@ -94,7 +94,7 @@ irc_nick_get_gui_infos (struct t_irc_nick *nick, if (nick->flags & IRC_NICK_CHANOWNER) { if (prefix) - *prefix = '~'; + prefix[0] = '~'; if (prefix_color) *prefix_color = 1; if (buffer && group) @@ -104,7 +104,7 @@ irc_nick_get_gui_infos (struct t_irc_nick *nick, else if (nick->flags & IRC_NICK_CHANADMIN) { if (prefix) - *prefix = '&'; + prefix[0] = '&'; if (prefix_color) *prefix_color = 1; if (buffer && group) @@ -114,7 +114,7 @@ irc_nick_get_gui_infos (struct t_irc_nick *nick, else if (nick->flags & IRC_NICK_CHANADMIN2) { if (prefix) - *prefix = '!'; + prefix[0] = '!'; if (prefix_color) *prefix_color = 1; if (buffer && group) @@ -124,7 +124,7 @@ irc_nick_get_gui_infos (struct t_irc_nick *nick, else if (nick->flags & IRC_NICK_OP) { if (prefix) - *prefix = '@'; + prefix[0] = '@'; if (prefix_color) *prefix_color = 1; if (buffer && group) @@ -134,7 +134,7 @@ irc_nick_get_gui_infos (struct t_irc_nick *nick, else if (nick->flags & IRC_NICK_HALFOP) { if (prefix) - *prefix = '%'; + prefix[0] = '%'; if (prefix_color) *prefix_color = 2; if (buffer && group) @@ -144,7 +144,7 @@ irc_nick_get_gui_infos (struct t_irc_nick *nick, else if (nick->flags & IRC_NICK_VOICE) { if (prefix) - *prefix = '+'; + prefix[0] = '+'; if (prefix_color) *prefix_color = 3; if (buffer && group) @@ -154,7 +154,7 @@ irc_nick_get_gui_infos (struct t_irc_nick *nick, else if (nick->flags & IRC_NICK_CHANUSER) { if (prefix) - *prefix = '-'; + prefix[0] = '-'; if (prefix_color) *prefix_color = 4; if (buffer && group) @@ -164,7 +164,7 @@ irc_nick_get_gui_infos (struct t_irc_nick *nick, else { if (prefix) - *prefix = ' '; + prefix[0] = ' '; if (prefix_color) *prefix_color = 0; if (buffer && group) @@ -184,7 +184,7 @@ irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel, int is_chanuser, int is_away) { struct t_irc_nick *new_nick, *ptr_nick; - char prefix, str_prefix_color[64]; + char prefix[2], str_prefix_color[64]; int prefix_color; struct t_gui_nick_group *ptr_group; @@ -193,7 +193,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 (ptr_nick, prefix, &prefix_color, channel->buffer, &ptr_group); weechat_nicklist_remove_nick (channel->buffer, weechat_nicklist_search_nick (channel->buffer, @@ -211,7 +211,9 @@ irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel, IRC_NICK_SET_FLAG(ptr_nick, is_away, IRC_NICK_AWAY); /* add new nick in nicklist */ - irc_nick_get_gui_infos (ptr_nick, &prefix, + prefix[0] = ' '; + prefix[1] = '\0'; + irc_nick_get_gui_infos (ptr_nick, prefix, &prefix_color, channel->buffer, &ptr_group); snprintf (str_prefix_color, sizeof (str_prefix_color), "weechat.color.nicklist_prefix%d", @@ -260,7 +262,9 @@ irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel, channel->nick_completion_reset = 1; /* add nick to buffer nicklist */ - irc_nick_get_gui_infos (new_nick, &prefix, &prefix_color, + prefix[0] = ' '; + prefix[1] = '\0'; + irc_nick_get_gui_infos (new_nick, prefix, &prefix_color, channel->buffer, &ptr_group); snprintf (str_prefix_color, sizeof (str_prefix_color), "weechat.color.nicklist_prefix%d", @@ -285,10 +289,10 @@ irc_nick_change (struct t_irc_server *server, struct t_irc_channel *channel, { int nick_is_me, prefix_color; struct t_gui_nick_group *ptr_group; - char prefix, str_prefix_color[64]; + 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 (nick, prefix, &prefix_color, channel->buffer, &ptr_group); weechat_nicklist_remove_nick (channel->buffer, weechat_nicklist_search_nick (channel->buffer, @@ -310,7 +314,9 @@ irc_nick_change (struct t_irc_server *server, struct t_irc_channel *channel, nick->color = irc_nick_find_color (nick); /* add nick in nicklist */ - irc_nick_get_gui_infos (nick, &prefix, &prefix_color, + prefix[0] = ' '; + prefix[1] = '\0'; + irc_nick_get_gui_infos (nick, prefix, &prefix_color, channel->buffer, &ptr_group); snprintf (str_prefix_color, sizeof (str_prefix_color), "weechat.color.nicklist_prefix%d", @@ -328,12 +334,12 @@ void irc_nick_set (struct t_irc_channel *channel, struct t_irc_nick *nick, int set, int flag) { - char prefix, str_prefix_color[64]; + char prefix[2], str_prefix_color[64]; int prefix_color; 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 (nick, prefix, &prefix_color, channel->buffer, &ptr_group); weechat_nicklist_remove_nick (channel->buffer, weechat_nicklist_search_nick (channel->buffer, @@ -344,7 +350,9 @@ irc_nick_set (struct t_irc_channel *channel, IRC_NICK_SET_FLAG(nick, set, flag); /* add nick in nicklist */ - irc_nick_get_gui_infos (nick, &prefix, &prefix_color, + prefix[0] = ' '; + prefix[1] = '\0'; + irc_nick_get_gui_infos (nick, prefix, &prefix_color, channel->buffer, &ptr_group); snprintf (str_prefix_color, sizeof (str_prefix_color), "weechat.color.nicklist_prefix%d", diff --git a/src/plugins/jabber/jabber-buddy.c b/src/plugins/jabber/jabber-buddy.c index 7d2adfebe..c9b8820de 100644 --- a/src/plugins/jabber/jabber-buddy.c +++ b/src/plugins/jabber/jabber-buddy.c @@ -106,7 +106,7 @@ jabber_buddy_get_gui_infos (struct t_jabber_buddy *buddy, if (buddy->flags & JABBER_BUDDY_CHANOWNER) { if (prefix) - *prefix = '~'; + prefix[0] = '~'; if (prefix_color) *prefix_color = 1; if (buffer && group) @@ -116,7 +116,7 @@ jabber_buddy_get_gui_infos (struct t_jabber_buddy *buddy, else if (buddy->flags & JABBER_BUDDY_CHANADMIN) { if (prefix) - *prefix = '&'; + prefix[0] = '&'; if (prefix_color) *prefix_color = 1; if (buffer && group) @@ -126,7 +126,7 @@ jabber_buddy_get_gui_infos (struct t_jabber_buddy *buddy, else if (buddy->flags & JABBER_BUDDY_CHANADMIN2) { if (prefix) - *prefix = '!'; + prefix[0] = '!'; if (prefix_color) *prefix_color = 1; if (buffer && group) @@ -136,7 +136,7 @@ jabber_buddy_get_gui_infos (struct t_jabber_buddy *buddy, else if (buddy->flags & JABBER_BUDDY_OP) { if (prefix) - *prefix = '@'; + prefix[0] = '@'; if (prefix_color) *prefix_color = 1; if (buffer && group) @@ -146,7 +146,7 @@ jabber_buddy_get_gui_infos (struct t_jabber_buddy *buddy, else if (buddy->flags & JABBER_BUDDY_HALFOP) { if (prefix) - *prefix = '%'; + prefix[0] = '%'; if (prefix_color) *prefix_color = 2; if (buffer && group) @@ -156,7 +156,7 @@ jabber_buddy_get_gui_infos (struct t_jabber_buddy *buddy, else if (buddy->flags & JABBER_BUDDY_VOICE) { if (prefix) - *prefix = '+'; + prefix[0] = '+'; if (prefix_color) *prefix_color = 3; if (buffer && group) @@ -166,7 +166,7 @@ jabber_buddy_get_gui_infos (struct t_jabber_buddy *buddy, else if (buddy->flags & JABBER_BUDDY_CHANUSER) { if (prefix) - *prefix = '-'; + prefix[0] = '-'; if (prefix_color) *prefix_color = 4; if (buffer && group) @@ -176,7 +176,7 @@ jabber_buddy_get_gui_infos (struct t_jabber_buddy *buddy, else { if (prefix) - *prefix = ' '; + prefix[0] = ' '; if (prefix_color) *prefix_color = 0; if (buffer && group) @@ -196,7 +196,7 @@ jabber_buddy_new (struct t_jabber_server *server, struct t_jabber_muc *muc, int is_chanuser, int is_away) { struct t_jabber_buddy *new_buddy, *ptr_buddy; - char prefix, str_prefix_color[64]; + char prefix[2], str_prefix_color[64]; const char *local_name; int prefix_color; struct t_gui_buffer *ptr_buffer; @@ -212,7 +212,7 @@ jabber_buddy_new (struct t_jabber_server *server, struct t_jabber_muc *muc, if (ptr_buddy) { /* remove old buddy from buddylist */ - jabber_buddy_get_gui_infos (ptr_buddy, &prefix, + jabber_buddy_get_gui_infos (ptr_buddy, prefix, &prefix_color, ptr_buffer, &ptr_group); weechat_nicklist_remove_nick (ptr_buffer, weechat_nicklist_search_nick (ptr_buffer, @@ -230,7 +230,9 @@ jabber_buddy_new (struct t_jabber_server *server, struct t_jabber_muc *muc, JABBER_BUDDY_SET_FLAG(ptr_buddy, is_away, JABBER_BUDDY_AWAY); /* add new buddy in buddylist */ - jabber_buddy_get_gui_infos (ptr_buddy, &prefix, + prefix[0] = ' '; + prefix[1] = '\0'; + jabber_buddy_get_gui_infos (ptr_buddy, prefix, &prefix_color, ptr_buffer, &ptr_group); snprintf (str_prefix_color, sizeof (str_prefix_color), "weechat.color.nicklist_prefix%d", @@ -295,7 +297,9 @@ jabber_buddy_new (struct t_jabber_server *server, struct t_jabber_muc *muc, } /* add buddy to buffer buddylist */ - jabber_buddy_get_gui_infos (new_buddy, &prefix, &prefix_color, + prefix[0] = ' '; + prefix[1] = '\0'; + jabber_buddy_get_gui_infos (new_buddy, prefix, &prefix_color, ptr_buffer, &ptr_group); snprintf (str_prefix_color, sizeof (str_prefix_color), "weechat.color.nicklist_prefix%d", @@ -321,13 +325,13 @@ jabber_buddy_change (struct t_jabber_server *server, struct t_jabber_muc *muc, int buddy_is_me, prefix_color; struct t_gui_buffer *ptr_buffer; struct t_gui_nick_group *ptr_group; - char prefix, str_prefix_color[64]; + char prefix[2], str_prefix_color[64]; const char *local_name; ptr_buffer = (muc) ? muc->buffer : server->buffer; /* remove buddy from buddylist */ - jabber_buddy_get_gui_infos (buddy, &prefix, &prefix_color, + jabber_buddy_get_gui_infos (buddy, prefix, &prefix_color, ptr_buffer, &ptr_group); weechat_nicklist_remove_nick (ptr_buffer, weechat_nicklist_search_nick (ptr_buffer, @@ -350,7 +354,9 @@ jabber_buddy_change (struct t_jabber_server *server, struct t_jabber_muc *muc, buddy->color = jabber_buddy_find_color (buddy); /* add buddy in buddylist */ - jabber_buddy_get_gui_infos (buddy, &prefix, &prefix_color, + prefix[0] = ' '; + prefix[1] = '\0'; + jabber_buddy_get_gui_infos (buddy, prefix, &prefix_color, ptr_buffer, &ptr_group); snprintf (str_prefix_color, sizeof (str_prefix_color), "weechat.color.nicklist_prefix%d", @@ -370,7 +376,7 @@ jabber_buddy_set (struct t_jabber_server *server, struct t_jabber_muc *muc, { struct t_gui_buffer *ptr_buffer; struct t_gui_nick_group *ptr_group; - char prefix, str_prefix_color[64]; + char prefix[2], str_prefix_color[64]; int prefix_color; if (server || muc) @@ -378,7 +384,7 @@ jabber_buddy_set (struct t_jabber_server *server, struct t_jabber_muc *muc, ptr_buffer = (muc) ? muc->buffer : server->buffer; /* remove buddy from buddylist */ - jabber_buddy_get_gui_infos (buddy, &prefix, &prefix_color, + jabber_buddy_get_gui_infos (buddy, prefix, &prefix_color, ptr_buffer, &ptr_group); weechat_nicklist_remove_nick (ptr_buffer, weechat_nicklist_search_nick (ptr_buffer, @@ -389,7 +395,9 @@ jabber_buddy_set (struct t_jabber_server *server, struct t_jabber_muc *muc, JABBER_BUDDY_SET_FLAG(buddy, set, flag); /* add buddy in buddylist */ - jabber_buddy_get_gui_infos (buddy, &prefix, &prefix_color, + prefix[0] = ' '; + prefix[1] = '\0'; + jabber_buddy_get_gui_infos (buddy, prefix, &prefix_color, ptr_buffer, &ptr_group); snprintf (str_prefix_color, sizeof (str_prefix_color), "weechat.color.nicklist_prefix%d", diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c index dac75ab02..88733610c 100644 --- a/src/plugins/scripts/lua/weechat-lua-api.c +++ b/src/plugins/scripts/lua/weechat-lua-api.c @@ -4542,7 +4542,7 @@ static int weechat_lua_api_nicklist_add_nick (lua_State *L) { const char *buffer, *group, *name, *color, *prefix, *prefix_color; - char char_prefix, *result; + char *result; int n, visible; /* make C compiler happy */ @@ -4578,16 +4578,11 @@ weechat_lua_api_nicklist_add_nick (lua_State *L) prefix_color = lua_tostring (lua_current_interpreter, -2); visible = lua_tonumber (lua_current_interpreter, -1); - if (prefix && prefix[0]) - char_prefix = prefix[0]; - else - char_prefix = ' '; - result = script_ptr2str (weechat_nicklist_add_nick (script_str2ptr (buffer), script_str2ptr (group), name, color, - char_prefix, + prefix, prefix_color, visible)); diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c index 348ca0d8c..6967c6dcf 100644 --- a/src/plugins/scripts/perl/weechat-perl-api.c +++ b/src/plugins/scripts/perl/weechat-perl-api.c @@ -3828,8 +3828,7 @@ static XS (XS_weechat_api_nicklist_search_group) static XS (XS_weechat_api_nicklist_add_nick) { - char *prefix, char_prefix, *result, *buffer, *group, *name, *color; - char *prefix_color; + char *result, *buffer, *group, *name, *color, *prefix, *prefix_color; dXSARGS; /* make C compiler happy */ @@ -3847,22 +3846,17 @@ static XS (XS_weechat_api_nicklist_add_nick) PERL_RETURN_EMPTY; } - prefix = SvPV(ST (4), PL_na); - if (prefix && prefix[0]) - char_prefix = prefix[0]; - else - char_prefix = ' '; - buffer = SvPV (ST (0), PL_na); group = SvPV (ST (1), PL_na); name = SvPV (ST (2), PL_na); color = SvPV (ST (3), PL_na); + prefix = SvPV(ST (4), PL_na); prefix_color = SvPV (ST (5), PL_na); result = script_ptr2str (weechat_nicklist_add_nick (script_str2ptr (buffer), script_str2ptr (group), name, color, - char_prefix, + prefix, prefix_color, SvIV (ST (6)))); /* visible */ diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c index 95807c41a..fe77270b4 100644 --- a/src/plugins/scripts/python/weechat-python-api.c +++ b/src/plugins/scripts/python/weechat-python-api.c @@ -4063,7 +4063,6 @@ static PyObject * weechat_python_api_nicklist_add_nick (PyObject *self, PyObject *args) { char *buffer, *group, *name, *color, *prefix, *prefix_color, *result; - char char_prefix; int visible; PyObject *object; @@ -4091,16 +4090,11 @@ weechat_python_api_nicklist_add_nick (PyObject *self, PyObject *args) PYTHON_RETURN_EMPTY; } - if (prefix && prefix[0]) - char_prefix = prefix[0]; - else - char_prefix = ' '; - result = script_ptr2str (weechat_nicklist_add_nick (script_str2ptr (buffer), script_str2ptr (group), name, color, - char_prefix, + prefix, prefix_color, visible)); diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c index 3bd217fa3..1e34f9743 100644 --- a/src/plugins/scripts/ruby/weechat-ruby-api.c +++ b/src/plugins/scripts/ruby/weechat-ruby-api.c @@ -4641,8 +4641,8 @@ weechat_ruby_api_nicklist_add_nick (VALUE class, VALUE buffer, VALUE group, VALUE name, VALUE color, VALUE prefix, VALUE prefix_color, VALUE visible) { - char *c_buffer, *c_group, *c_name, *c_color, *c_prefix, char_prefix; - char *c_prefix_color, *result; + char *c_buffer, *c_group, *c_name, *c_color, *c_prefix, *c_prefix_color; + char *result; int c_visible; VALUE return_value; @@ -4686,16 +4686,11 @@ weechat_ruby_api_nicklist_add_nick (VALUE class, VALUE buffer, VALUE group, c_prefix_color = STR2CSTR (prefix_color); c_visible = FIX2INT (visible); - if (c_prefix && c_prefix[0]) - char_prefix = c_prefix[0]; - else - char_prefix = ' '; - result = script_ptr2str (weechat_nicklist_add_nick (script_str2ptr (c_buffer), script_str2ptr (c_group), c_name, c_color, - char_prefix, + c_prefix, c_prefix_color, c_visible)); diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c index 1a778426f..27be56cef 100644 --- a/src/plugins/scripts/tcl/weechat-tcl-api.c +++ b/src/plugins/scripts/tcl/weechat-tcl-api.c @@ -4336,9 +4336,8 @@ weechat_tcl_api_nicklist_add_nick (ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { Tcl_Obj *objp; - char *prefix, char_prefix, *result, *buffer, *group, *name, *color; - char *prefix_color; - int i,visible; + char *prefix, *result, *buffer, *group, *name, *color, *prefix_color; + int i, visible; /* make C compiler happy */ (void) clientData; @@ -4355,12 +4354,6 @@ weechat_tcl_api_nicklist_add_nick (ClientData clientData, Tcl_Interp *interp, TCL_RETURN_EMPTY; } - prefix = Tcl_GetStringFromObj (objv[5], &i); - if (prefix && prefix[0]) - char_prefix = prefix[0]; - else - char_prefix = ' '; - if (Tcl_GetIntFromObj (interp, objv[7], &visible) != TCL_OK) { WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("nicklist_add_nick"); @@ -4371,12 +4364,13 @@ weechat_tcl_api_nicklist_add_nick (ClientData clientData, Tcl_Interp *interp, group = Tcl_GetStringFromObj (objv[2], &i); name = Tcl_GetStringFromObj (objv[3], &i); color = Tcl_GetStringFromObj (objv[4], &i); + prefix = Tcl_GetStringFromObj (objv[5], &i); prefix_color = Tcl_GetStringFromObj (objv[6], &i); result = script_ptr2str (weechat_nicklist_add_nick (script_str2ptr (buffer), script_str2ptr (group), name, color, - char_prefix, + prefix, prefix_color, visible)); /* visible */ diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index d84f8457f..d52c520ed 100644 --- a/src/plugins/weechat-plugin.h +++ b/src/plugins/weechat-plugin.h @@ -495,7 +495,7 @@ struct t_weechat_plugin struct t_gui_nick_group *group, const char *name, const char *color, - char prefix, + const char *prefix, const char *prefix_color, int visible); struct t_gui_nick *(*nicklist_search_nick) (struct t_gui_buffer *buffer, |