diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2012-06-04 10:06:46 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2012-06-04 10:06:46 +0200 |
commit | 231ee3fa3dfaf0e533757af9c7d670a83a67eda4 (patch) | |
tree | 00194e2d04840dc1cd3aa1e909e708f738239b37 /src | |
parent | c681c660c6afefbf14c65907caedfe1ba887709f (diff) | |
download | weechat-231ee3fa3dfaf0e533757af9c7d670a83a67eda4.zip |
rmodifier: prohibit names beginning with "#" for rmodifiers
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/rmodifier/rmodifier-command.c | 2 | ||||
-rw-r--r-- | src/plugins/rmodifier/rmodifier.c | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/plugins/rmodifier/rmodifier-command.c b/src/plugins/rmodifier/rmodifier-command.c index 18990f9d0..f360e8f08 100644 --- a/src/plugins/rmodifier/rmodifier-command.c +++ b/src/plugins/rmodifier/rmodifier-command.c @@ -242,6 +242,8 @@ rmodifier_command_init () "listdefault: list default rmodifiers\n" " add: add a rmodifier\n" " name: name of rmodifier\n" + " note: the name can not start with " + "\"#\"\n" " modifiers: comma separated list of modifiers\n" " groups: action on groups found: comma separated " "list of groups (from 1 to 9) with optional \"*\" " diff --git a/src/plugins/rmodifier/rmodifier.c b/src/plugins/rmodifier/rmodifier.c index 4eacabeff..173bdacfc 100644 --- a/src/plugins/rmodifier/rmodifier.c +++ b/src/plugins/rmodifier/rmodifier.c @@ -263,9 +263,11 @@ rmodifier_new (const char *name, const char *modifiers, const char *str_regex, struct t_rmodifier *new_rmodifier, *ptr_rmodifier; regex_t *regex; - if (!name || !name[0] || !modifiers || !modifiers[0] + if (!name || !name[0] || (name[0] == '#') || !modifiers || !modifiers[0] || !str_regex || !str_regex[0]) + { return NULL; + } regex = malloc (sizeof (*regex)); if (!regex) |