mirror of
https://github.com/irssi/irssi.git
synced 2026-08-22 18:12:12 +02:00
Collapse the list of nicks when possible.
When a single user changes the mode to a bunch of different users we don't really have to print out the nick every time.
This commit is contained in:
parent
fb78787d4e
commit
102659f3f4
3 changed files with 23 additions and 1 deletions
|
|
@ -261,6 +261,23 @@ char *gslist_to_string(GSList *list, const char *delimiter)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean gslist_is_unique(GSList *list, GCompareFunc func)
|
||||||
|
{
|
||||||
|
const char *prev;
|
||||||
|
|
||||||
|
if (list == NULL)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
prev = (const char *)list->data;
|
||||||
|
|
||||||
|
for (list = list->next; list != NULL; list = list->next) {
|
||||||
|
if (func(list->data, prev) != 0)
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
void hash_save_key(char *key, void *value, GSList **list)
|
void hash_save_key(char *key, void *value, GSList **list)
|
||||||
{
|
{
|
||||||
*list = g_slist_append(*list, key);
|
*list = g_slist_append(*list, key);
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,8 @@ void *gslist_foreach_find(GSList *list, FOREACH_FIND_FUNC func, const void *data
|
||||||
char *gslistptr_to_string(GSList *list, int offset, const char *delimiter);
|
char *gslistptr_to_string(GSList *list, int offset, const char *delimiter);
|
||||||
/* `list' contains char* */
|
/* `list' contains char* */
|
||||||
char *gslist_to_string(GSList *list, const char *delimiter);
|
char *gslist_to_string(GSList *list, const char *delimiter);
|
||||||
|
/* 'list' elements are all the same */
|
||||||
|
gboolean gslist_is_unique(GSList *list, GCompareFunc func);
|
||||||
|
|
||||||
GList *optlist_remove_known(const char *cmd, GHashTable *optlist);
|
GList *optlist_remove_known(const char *cmd, GHashTable *optlist);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,9 @@ static void print_mode(MODE_REC *rec)
|
||||||
|
|
||||||
tmp = modes; modes = NULL;
|
tmp = modes; modes = NULL;
|
||||||
|
|
||||||
|
if (gslist_is_unique(rec->nicks, (GCompareFunc)g_strcmp0))
|
||||||
|
nicks = g_strdup(rec->nicks->data);
|
||||||
|
else
|
||||||
nicks = gslist_to_string(rec->nicks, ", ");
|
nicks = gslist_to_string(rec->nicks, ", ");
|
||||||
printformat(rec->channel->server, rec->channel->visible_name,
|
printformat(rec->channel->server, rec->channel->visible_name,
|
||||||
MSGLEVEL_MODES, IRCTXT_CHANMODE_CHANGE,
|
MSGLEVEL_MODES, IRCTXT_CHANMODE_CHANGE,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue