diff options
author | Timo Sirainen <cras@irssi.org> | 2000-06-18 10:25:39 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-06-18 10:25:39 +0000 |
commit | 49c4506bd81c741f586d9530ba6dd3e27f5804f4 (patch) | |
tree | 7ef8df9931b0b20f4c2b6c0aaa694994c8b20fe7 /src/fe-common | |
parent | aca24d17958b73a4299f84d96b2816d6896a1c69 (diff) | |
download | irssi-49c4506bd81c741f586d9530ba6dd3e27f5804f4.zip |
Display /ALIAS list sorted.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@369 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common')
-rw-r--r-- | src/fe-common/core/fe-settings.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/fe-common/core/fe-settings.c b/src/fe-common/core/fe-settings.c index 299f437e..5b88454c 100644 --- a/src/fe-common/core/fe-settings.c +++ b/src/fe-common/core/fe-settings.c @@ -137,10 +137,15 @@ static void cmd_toggle(const char *data) cmd_params_free(free_arg); } +static int config_key_compare(CONFIG_NODE *node1, CONFIG_NODE *node2) +{ + return g_strcasecmp(node1->key, node2->key); +} + static void show_aliases(const char *alias) { CONFIG_NODE *node; - GSList *tmp; + GSList *tmp, *list; int aliaslen; printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, IRCTXT_ALIASLIST_HEADER); @@ -148,6 +153,8 @@ static void show_aliases(const char *alias) node = iconfig_node_traverse("aliases", FALSE); tmp = node == NULL ? NULL : node->value; + /* first get the list of aliases sorted */ + list = NULL; aliaslen = strlen(alias); for (; tmp != NULL; tmp = tmp->next) { CONFIG_NODE *node = tmp->data; @@ -158,9 +165,17 @@ static void show_aliases(const char *alias) if (aliaslen != 0 && g_strncasecmp(node->key, alias, aliaslen) != 0) continue; + list = g_slist_insert_sorted(list, node, (GCompareFunc) config_key_compare); + } + + /* print the aliases */ + for (tmp = list; tmp != NULL; tmp = tmp->next) { + CONFIG_NODE *node = tmp->data; + printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, IRCTXT_ALIASLIST_LINE, node->key, node->value); } + g_slist_free(list); printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, IRCTXT_ALIASLIST_FOOTER); } |