mirror of
https://github.com/weechat/weechat.git
synced 2026-06-27 13:26:38 +02:00
Use string instead of char for prefixes in nicklist
This commit is contained in:
@@ -7796,7 +7796,7 @@ struct t_gui_nick_group *weechat_nicklist_add_nick (
|
||||
struct t_gui_nick_group *group,
|
||||
const char *name,
|
||||
const char *color,
|
||||
char prefix,
|
||||
const char *prefix,
|
||||
const char *prefix_color,
|
||||
int visible);
|
||||
</programlisting>
|
||||
@@ -7860,7 +7860,7 @@ struct t_gui_nick *my_nick =
|
||||
weechat_nicklist_add_nick (my_buffer, my_group,
|
||||
"test_nick",
|
||||
(nick_away) ? "weechat.color.nicklist_away" : "bar_fg",
|
||||
'@', "lightgreen",
|
||||
"@", "lightgreen",
|
||||
1);
|
||||
</screen>
|
||||
</para>
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
+26
-18
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user