diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2021-07-04 13:21:39 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2021-07-04 13:27:33 +0200 |
commit | a4507539fbcb6e7225832141b7f2d61d0d37a0d2 (patch) | |
tree | 80742fc3bc5d44749373449397d3bd62c00f5eb2 /src/plugins/typing/typing-config.c | |
parent | 5b87e0c54448d035cce8fb7ea29034e2e8f7ee47 (diff) | |
download | weechat-a4507539fbcb6e7225832141b7f2d61d0d37a0d2.zip |
typing: add option typing.look.item_max_length
Diffstat (limited to 'src/plugins/typing/typing-config.c')
-rw-r--r-- | src/plugins/typing/typing-config.c | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/src/plugins/typing/typing-config.c b/src/plugins/typing/typing-config.c index bd76e8ba0..a0fda1128 100644 --- a/src/plugins/typing/typing-config.c +++ b/src/plugins/typing/typing-config.c @@ -22,6 +22,7 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> +#include <limits.h> #include "../weechat-plugin.h" #include "typing.h" @@ -40,6 +41,7 @@ struct t_config_option *typing_config_look_delay_purge_typing; struct t_config_option *typing_config_look_delay_set_paused; struct t_config_option *typing_config_look_enabled_nicks; struct t_config_option *typing_config_look_enabled_self; +struct t_config_option *typing_config_look_item_max_length; /* @@ -81,6 +83,22 @@ typing_config_change_enabled (const void *pointer, void *data, } /* + * Callback for changes on options "typing.look.item_max_length". + */ + +void +typing_config_change_item_max_length (const void *pointer, void *data, + struct t_config_option *option) +{ + /* make C compiler happy */ + (void) pointer; + (void) data; + (void) option; + + weechat_bar_item_update (TYPING_BAR_ITEM_NAME); +} + +/* * Initializes typing configuration file. * * Returns: @@ -119,21 +137,21 @@ typing_config_init () "delay_purge_paused", "integer", N_("number of seconds after paused status has been set: if reached, " "the typing status is removed"), - NULL, 1, 3600, "30", NULL, 0, + NULL, 1, INT_MAX, "30", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); typing_config_look_delay_purge_typing = weechat_config_new_option ( typing_config_file, ptr_section, "delay_purge_typing", "integer", N_("number of seconds after typing status has been set: if reached, " "the typing status is removed"), - NULL, 1, 3600, "6", NULL, 0, + NULL, 1, INT_MAX, "6", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); typing_config_look_delay_set_paused = weechat_config_new_option ( typing_config_file, ptr_section, "delay_set_paused", "integer", N_("number of seconds after typing last char: if reached, the typing " "status becomes \"paused\" and no more typing signals are sent"), - NULL, 1, 3600, "10", NULL, 0, + NULL, 1, INT_MAX, "10", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); typing_config_look_enabled_nicks = weechat_config_new_option ( typing_config_file, ptr_section, @@ -152,6 +170,15 @@ typing_config_init () NULL, NULL, NULL, &typing_config_change_enabled, NULL, NULL, NULL, NULL, NULL); + typing_config_look_item_max_length = weechat_config_new_option ( + typing_config_file, ptr_section, + "item_max_length", "integer", + N_("max number of chars displayed in the bar item \"typing\" " + "(0 = do not truncate content)"), + NULL, 0, INT_MAX, "0", NULL, 0, + NULL, NULL, NULL, + &typing_config_change_item_max_length, NULL, NULL, + NULL, NULL, NULL); return 1; } |