mirror of
https://github.com/weechat/weechat.git
synced 2026-07-09 03:03:12 +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:
@@ -111,15 +111,51 @@ weechat_aspell_config_change_default_dict (void *data,
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_aspell_config_create_option: set a dictionary for a buffer
|
||||
* weechat_aspell_config_dict_change: called when a dictionary is changed
|
||||
*/
|
||||
|
||||
void
|
||||
weechat_aspell_config_dict_change (void *data,
|
||||
struct t_config_option *option)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
(void) option;
|
||||
|
||||
weechat_aspell_create_spellers (weechat_current_buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_aspell_config_dict_delete_option: delete option in "dict" section
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_aspell_config_create_option (void *data,
|
||||
struct t_config_file *config_file,
|
||||
struct t_config_section *section,
|
||||
const char *option_name,
|
||||
const char *value)
|
||||
weechat_aspell_config_dict_delete_option (void *data,
|
||||
struct t_config_file *config_file,
|
||||
struct t_config_section *section,
|
||||
struct t_config_option *option)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
(void) config_file;
|
||||
(void) section;
|
||||
|
||||
weechat_config_option_free (option);
|
||||
weechat_aspell_create_spellers (weechat_current_buffer);
|
||||
|
||||
return WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_aspell_config_dict_create_option: create option in "dict" section
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_aspell_config_dict_create_option (void *data,
|
||||
struct t_config_file *config_file,
|
||||
struct t_config_section *section,
|
||||
const char *option_name,
|
||||
const char *value)
|
||||
{
|
||||
struct t_config_option *ptr_option;
|
||||
int rc;
|
||||
@@ -154,7 +190,9 @@ weechat_aspell_config_create_option (void *data,
|
||||
config_file, section,
|
||||
option_name, "string",
|
||||
_("comma separated list of dictionaries to use on this buffer"),
|
||||
NULL, 0, 0, "", value, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
NULL, 0, 0, "", value, NULL, NULL,
|
||||
&weechat_aspell_config_dict_change, NULL,
|
||||
NULL, NULL);
|
||||
rc = (ptr_option) ?
|
||||
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
|
||||
}
|
||||
@@ -195,11 +233,11 @@ weechat_aspell_config_get_dict (const char *name)
|
||||
int
|
||||
weechat_aspell_config_set_dict (const char *name, const char *value)
|
||||
{
|
||||
return weechat_aspell_config_create_option (NULL,
|
||||
weechat_aspell_config_file,
|
||||
weechat_aspell_config_section_dict,
|
||||
name,
|
||||
value);
|
||||
return weechat_aspell_config_dict_create_option (NULL,
|
||||
weechat_aspell_config_file,
|
||||
weechat_aspell_config_section_dict,
|
||||
name,
|
||||
value);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -221,7 +259,8 @@ weechat_aspell_config_init ()
|
||||
ptr_section = weechat_config_new_section (weechat_aspell_config_file, "look",
|
||||
0, 0,
|
||||
NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL);
|
||||
NULL, NULL, NULL, NULL,
|
||||
NULL, NULL);
|
||||
if (!ptr_section)
|
||||
{
|
||||
weechat_config_free (weechat_aspell_config_file);
|
||||
@@ -238,7 +277,8 @@ weechat_aspell_config_init ()
|
||||
ptr_section = weechat_config_new_section (weechat_aspell_config_file, "check",
|
||||
0, 0,
|
||||
NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL);
|
||||
NULL, NULL, NULL, NULL,
|
||||
NULL, NULL);
|
||||
if (!ptr_section)
|
||||
{
|
||||
weechat_config_free (weechat_aspell_config_file);
|
||||
@@ -269,12 +309,14 @@ weechat_aspell_config_init ()
|
||||
"words)"),
|
||||
NULL, 0, INT_MAX, "2", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
/* dict */
|
||||
ptr_section = weechat_config_new_section (weechat_aspell_config_file, "dict",
|
||||
1, 1,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
&weechat_aspell_config_create_option, NULL);
|
||||
&weechat_aspell_config_dict_create_option, NULL,
|
||||
&weechat_aspell_config_dict_delete_option, NULL);
|
||||
if (!ptr_section)
|
||||
{
|
||||
weechat_config_free (weechat_aspell_config_file);
|
||||
|
||||
@@ -257,6 +257,8 @@ weechat_aspell_get_dict (struct t_gui_buffer *buffer)
|
||||
if (ptr_option)
|
||||
return weechat_config_string (ptr_option);
|
||||
}
|
||||
else
|
||||
free (name);
|
||||
|
||||
/* nothing found => return default dictionary (if set) */
|
||||
if (weechat_config_string (weechat_aspell_config_check_default_dict)
|
||||
@@ -283,10 +285,10 @@ weechat_aspell_set_dict (struct t_gui_buffer *buffer, const char *value)
|
||||
if (weechat_aspell_config_set_dict (name, value) > 0)
|
||||
{
|
||||
if (value && value[0])
|
||||
weechat_printf (NULL, "%s: %s => %s",
|
||||
weechat_printf (NULL, "%s: \"%s\" => %s",
|
||||
ASPELL_PLUGIN_NAME, name, value);
|
||||
else
|
||||
weechat_printf (NULL, _("%s: %s: removed"),
|
||||
weechat_printf (NULL, _("%s: \"%s\" removed"),
|
||||
ASPELL_PLUGIN_NAME, name);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user