comparison mcabber/src/commands.c @ 867:7f056c566569

Commands /alias & /bind list the key bindings and aliases
author Mikael Berthe <mikael@lilotux.net>
date Wed, 24 May 2006 23:30:31 +0200
parents b30df2ab457f
children cefdaeb42e67
comparison
equal deleted inserted replaced
866:b30df2ab457f 867:7f056c566569
1298 g_free(value_utf8); 1298 g_free(value_utf8);
1299 } 1299 }
1300 g_free(option_utf8); 1300 g_free(option_utf8);
1301 } 1301 }
1302 1302
1303 static void dump_alias(void *param, char *k, char *v)
1304 {
1305 scr_LogPrint(LPRINT_NORMAL|LPRINT_NOTUTF8, "Alias %s = %s", k, v);
1306 }
1307
1303 static void do_alias(char *arg) 1308 static void do_alias(char *arg)
1304 { 1309 {
1305 guint assign; 1310 guint assign;
1306 const gchar *alias, *value; 1311 const gchar *alias, *value;
1307 1312
1308 assign = parse_assigment(arg, &alias, &value); 1313 assign = parse_assigment(arg, &alias, &value);
1309 if (!alias) { 1314 if (!alias) {
1310 scr_LogPrint(LPRINT_NORMAL, "Alias what?"); 1315 settings_foreach(SETTINGS_TYPE_ALIAS, &dump_alias, NULL);
1311 return; 1316 return;
1312 } 1317 }
1313 if (!assign) { 1318 if (!assign) {
1314 // This is a query 1319 // This is a query
1315 value = settings_get(SETTINGS_TYPE_ALIAS, alias); 1320 value = settings_get(SETTINGS_TYPE_ALIAS, alias);
1344 compl_add_category_word(COMPL_CMD, alias); 1349 compl_add_category_word(COMPL_CMD, alias);
1345 settings_set(SETTINGS_TYPE_ALIAS, alias, value); 1350 settings_set(SETTINGS_TYPE_ALIAS, alias, value);
1346 } 1351 }
1347 } 1352 }
1348 1353
1354 static void dump_bind(void *param, char *k, char *v)
1355 {
1356 scr_LogPrint(LPRINT_NORMAL, "Key %4s is bound to: %s", k, v);
1357 }
1358
1349 static void do_bind(char *arg) 1359 static void do_bind(char *arg)
1350 { 1360 {
1351 guint assign; 1361 guint assign;
1352 const gchar *keycode, *value; 1362 const gchar *keycode, *value;
1353 1363
1354 assign = parse_assigment(arg, &keycode, &value); 1364 assign = parse_assigment(arg, &keycode, &value);
1355 if (!keycode) { 1365 if (!keycode) {
1356 scr_LogPrint(LPRINT_NORMAL, "Bind what keycode?"); 1366 settings_foreach(SETTINGS_TYPE_BINDING, &dump_bind, NULL);
1357 return; 1367 return;
1358 } 1368 }
1359 if (!assign) { 1369 if (!assign) {
1360 // This is a query 1370 // This is a query
1361 value = settings_get(SETTINGS_TYPE_BINDING, keycode); 1371 value = settings_get(SETTINGS_TYPE_BINDING, keycode);