diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2014-02-06 11:19:32 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2014-02-09 12:55:41 +0100 |
commit | 4a9c9a0b07ff67818c27628c5bfb14e4be62da12 (patch) | |
tree | d3cbb89cdb85472387cd2eafa903fad8b0f4663c /src | |
parent | adf547a47c9e194900ea4db95c64f95c7cef265c (diff) | |
download | weechat-4a9c9a0b07ff67818c27628c5bfb14e4be62da12.zip |
trigger: add options trigger.color.trigger{_disabled}
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/trigger/trigger-command.c | 54 | ||||
-rw-r--r-- | src/plugins/trigger/trigger-config.c | 14 | ||||
-rw-r--r-- | src/plugins/trigger/trigger-config.h | 2 |
3 files changed, 55 insertions, 15 deletions
diff --git a/src/plugins/trigger/trigger-command.c b/src/plugins/trigger/trigger-command.c index 8c4723ec8..c802be85d 100644 --- a/src/plugins/trigger/trigger-command.c +++ b/src/plugins/trigger/trigger-command.c @@ -135,8 +135,8 @@ trigger_command_trigger (void *data, struct t_gui_buffer *buffer, int argc, { struct t_trigger *ptr_trigger; const char *option; - char *value, **sargv, **items, input[1024]; - int i, type, count, index_option, enable, sargc, num_items, rc; + char *value, **sargv, **items, input[1024], spaces[256]; + int i, type, count, index_option, enable, sargc, num_items, rc, length; /* make C compiler happy */ (void) data; @@ -155,49 +155,73 @@ trigger_command_trigger (void *data, struct t_gui_buffer *buffer, int argc, ptr_trigger = ptr_trigger->next_trigger) { weechat_printf_tags (NULL, "no_trigger", - " %s: %s, \"%s\" (%d hooks, %d/%d) %s", + " %s%s%s: %s%s(%s%s%s)%s (hooks: %d - %d/%d)", + weechat_config_boolean (ptr_trigger->options[TRIGGER_OPTION_ENABLED]) ? + weechat_color (weechat_config_string (trigger_config_color_trigger)) : + weechat_color (weechat_config_string (trigger_config_color_trigger_disabled)), ptr_trigger->name, + weechat_color ("reset"), weechat_config_string (ptr_trigger->options[TRIGGER_OPTION_HOOK]), + weechat_color ("chat_delimiters"), + weechat_color ("reset"), weechat_config_string (ptr_trigger->options[TRIGGER_OPTION_ARGUMENTS]), + weechat_color ("chat_delimiters"), + weechat_color ("reset"), ptr_trigger->hooks_count, ptr_trigger->hook_count_cb, - ptr_trigger->hook_count_cmd, - weechat_config_boolean (ptr_trigger->options[TRIGGER_OPTION_ENABLED]) ? - "" : _("(disabled)")); + ptr_trigger->hook_count_cmd); + length = weechat_strlen_screen (ptr_trigger->name) + 3; + if (length >= (int)sizeof (spaces)) + length = sizeof (spaces) - 1; + memset (spaces, ' ', length); + spaces[length] = '\0'; option = weechat_config_string (ptr_trigger->options[TRIGGER_OPTION_CONDITIONS]); if (option && option[0]) { weechat_printf_tags (NULL, "no_trigger", - " conditions: \"%s\"", option); + "%s ? %s\"%s%s%s\"", + spaces, + weechat_color ("chat_delimiters"), + weechat_color ("reset"), + option, + weechat_color ("chat_delimiters")); } for (i = 0; i < ptr_trigger->regex_count; i++) { weechat_printf_tags (NULL, "no_trigger", - " regex %d%s%s%s: " - "%s\"%s%s%s\" --> \"%s%s%s\"", + "%s %d %s\"%s%s%s\" --> " + "\"%s%s%s\"%s%s%s%s", + spaces, i + 1, - (ptr_trigger->regex[i].variable) ? " (" : "", - (ptr_trigger->regex[i].variable) ? ptr_trigger->regex[i].variable : "", - (ptr_trigger->regex[i].variable) ? ")" : "", weechat_color ("chat_delimiters"), weechat_color (weechat_config_string (trigger_config_color_regex)), ptr_trigger->regex[i].str_regex, weechat_color ("chat_delimiters"), weechat_color (weechat_config_string (trigger_config_color_replace)), ptr_trigger->regex[i].replace, - weechat_color ("chat_delimiters")); + weechat_color ("chat_delimiters"), + weechat_color ("reset"), + (ptr_trigger->regex[i].variable) ? " (" : "", + (ptr_trigger->regex[i].variable) ? ptr_trigger->regex[i].variable : "", + (ptr_trigger->regex[i].variable) ? ")" : ""); } option = weechat_config_string (ptr_trigger->options[TRIGGER_OPTION_COMMAND]); if (option && option[0]) { weechat_printf_tags (NULL, "no_trigger", - " command: \"%s\"", option); + "%s > %s\"%s%s%s\"", + spaces, + weechat_color ("chat_delimiters"), + weechat_color ("reset"), + option, + weechat_color ("chat_delimiters")); } rc = weechat_config_integer (ptr_trigger->options[TRIGGER_OPTION_RETURN_CODE]); if (rc != TRIGGER_RC_OK) { weechat_printf_tags (NULL, "no_trigger", - " return code: %s", + "%s $ %s", + spaces, trigger_return_code_string[rc]); } } diff --git a/src/plugins/trigger/trigger-config.c b/src/plugins/trigger/trigger-config.c index 89492fe73..992d3da6a 100644 --- a/src/plugins/trigger/trigger-config.c +++ b/src/plugins/trigger/trigger-config.c @@ -39,6 +39,8 @@ struct t_config_option *trigger_config_look_test; struct t_config_option *trigger_config_color_regex; struct t_config_option *trigger_config_color_replace; +struct t_config_option *trigger_config_color_trigger; +struct t_config_option *trigger_config_color_trigger_disabled; /* @@ -460,6 +462,18 @@ trigger_config_init () N_("text color for replacement text (for regular expressions)"), NULL, 0, 0, "cyan", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); + trigger_config_color_trigger = weechat_config_new_option ( + trigger_config_file, ptr_section, + "trigger", "color", + N_("text color for trigger name"), + NULL, 0, 0, "green", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL); + trigger_config_color_trigger_disabled = weechat_config_new_option ( + trigger_config_file, ptr_section, + "trigger_disabled", "color", + N_("text color for disabled trigger name"), + NULL, 0, 0, "red", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL); /* trigger */ ptr_section = weechat_config_new_section (trigger_config_file, diff --git a/src/plugins/trigger/trigger-config.h b/src/plugins/trigger/trigger-config.h index a6517aa2d..d6746a6b0 100644 --- a/src/plugins/trigger/trigger-config.h +++ b/src/plugins/trigger/trigger-config.h @@ -28,6 +28,8 @@ extern struct t_config_section *trigger_config_section_trigger; extern struct t_config_option *trigger_config_color_regex; extern struct t_config_option *trigger_config_color_replace; +extern struct t_config_option *trigger_config_color_trigger; +extern struct t_config_option *trigger_config_color_trigger_disabled; extern struct t_config_option *trigger_config_create_option (const char *trigger_name, int index_option, |