mirror of
https://github.com/weechat/weechat.git
synced 2026-07-05 09:13:14 +02:00
Use string instead of char for prefixes in nicklist
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user