summaryrefslogtreecommitdiff
path: root/src/fe-common
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-06-18 10:25:39 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-06-18 10:25:39 +0000
commit49c4506bd81c741f586d9530ba6dd3e27f5804f4 (patch)
tree7ef8df9931b0b20f4c2b6c0aaa694994c8b20fe7 /src/fe-common
parentaca24d17958b73a4299f84d96b2816d6896a1c69 (diff)
downloadirssi-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.c17
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);
}