1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-25 12:26:40 +02:00

Add new features to logger plugin (command /logger, log level, level by buffer, mask by buffer, ..), fix some bugs

New features:
- new command /logger
- log level, to log only some messages, according to importance (task #8592)
- level by buffer: custom level for some buffers (or group of buffers)
- log filename mask by buffer (or group of buffers)
- marker line is added after display of backlog
- add "delete" callback for config file sections
- add "mkdir_parents" function to plugin API
- remove old log options in IRC plugin

Bug fix:
- marker line is set only when user switches buffer (not when a plugin force
  switch, like IRC plugin does when opening server or channel buffer)
- backlog fixed (sometimes lines were not properly displayed)
This commit is contained in:
Sebastien Helleu
2008-10-30 17:18:28 +01:00
parent 2f68ec7f36
commit 6f442bbfc1
61 changed files with 3203 additions and 1190 deletions
+60 -6
View File
@@ -118,21 +118,29 @@ script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
struct t_config_section *section,
const char *option_name,
const char *value),
const char *function_create_option)
const char *function_create_option,
int (*callback_delete_option)(void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option),
const char *function_delete_option)
{
struct t_script_callback *new_script_callback1, *new_script_callback2;
struct t_script_callback *new_script_callback3, *new_script_callback4;
struct t_script_callback *new_script_callback5;
struct t_config_section *new_section;
void *callback1, *callback2, *callback3, *callback4;
void *callback1, *callback2, *callback3, *callback4, *callback5;
new_script_callback1 = NULL;
new_script_callback2 = NULL;
new_script_callback3 = NULL;
new_script_callback4 = NULL;
new_script_callback5 = NULL;
callback1 = NULL;
callback2 = NULL;
callback3 = NULL;
callback4 = NULL;
callback5 = NULL;
if (function_read && function_read[0])
{
@@ -141,7 +149,7 @@ script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
return NULL;
callback1 = callback_read;
}
if (function_write && function_write[0])
{
new_script_callback2 = script_callback_alloc ();
@@ -202,6 +210,36 @@ script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
callback4 = callback_create_option;
}
if (function_delete_option && function_delete_option[0])
{
new_script_callback5 = script_callback_alloc ();
if (!new_script_callback5)
{
if (new_script_callback1)
{
script_callback_free_data (new_script_callback1);
free (new_script_callback1);
}
if (new_script_callback2)
{
script_callback_free_data (new_script_callback2);
free (new_script_callback2);
}
if (new_script_callback3)
{
script_callback_free_data (new_script_callback3);
free (new_script_callback3);
}
if (new_script_callback4)
{
script_callback_free_data (new_script_callback4);
free (new_script_callback4);
}
return NULL;
}
callback5 = callback_delete_option;
}
new_section = weechat_config_new_section (config_file,
name,
user_can_add_options,
@@ -213,7 +251,9 @@ script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
callback3,
new_script_callback3,
callback4,
new_script_callback4);
new_script_callback4,
callback5,
new_script_callback5);
if (!new_section)
{
if (new_script_callback1)
@@ -236,6 +276,11 @@ script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
script_callback_free_data (new_script_callback4);
free (new_script_callback4);
}
if (new_script_callback5)
{
script_callback_free_data (new_script_callback5);
free (new_script_callback5);
}
return NULL;
}
@@ -275,6 +320,15 @@ script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
script_callback_add (script, new_script_callback4);
}
if (new_script_callback5)
{
new_script_callback5->script = script;
new_script_callback5->function = strdup (function_delete_option);
new_script_callback5->config_file = config_file;
new_script_callback5->config_section = new_section;
script_callback_add (script, new_script_callback5);
}
return new_section;
}
@@ -734,7 +788,7 @@ script_api_hook_print (struct t_weechat_plugin *weechat_plugin,
int (*callback)(void *data,
struct t_gui_buffer *buffer,
time_t date,
int tags_count, char **tags,
int tags_count, const char **tags,
const char *prefix,
const char *message),
const char *function)