summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2008-04-11 23:11:56 +0200
committerSebastien Helleu <flashcode@flashtux.org>2008-04-11 23:11:56 +0200
commitcd1e12250db1137c64cc526c77b63a9cbd3ba0cf (patch)
tree4a4c3b5aec392950ab1dca9a8213a89467df2dcf
parentedeabd977b883e1c13a12601e4713f86d8df9164 (diff)
downloadweechat-cd1e12250db1137c64cc526c77b63a9cbd3ba0cf.zip
Added plugin name in beginning of log filenames
-rw-r--r--src/plugins/logger/logger.c18
-rw-r--r--src/plugins/plugin-api.c6
2 files changed, 21 insertions, 3 deletions
diff --git a/src/plugins/logger/logger.c b/src/plugins/logger/logger.c
index 85b05f8c1..ec0a7ddf3 100644
--- a/src/plugins/logger/logger.c
+++ b/src/plugins/logger/logger.c
@@ -194,7 +194,7 @@ logger_get_filename (struct t_gui_buffer *buffer)
struct t_plugin_infolist *ptr_infolist;
char *res;
char *dir_separator, *weechat_dir, *log_path, *log_path2;
- char *category, *category2, *name, *name2;
+ char *plugin_name, *plugin_name2, *category, *category2, *name, *name2;
int length;
res = NULL;
@@ -214,6 +214,9 @@ logger_get_filename (struct t_gui_buffer *buffer)
name2 = NULL;
if (weechat_infolist_next (ptr_infolist))
{
+ plugin_name = weechat_infolist_string (ptr_infolist, "plugin_name");
+ plugin_name2 = (plugin_name) ?
+ weechat_string_replace (plugin_name, dir_separator, "_") : NULL;
category = weechat_infolist_string (ptr_infolist, "category");
category2 = (category) ?
weechat_string_replace (category, dir_separator, "_") : NULL;
@@ -222,15 +225,24 @@ logger_get_filename (struct t_gui_buffer *buffer)
weechat_string_replace (name, dir_separator, "_") : NULL;
}
length = strlen (log_path2);
+ if (plugin_name2)
+ length += strlen (plugin_name2) + 1;
if (category2)
- length += strlen (category2);
+ length += strlen (category2) + 1;
if (name2)
- length += strlen (name2);
+ length += strlen (name2) + 1;
length += 16;
res = malloc (length);
if (res)
{
strcpy (res, log_path2);
+ if (plugin_name2)
+ {
+ if (logger_option_name_lower_case)
+ weechat_string_tolower (plugin_name2);
+ strcat (res, plugin_name2);
+ strcat (res, ".");
+ }
if (category2)
{
if (logger_option_name_lower_case)
diff --git a/src/plugins/plugin-api.c b/src/plugins/plugin-api.c
index 04e3a6c9f..957f739ff 100644
--- a/src/plugins/plugin-api.c
+++ b/src/plugins/plugin-api.c
@@ -446,6 +446,12 @@ plugin_api_infolist_get_add_buffer (struct t_plugin_infolist *infolist,
if (!plugin_infolist_new_var_pointer (ptr_item, "pointer", buffer))
return 0;
+ if (!plugin_infolist_new_var_pointer (ptr_item, "plugin", buffer->plugin))
+ return 0;
+ if (!plugin_infolist_new_var_string (ptr_item, "plugin_name",
+ (buffer->plugin) ?
+ buffer->plugin->name : NULL))
+ return 0;
if (!plugin_infolist_new_var_integer (ptr_item, "number", buffer->number))
return 0;
if (!plugin_infolist_new_var_string (ptr_item, "category", buffer->category))