From cc324abb758facdf8d29c3828030c7796027a9a4 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Thu, 30 Mar 2006 17:08:23 +0000 Subject: [PATCH] Fixed bug with /alias and /unalias commands when alias begins with '/' --- src/common/command.c | 12 +++++++++++- weechat/src/common/command.c | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/common/command.c b/src/common/command.c index ffe2f4eb7..f5d6bc1c3 100644 --- a/src/common/command.c +++ b/src/common/command.c @@ -341,8 +341,10 @@ alias_new (char *alias_name, char *alias_command) { t_weechat_alias *new_alias, *ptr_alias; - if (alias_name[0] == '/') + while (alias_name[0] == '/') + { alias_name++; + } if (ascii_strcasecmp (alias_name, "builtin") == 0) return NULL; @@ -1105,6 +1107,11 @@ weechat_cmd_alias (t_irc_server *server, t_irc_channel *channel, if (arguments && arguments[0]) { + while (arguments[0] == '/') + { + arguments++; + } + /* Define new alias */ pos = strchr (arguments, ' '); if (pos) @@ -3525,6 +3532,9 @@ weechat_cmd_unalias (t_irc_server *server, t_irc_channel *channel, (void) server; (void) channel; + if (arguments[0] == '/') + arguments++; + ptr_weelist = weelist_search (index_commands, arguments); if (!ptr_weelist) { diff --git a/weechat/src/common/command.c b/weechat/src/common/command.c index ffe2f4eb7..f5d6bc1c3 100644 --- a/weechat/src/common/command.c +++ b/weechat/src/common/command.c @@ -341,8 +341,10 @@ alias_new (char *alias_name, char *alias_command) { t_weechat_alias *new_alias, *ptr_alias; - if (alias_name[0] == '/') + while (alias_name[0] == '/') + { alias_name++; + } if (ascii_strcasecmp (alias_name, "builtin") == 0) return NULL; @@ -1105,6 +1107,11 @@ weechat_cmd_alias (t_irc_server *server, t_irc_channel *channel, if (arguments && arguments[0]) { + while (arguments[0] == '/') + { + arguments++; + } + /* Define new alias */ pos = strchr (arguments, ' '); if (pos) @@ -3525,6 +3532,9 @@ weechat_cmd_unalias (t_irc_server *server, t_irc_channel *channel, (void) server; (void) channel; + if (arguments[0] == '/') + arguments++; + ptr_weelist = weelist_search (index_commands, arguments); if (!ptr_weelist) {