diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/plugins/logger/logger.c | 27 | ||||
-rw-r--r-- | src/plugins/plugin.c | 2 | ||||
-rw-r--r-- | src/plugins/weechat-plugin.h | 6 |
4 files changed, 33 insertions, 6 deletions
@@ -1,7 +1,7 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -ChangeLog - 2008-02-03 +ChangeLog - 2008-02-04 Version 0.2.7 (under dev!): @@ -9,7 +9,7 @@ Version 0.2.7 (under dev!): fails), nicks are now set with one option "nicks" (task #6088) * fixed bug when switching window, scrollback is now preserved (task #7680) * added group support in nicklist - * added backlog option in logger plugin + * added "backlog" and "name_lower_case" options in logger plugin (bug #19522) * improved main loop: higher timout in select(), less CPU usage * added /reload command to reload WeeChat and plugins config files (signal SIGHUP is catched to reload config files) diff --git a/src/plugins/logger/logger.c b/src/plugins/logger/logger.c index fd92047da..bc30a7d9e 100644 --- a/src/plugins/logger/logger.c +++ b/src/plugins/logger/logger.c @@ -47,12 +47,14 @@ WEECHAT_PLUGIN_LICENSE("GPL"); struct t_weechat_plugin *weechat_logger_plugin = NULL; -#define LOGGER_OPTION_PATH "path" -#define LOGGER_OPTION_TIME_FORMAT "time_format" -#define LOGGER_OPTION_INFO_LINES "info_lines" -#define LOGGER_OPTION_BACKLOG "backlog" +#define LOGGER_OPTION_PATH "path" +#define LOGGER_OPTION_NAME_LOWER_CASE "name_lower_case" +#define LOGGER_OPTION_TIME_FORMAT "time_format" +#define LOGGER_OPTION_INFO_LINES "info_lines" +#define LOGGER_OPTION_BACKLOG "backlog" char *logger_option_path = NULL; +int logger_option_name_lower_case; char *logger_option_time_format = NULL; int logger_option_info_lines; int logger_option_backlog; @@ -77,6 +79,17 @@ logger_config_read () logger_option_path = weechat_config_get_plugin ("path"); } + string = weechat_config_get_plugin (LOGGER_OPTION_NAME_LOWER_CASE); + if (!string) + { + weechat_config_set_plugin (LOGGER_OPTION_NAME_LOWER_CASE, "on"); + string = weechat_config_get_plugin (LOGGER_OPTION_NAME_LOWER_CASE); + } + if (string && (weechat_config_string_to_boolean (string) > 0)) + logger_option_name_lower_case = 1; + else + logger_option_name_lower_case = 0; + logger_option_time_format = weechat_config_get_plugin (LOGGER_OPTION_TIME_FORMAT); if (!logger_option_time_format) { @@ -209,11 +222,15 @@ logger_get_filename (struct t_gui_buffer *buffer) strcpy (res, log_path2); if (category2) { + if (logger_option_name_lower_case) + weechat_string_tolower (category2); strcat (res, category2); strcat (res, "."); } if (name2) { + if (logger_option_name_lower_case) + weechat_string_tolower (name2); strcat (res, name2); strcat (res, "."); } @@ -644,6 +661,8 @@ weechat_plugin_init (struct t_weechat_plugin *plugin) weechat_hook_config ("plugin", "logger." LOGGER_OPTION_PATH, &logger_config_cb, NULL); + weechat_hook_config ("plugin", "logger." LOGGER_OPTION_NAME_LOWER_CASE, + &logger_config_cb, NULL); weechat_hook_config ("plugin", "logger." LOGGER_OPTION_TIME_FORMAT, &logger_config_cb, NULL); weechat_hook_config ("plugin", "logger." LOGGER_OPTION_INFO_LINES, diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index d841d1c18..9e2e5b357 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -234,6 +234,8 @@ plugin_load (char *filename) new_plugin->gettext = &plugin_api_gettext; new_plugin->ngettext = &plugin_api_ngettext; new_plugin->strndup = &string_strndup; + new_plugin->string_tolower = &string_tolower; + new_plugin->string_toupper = &string_toupper; new_plugin->strcasecmp = &string_strcasecmp; new_plugin->strncasecmp = &string_strncasecmp; new_plugin->strcmp_ignore_chars = &string_strcmp_ignore_chars; diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index 34bda39d9..91112eb0c 100644 --- a/src/plugins/weechat-plugin.h +++ b/src/plugins/weechat-plugin.h @@ -95,6 +95,8 @@ struct t_weechat_plugin char *(*gettext) (char *string); char *(*ngettext) (char *single, char *plural, int count); char *(*strndup) (char *string, int length); + void (*string_tolower) (char *string); + void (*string_toupper) (char *string); int (*strcasecmp) (char *string1, char *string2); int (*strncasecmp) (char *string1, char *string2, int max); int (*strcmp_ignore_chars) (char *string1, char *string2, @@ -360,6 +362,10 @@ struct t_weechat_plugin weechat_plugin->ngettext(single, plural, number) #define weechat_strndup(__string, __length) \ weechat_plugin->strndup(__string, __length) +#define weechat_string_tolower(__string) \ + weechat_plugin->string_tolower(__string) +#define weechat_string_toupper(__string) \ + weechat_plugin->string_toupper(__string) #define weechat_strcasecmp(__string1, __string2) \ weechat_plugin->strcasecmp(__string1, __string2) #define weechat_strncasecmp(__string1, __string2, __max) \ |