summaryrefslogtreecommitdiff
path: root/src/plugins/aspell/weechat-aspell-config.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2008-10-30 17:18:28 +0100
committerSebastien Helleu <flashcode@flashtux.org>2008-10-30 17:18:28 +0100
commit6f442bbfc13a73f9b993f5bbd5928cab9a1321c4 (patch)
treeb3367af39b4ec208f4b72fc458edb44b2c47b556 /src/plugins/aspell/weechat-aspell-config.c
parent2f68ec7f3655efc9f814b2f4298d27029d1c6824 (diff)
downloadweechat-6f442bbfc13a73f9b993f5bbd5928cab9a1321c4.zip
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)
Diffstat (limited to 'src/plugins/aspell/weechat-aspell-config.c')
-rw-r--r--src/plugins/aspell/weechat-aspell-config.c72
1 files changed, 57 insertions, 15 deletions
diff --git a/src/plugins/aspell/weechat-aspell-config.c b/src/plugins/aspell/weechat-aspell-config.c
index a286c7268..46816d347 100644
--- a/src/plugins/aspell/weechat-aspell-config.c
+++ b/src/plugins/aspell/weechat-aspell-config.c
@@ -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_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_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_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);