summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2006-08-30 21:37:13 +0000
committerSebastien Helleu <flashcode@flashtux.org>2006-08-30 21:37:13 +0000
commit7c51a794606d8ba0e92c47f1e1080f05bc35a3bb (patch)
tree13be09a200c4543f835cf1840a2a4abae43c882a /src/common
parent09b73be53ab3ee9b27a36281230d7b7a53c172b6 (diff)
downloadweechat-7c51a794606d8ba0e92c47f1e1080f05bc35a3bb.zip
Command /key now ok with one arg (key name): display key if found
Diffstat (limited to 'src/common')
-rw-r--r--src/common/command.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/common/command.c b/src/common/command.c
index 7e109784a..4850904b7 100644
--- a/src/common/command.c
+++ b/src/common/command.c
@@ -125,8 +125,8 @@ t_weechat_command weechat_commands[] =
"*|%n *|action|ctcp|dcc|pv|%I *|%c *|%s",
0, 4, 0, weechat_cmd_ignore, NULL },
{ "key", N_("bind/unbind keys"),
- N_("[key function/command] [unbind key] [functions] [reset -yes]"),
- N_(" key: bind this key to an internal function or a command "
+ N_("[key [function/command]] [unbind key] [functions] [reset -yes]"),
+ N_(" key: display or bind this key to an internal function or a command "
"(beginning by \"/\")\n"
" unbind: unbind a key\n"
"functions: list internal functions for key bindings\n"
@@ -2267,7 +2267,7 @@ int
weechat_cmd_key (t_irc_server *server, t_irc_channel *channel,
char *arguments)
{
- char *pos;
+ char *pos, *internal_code;
int i;
t_gui_key *ptr_key;
@@ -2350,11 +2350,24 @@ weechat_cmd_key (t_irc_server *server, t_irc_channel *channel,
pos = strchr (arguments, ' ');
if (!pos)
{
- irc_display_prefix (NULL, NULL, PREFIX_ERROR);
- gui_printf (NULL,
- _("%s wrong argument count for \"%s\" command\n"),
- WEECHAT_ERROR, "key");
- return -1;
+ ptr_key = NULL;
+ internal_code = gui_keyboard_get_internal_code (arguments);
+ if (internal_code)
+ ptr_key = gui_keyboard_search (internal_code);
+ if (ptr_key)
+ {
+ gui_printf (NULL, "\n");
+ gui_printf (NULL, _("Key:\n"));
+ weechat_cmd_key_display (ptr_key, 0);
+ }
+ else
+ {
+ irc_display_prefix (NULL, NULL, PREFIX_INFO);
+ gui_printf (NULL, _("No key found.\n"));
+ }
+ if (internal_code)
+ free (internal_code);
+ return 0;
}
pos[0] = '\0';
pos++;