diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2023-01-27 19:46:04 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2023-01-28 15:14:20 +0100 |
commit | f9a80e7d4d107fb36f94d164fb1fb829c7ba1793 (patch) | |
tree | ed7a0e79b4993af76483b90fee6e23daf1fb0411 | |
parent | 3319e6ff6e9f0d8af2627d57ea69bee79479a439 (diff) | |
download | weechat-f9a80e7d4d107fb36f94d164fb1fb829c7ba1793.zip |
trigger: make trigger names/options/types/return codes/post actions case sensitive (issue #1872)
-rw-r--r-- | src/plugins/trigger/trigger-command.c | 5 | ||||
-rw-r--r-- | src/plugins/trigger/trigger.c | 23 |
2 files changed, 17 insertions, 11 deletions
diff --git a/src/plugins/trigger/trigger-command.c b/src/plugins/trigger/trigger-command.c index 9ca8b50d1..2440446f1 100644 --- a/src/plugins/trigger/trigger-command.c +++ b/src/plugins/trigger/trigger-command.c @@ -1095,11 +1095,8 @@ trigger_command_trigger (const void *pointer, void *data, { for (j = 0; trigger_config_default_list[j][0]; j++) { - if (weechat_strcasecmp (trigger_config_default_list[j][0], - argv[i]) == 0) - { + if (strcmp (trigger_config_default_list[j][0], argv[i]) == 0) break; - } } if (trigger_config_default_list[j][0]) { diff --git a/src/plugins/trigger/trigger.c b/src/plugins/trigger/trigger.c index 220d9fc45..8ea464c3e 100644 --- a/src/plugins/trigger/trigger.c +++ b/src/plugins/trigger/trigger.c @@ -102,7 +102,7 @@ trigger_search_option (const char *option_name) for (i = 0; i < TRIGGER_NUM_OPTIONS; i++) { - if (weechat_strcasecmp (trigger_option_string[i], option_name) == 0) + if (strcmp (trigger_option_string[i], option_name) == 0) return i; } @@ -121,9 +121,12 @@ trigger_search_hook_type (const char *type) { int i; + if (!type) + return -1; + for (i = 0; i < TRIGGER_NUM_HOOK_TYPES; i++) { - if (weechat_strcasecmp (trigger_hook_type_string[i], type) == 0) + if (strcmp (trigger_hook_type_string[i], type) == 0) return i; } @@ -163,9 +166,12 @@ trigger_search_return_code (const char *return_code) { int i; + if (!return_code) + return -1; + for (i = 0; i < TRIGGER_NUM_RETURN_CODES; i++) { - if (weechat_strcasecmp (trigger_return_code_string[i], return_code) == 0) + if (strcmp (trigger_return_code_string[i], return_code) == 0) return i; } @@ -184,9 +190,12 @@ trigger_search_post_action (const char *post_action) { int i; + if (!post_action) + return -1; + for (i = 0; i < TRIGGER_NUM_POST_ACTIONS; i++) { - if (weechat_strcasecmp (trigger_post_action_string[i], post_action) == 0) + if (strcmp (trigger_post_action_string[i], post_action) == 0) return i; } @@ -211,7 +220,7 @@ trigger_search (const char *name) for (ptr_trigger = triggers; ptr_trigger; ptr_trigger = ptr_trigger->next_trigger) { - if (weechat_strcasecmp (ptr_trigger->name, name) == 0) + if (strcmp (ptr_trigger->name, name) == 0) return ptr_trigger; } @@ -250,7 +259,7 @@ trigger_search_with_option (struct t_config_option *option) for (ptr_trigger = triggers; ptr_trigger; ptr_trigger = ptr_trigger->next_trigger) { - if (weechat_strncasecmp (ptr_trigger->name, ptr_name, num_chars) == 0) + if (weechat_strncmp (ptr_trigger->name, ptr_name, num_chars) == 0) break; } @@ -954,7 +963,7 @@ trigger_find_pos (struct t_trigger *trigger, struct t_trigger *list_triggers) for (ptr_trigger = list_triggers; ptr_trigger; ptr_trigger = ptr_trigger->next_trigger) { - if (weechat_strcasecmp (trigger->name, ptr_trigger->name) < 0) + if (weechat_strcmp (trigger->name, ptr_trigger->name) < 0) return ptr_trigger; } |