summaryrefslogtreecommitdiff
path: root/src/plugins/alias
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2008-07-03 17:11:48 +0200
committerSebastien Helleu <flashcode@flashtux.org>2008-07-03 17:11:48 +0200
commita34e9557cc1febf1ad924bea7aee72ebf7f23343 (patch)
treeaa7ae487f30d9178bdf829ca3a37625746db9d37 /src/plugins/alias
parent44f57d35bcd6178a2d3db3b09921bd15359185b9 (diff)
downloadweechat-a34e9557cc1febf1ad924bea7aee72ebf7f23343.zip
Fix bug with alias arguments ($1,$2,..) and add new default alias /wii (whois $1 $1)
Diffstat (limited to 'src/plugins/alias')
-rw-r--r--src/plugins/alias/alias.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/plugins/alias/alias.c b/src/plugins/alias/alias.c
index 2625eea96..cd2f13f1b 100644
--- a/src/plugins/alias/alias.c
+++ b/src/plugins/alias/alias.c
@@ -133,11 +133,14 @@ alias_replace_args (const char *alias_args, const char *user_args)
if (pos[1] == '*')
{
args_count++;
- word = weechat_strndup (start, pos - start);
- if (word)
+ if (pos > start)
{
- alias_add_word (&res, &length_res, word);
- free (word);
+ word = weechat_strndup (start, pos - start);
+ if (word)
+ {
+ alias_add_word (&res, &length_res, word);
+ free (word);
+ }
}
alias_add_word (&res, &length_res, user_args);
start = pos + 2;
@@ -148,13 +151,16 @@ alias_replace_args (const char *alias_args, const char *user_args)
if ((pos[1] >= '1') && (pos[1] <= '9'))
{
args_count++;
- word = weechat_strndup (start, pos - start);
- if (word)
+ if (pos > start)
{
- alias_add_word (&res, &length_res, start);
- free (word);
+ word = weechat_strndup (start, pos - start);
+ if (word)
+ {
+ alias_add_word (&res, &length_res, word);
+ free (word);
+ }
}
- if (pos[1] - '0' <= argc)
+ if (pos[1] - '1' < argc)
alias_add_word (&res, &length_res, argv[pos[1] - '1']);
start = pos + 2;
pos = start;
@@ -565,6 +571,7 @@ alias_config_write_default (void *data,
weechat_config_write_line (config_file, "W", "%s", "\"who\"");
weechat_config_write_line (config_file, "WC", "%s", "\"window merge\"");
weechat_config_write_line (config_file, "WI", "%s", "\"whois\"");
+ weechat_config_write_line (config_file, "WII", "%s", "\"whois $1 $1\"");
weechat_config_write_line (config_file, "WW", "%s", "\"whowas\"");
}