summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/wee-config-file.c147
-rw-r--r--src/core/wee-config-file.h24
-rw-r--r--src/core/wee-config.c105
-rw-r--r--src/core/wee-string.c14
-rw-r--r--src/core/wee-string.h2
-rw-r--r--src/plugins/alias/alias-config.c97
-rw-r--r--src/plugins/irc/irc-config.c77
-rw-r--r--src/plugins/scripts/lua/weechat-lua-api.c30
-rw-r--r--src/plugins/scripts/perl/weechat-perl-api.c34
-rw-r--r--src/plugins/scripts/python/weechat-python-api.c30
-rw-r--r--src/plugins/scripts/ruby/weechat-ruby-api.c32
-rw-r--r--src/plugins/scripts/script-api.c12
-rw-r--r--src/plugins/scripts/script-api.h4
-rw-r--r--src/plugins/scripts/tcl/weechat-tcl-api.c78
-rw-r--r--src/plugins/weechat-plugin.h22
15 files changed, 455 insertions, 253 deletions
diff --git a/src/core/wee-config-file.c b/src/core/wee-config-file.c
index cd146bfb7..0f8305e9b 100644
--- a/src/core/wee-config-file.c
+++ b/src/core/wee-config-file.c
@@ -153,13 +153,13 @@ config_file_new_section (struct t_config_file *config_file, const char *name,
const char *option_name,
const char *value),
void *callback_read_data,
- void (*callback_write)(void *data,
- struct t_config_file *config_file,
- const char *section_name),
+ int (*callback_write)(void *data,
+ struct t_config_file *config_file,
+ const char *section_name),
void *callback_write_data,
- void (*callback_write_default)(void *data,
- struct t_config_file *config_file,
- const char *section_name),
+ int (*callback_write_default)(void *data,
+ struct t_config_file *config_file,
+ const char *section_name),
void *callback_write_default_data,
int (*callback_create_option)(void *data,
struct t_config_file *config_file,
@@ -1779,44 +1779,49 @@ config_file_option_color_default (struct t_config_option *option)
/*
* config_file_write_option: write an option in a configuration file
+ * return 1 if ok, 0 if error
*/
-void
+int
config_file_write_option (struct t_config_file *config_file,
struct t_config_option *option)
{
+ int rc;
+
if (!config_file || !config_file->file || !option)
- return;
-
+ return 0;
+
+ rc = 1;
+
if (option->value)
{
switch (option->type)
{
case CONFIG_OPTION_TYPE_BOOLEAN:
- string_iconv_fprintf (config_file->file, "%s = %s\n",
- option->name,
- (CONFIG_BOOLEAN(option) == CONFIG_BOOLEAN_TRUE) ?
- "on" : "off");
+ rc = string_iconv_fprintf (config_file->file, "%s = %s\n",
+ option->name,
+ (CONFIG_BOOLEAN(option) == CONFIG_BOOLEAN_TRUE) ?
+ "on" : "off");
break;
case CONFIG_OPTION_TYPE_INTEGER:
if (option->string_values)
- string_iconv_fprintf (config_file->file, "%s = %s\n",
- option->name,
- option->string_values[CONFIG_INTEGER(option)]);
+ rc = string_iconv_fprintf (config_file->file, "%s = %s\n",
+ option->name,
+ option->string_values[CONFIG_INTEGER(option)]);
else
- string_iconv_fprintf (config_file->file, "%s = %d\n",
- option->name,
- CONFIG_INTEGER(option));
+ rc = string_iconv_fprintf (config_file->file, "%s = %d\n",
+ option->name,
+ CONFIG_INTEGER(option));
break;
case CONFIG_OPTION_TYPE_STRING:
- string_iconv_fprintf (config_file->file, "%s = \"%s\"\n",
- option->name,
- (char *)option->value);
+ rc = string_iconv_fprintf (config_file->file, "%s = \"%s\"\n",
+ option->name,
+ (char *)option->value);
break;
case CONFIG_OPTION_TYPE_COLOR:
- string_iconv_fprintf (config_file->file, "%s = %s\n",
- option->name,
- gui_color_get_name (CONFIG_COLOR(option)));
+ rc = string_iconv_fprintf (config_file->file, "%s = %s\n",
+ option->name,
+ gui_color_get_name (CONFIG_COLOR(option)));
break;
case CONFIG_NUM_OPTION_TYPES:
break;
@@ -1824,17 +1829,20 @@ config_file_write_option (struct t_config_file *config_file,
}
else
{
- string_iconv_fprintf (config_file->file, "%s\n",
- option->name);
+ rc = string_iconv_fprintf (config_file->file, "%s\n",
+ option->name);
}
+
+ return rc;
}
/*
* config_file_write_line: write a line in a configuration file
* if value is NULL, then write a section with [ ] around
+ * return 1 if ok, 0 if error
*/
-void
+int
config_file_write_line (struct t_config_file *config_file,
const char *option_name, const char *value, ...)
{
@@ -1842,7 +1850,7 @@ config_file_write_line (struct t_config_file *config_file,
va_list argptr;
if (!config_file || !option_name)
- return;
+ return 0;
if (value && value[0])
{
@@ -1852,14 +1860,13 @@ config_file_write_line (struct t_config_file *config_file,
if (buf[0])
{
- string_iconv_fprintf (config_file->file, "%s = %s\n",
- option_name, buf);
- return;
+ return (string_iconv_fprintf (config_file->file, "%s = %s\n",
+ option_name, buf));
}
}
- string_iconv_fprintf (config_file->file, "\n[%s]\n",
- option_name);
+ return (string_iconv_fprintf (config_file->file, "\n[%s]\n",
+ option_name));
}
/*
@@ -1904,6 +1911,10 @@ config_file_write_internal (struct t_config_file *config_file,
}
snprintf (filename2, filename_length + 32, "%s.weechattmp", filename);
+ log_printf (_("Writing configuration file %s %s"),
+ config_file->filename,
+ (default_options) ? _("(default options)") : "");
+
/* open temp file in write mode */
config_file->file = fopen (filename2, "w");
if (!config_file->file)
@@ -1912,20 +1923,16 @@ config_file_write_internal (struct t_config_file *config_file,
_("%sError: cannot create file \"%s\""),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
filename2);
- free (filename);
- free (filename2);
- return WEECHAT_CONFIG_WRITE_ERROR;
+ goto error;
}
- log_printf (_("Writing configuration file %s %s"),
- config_file->filename,
- (default_options) ? _("(default options)") : "");
-
/* write header with version and date */
- string_iconv_fprintf (config_file->file, "#\n");
- string_iconv_fprintf (config_file->file,
- "# %s -- %s v%s\n#\n",
- config_file->filename, PACKAGE_NAME, PACKAGE_VERSION);
+ if (!string_iconv_fprintf (config_file->file, "#\n"))
+ goto error;
+ if (!string_iconv_fprintf (config_file->file,
+ "# %s -- %s v%s\n#\n",
+ config_file->filename, PACKAGE_NAME, PACKAGE_VERSION))
+ goto error;
/* write all sections */
for (ptr_section = config_file->sections; ptr_section;
@@ -1934,39 +1941,46 @@ config_file_write_internal (struct t_config_file *config_file,
/* call write callback if defined for section */
if (default_options && ptr_section->callback_write_default)
{
- (void) (ptr_section->callback_write_default) (ptr_section->callback_write_default_data,
- config_file,
- ptr_section->name);
+ if ((ptr_section->callback_write_default) (ptr_section->callback_write_default_data,
+ config_file,
+ ptr_section->name) != WEECHAT_CONFIG_WRITE_OK)
+ goto error;
}
else if (!default_options && ptr_section->callback_write)
{
- (void) (ptr_section->callback_write) (ptr_section->callback_write_data,
- config_file,
- ptr_section->name);
+ if ((ptr_section->callback_write) (ptr_section->callback_write_data,
+ config_file,
+ ptr_section->name) != WEECHAT_CONFIG_WRITE_OK)
+ goto error;
}
else
{
/* write all options for section */
- string_iconv_fprintf (config_file->file,
- "\n[%s]\n", ptr_section->name);
+ if (!string_iconv_fprintf (config_file->file,
+ "\n[%s]\n", ptr_section->name))
+ goto error;
for (ptr_option = ptr_section->options; ptr_option;
ptr_option = ptr_option->next_option)
{
- config_file_write_option (config_file, ptr_option);
+ if (!config_file_write_option (config_file, ptr_option))
+ goto error;
}
}
}
-
+
+ if (fflush (config_file->file) != 0)
+ goto error;
+
/* close temp file */
fclose (config_file->file);
config_file->file = NULL;
-
+
/* update file mode */
chmod (filename2, 0600);
-
+
/* remove target file */
unlink (filename);
-
+
/* rename temp file to target file */
rc = rename (filename2, filename);
@@ -1977,6 +1991,23 @@ config_file_write_internal (struct t_config_file *config_file,
return WEECHAT_CONFIG_WRITE_ERROR;
return WEECHAT_CONFIG_WRITE_OK;
+
+error:
+ gui_chat_printf (NULL,
+ _("%sError writing configuration file \"%s\""),
+ gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
+ filename);
+ log_printf (_("%sError writing configuration file \"%s\""),
+ "", config_file->filename);
+ if (config_file->file)
+ {
+ fclose (config_file->file);
+ config_file->file = NULL;
+ }
+ unlink (filename2);
+ free (filename);
+ free (filename2);
+ return WEECHAT_CONFIG_WRITE_ERROR;
}
/*
diff --git a/src/core/wee-config-file.h b/src/core/wee-config-file.h
index ff0326219..75bfcb98a 100644
--- a/src/core/wee-config-file.h
+++ b/src/core/wee-config-file.h
@@ -70,12 +70,12 @@ struct t_config_section
const char *option_name,
const char *value);
void *callback_read_data; /* data sent to read callback */
- void (*callback_write) /* called to write options */
+ int (*callback_write) /* called to write options */
(void *data, /* in config file (only for some */
struct t_config_file *config_file, /* special sections) */
const char *section_name);
void *callback_write_data; /* data sent to write callback */
- void (*callback_write_default) /* called to write default */
+ int (*callback_write_default) /* called to write default */
(void *data, /* options in config file */
struct t_config_file *config_file,
const char *section_name);
@@ -158,13 +158,13 @@ extern struct t_config_section *config_file_new_section (struct t_config_file *c
const char *option_name,
const char *value),
void *callback_read_data,
- void (*callback_write)(void *data,
- struct t_config_file *config_file,
- const char *section_name),
+ int (*callback_write)(void *data,
+ struct t_config_file *config_file,
+ const char *section_name),
void *callback_write_data,
- void (*callback_write_default)(void *data,
- struct t_config_file *config_file,
- const char *section_name),
+ int (*callback_write_default)(void *data,
+ struct t_config_file *config_file,
+ const char *section_name),
void *callback_write_default_data,
int (*callback_create_option)(void *data,
struct t_config_file *config_file,
@@ -234,10 +234,10 @@ extern const char *config_file_option_string (struct t_config_option *option);
extern const char *config_file_option_string_default (struct t_config_option *option);
extern const char *config_file_option_color (struct t_config_option *option);
extern const char *config_file_option_color_default (struct t_config_option *option);
-extern void config_file_write_option (struct t_config_file *config_file,
- struct t_config_option *option);
-extern void config_file_write_line (struct t_config_file *config_file,
- const char *option_name, const char *value, ...);
+extern int config_file_write_option (struct t_config_file *config_file,
+ struct t_config_option *option);
+extern int config_file_write_line (struct t_config_file *config_file,
+ const char *option_name, const char *value, ...);
extern int config_file_write (struct t_config_file *config_files);
extern int config_file_read (struct t_config_file *config_file);
extern int config_file_reload (struct t_config_file *config_file);
diff --git a/src/core/wee-config.c b/src/core/wee-config.c
index 1b43c62cf..e7006f996 100644
--- a/src/core/wee-config.c
+++ b/src/core/wee-config.c
@@ -807,33 +807,44 @@ config_weechat_layout_read_cb (void *data, struct t_config_file *config_file,
* config_weechat_layout_write: write windows layout in configuration file
*/
-void
+int
config_weechat_layout_write_tree (struct t_config_file *config_file,
struct t_gui_layout_window *layout_window)
{
- config_file_write_line (config_file, "window", "\"%d;%d;%d;%d;%s;%s\"",
- layout_window->internal_id,
- (layout_window->parent_node) ?
- layout_window->parent_node->internal_id : 0,
- layout_window->split_pct,
- layout_window->split_horiz,
- (layout_window->plugin_name) ?
- layout_window->plugin_name : "-",
- (layout_window->buffer_name) ?
- layout_window->buffer_name : "-");
+ if (!config_file_write_line (config_file, "window", "\"%d;%d;%d;%d;%s;%s\"",
+ layout_window->internal_id,
+ (layout_window->parent_node) ?
+ layout_window->parent_node->internal_id : 0,
+ layout_window->split_pct,
+ layout_window->split_horiz,
+ (layout_window->plugin_name) ?
+ layout_window->plugin_name : "-",
+ (layout_window->buffer_name) ?
+ layout_window->buffer_name : "-"))
+ return WEECHAT_CONFIG_WRITE_ERROR;
if (layout_window->child1)
- config_weechat_layout_write_tree (config_file, layout_window->child1);
+ {
+ if (config_weechat_layout_write_tree (config_file,
+ layout_window->child1) != WEECHAT_CONFIG_WRITE_OK)
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ }
if (layout_window->child2)
- config_weechat_layout_write_tree (config_file, layout_window->child2);
+ {
+ if (config_weechat_layout_write_tree (config_file,
+ layout_window->child2) != WEECHAT_CONFIG_WRITE_OK)
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ }
+
+ return WEECHAT_CONFIG_WRITE_OK;
}
/*
* config_weechat_layout_write_cb: write layout section in configuration file
*/
-void
+int
config_weechat_layout_write_cb (void *data, struct t_config_file *config_file,
const char *section_name)
{
@@ -842,19 +853,27 @@ config_weechat_layout_write_cb (void *data, struct t_config_file *config_file,
/* make C compiler happy */
(void) data;
- config_file_write_line (config_file, section_name, NULL);
+ if (!config_file_write_line (config_file, section_name, NULL))
+ return WEECHAT_CONFIG_WRITE_ERROR;
for (ptr_layout_buffer = gui_layout_buffers; ptr_layout_buffer;
ptr_layout_buffer = ptr_layout_buffer->next_layout)
{
- config_file_write_line (config_file, "buffer", "\"%s;%s;%d\"",
- ptr_layout_buffer->plugin_name,
- ptr_layout_buffer->buffer_name,
- ptr_layout_buffer->number);
+ if (!config_file_write_line (config_file, "buffer", "\"%s;%s;%d\"",
+ ptr_layout_buffer->plugin_name,
+ ptr_layout_buffer->buffer_name,
+ ptr_layout_buffer->number))
+ return WEECHAT_CONFIG_WRITE_ERROR;
}
if (gui_layout_windows)
- config_weechat_layout_write_tree (config_file, gui_layout_windows);
+ {
+ if (config_weechat_layout_write_tree (config_file,
+ gui_layout_windows) != WEECHAT_CONFIG_WRITE_OK)
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ }
+
+ return WEECHAT_CONFIG_WRITE_OK;
}
/*
@@ -1042,7 +1061,7 @@ config_weechat_filter_read_cb (void *data,
* config_weechat_filter_write_cb: write filter section in configuration file
*/
-void
+int
config_weechat_filter_write_cb (void *data, struct t_config_file *config_file,
const char *section_name)
{
@@ -1051,21 +1070,25 @@ config_weechat_filter_write_cb (void *data, struct t_config_file *config_file,
/* make C compiler happy */
(void) data;
- config_file_write_line (config_file, section_name, NULL);
+ if (!config_file_write_line (config_file, section_name, NULL))
+ return WEECHAT_CONFIG_WRITE_ERROR;
for (ptr_filter = gui_filters; ptr_filter;
ptr_filter = ptr_filter->next_filter)
{
- config_file_write_line (config_file,
- ptr_filter->name,
- "%s;%s%s%s;%s;%s",
- (ptr_filter->enabled) ? "on" : "off",
- (ptr_filter->plugin_name) ? ptr_filter->plugin_name : "",
- (ptr_filter->plugin_name) ? "." : "",
- ptr_filter->buffer_name,
- ptr_filter->tags,
- ptr_filter->regex);
+ if (!config_file_write_line (config_file,
+ ptr_filter->name,
+ "%s;%s%s%s;%s;%s",
+ (ptr_filter->enabled) ? "on" : "off",
+ (ptr_filter->plugin_name) ? ptr_filter->plugin_name : "",
+ (ptr_filter->plugin_name) ? "." : "",
+ ptr_filter->buffer_name,
+ ptr_filter->tags,
+ ptr_filter->regex))
+ return WEECHAT_CONFIG_WRITE_ERROR;
}
+
+ return WEECHAT_CONFIG_WRITE_OK;
}
/*
@@ -1103,31 +1126,37 @@ config_weechat_key_read_cb (void *data, struct t_config_file *config_file,
* config_weechat_key_write_cb: write key section in configuration file
*/
-void
+int
config_weechat_key_write_cb (void *data, struct t_config_file *config_file,
const char *section_name)
{
struct t_gui_key *ptr_key;
char *expanded_name;
+ int rc;
/* make C compiler happy */
(void) data;
- config_file_write_line (config_file, section_name, NULL);
+ if (!config_file_write_line (config_file, section_name, NULL))
+ return WEECHAT_CONFIG_WRITE_ERROR;
for (ptr_key = gui_keys; ptr_key; ptr_key = ptr_key->next_key)
{
expanded_name = gui_keyboard_get_expanded_name (ptr_key->key);
if (expanded_name)
{
- config_file_write_line (config_file,
- (expanded_name) ?
- expanded_name : ptr_key->key,
- "\"%s\"",
- ptr_key->command);
+ rc = config_file_write_line (config_file,
+ (expanded_name) ?
+ expanded_name : ptr_key->key,
+ "\"%s\"",
+ ptr_key->command);
free (expanded_name);
+ if (!rc)
+ return WEECHAT_CONFIG_WRITE_ERROR;
}
}
+
+ return WEECHAT_CONFIG_WRITE_OK;
}
/*
diff --git a/src/core/wee-string.c b/src/core/wee-string.c
index 8747d9ee5..b213e2d6a 100644
--- a/src/core/wee-string.c
+++ b/src/core/wee-string.c
@@ -1217,28 +1217,34 @@ string_iconv_from_internal (const char *charset, const char *string)
/*
* string_iconv_fprintf: encode to terminal charset, then call fprintf on a file
+ * return 1 if ok, 0 if error
*/
-void
+int
string_iconv_fprintf (FILE *file, const char *data, ...)
{
va_list argptr;
char *buf, *buf2;
-
+ int rc, num_written;
+
buf = malloc (128 * 1024);
if (!buf)
- return;
+ return 0;
va_start (argptr, data);
vsnprintf (buf, 128 * 1024, data, argptr);
va_end (argptr);
buf2 = string_iconv_from_internal (NULL, buf);
- fprintf (file, "%s", (buf2) ? buf2 : buf);
+ num_written = fprintf (file, "%s", (buf2) ? buf2 : buf);
+
+ rc = (num_written == (int)strlen ((buf2) ? buf2 : buf)) ? 1 : 0;
free (buf);
if (buf2)
free (buf2);
+
+ return rc;
}
/*
diff --git a/src/core/wee-string.h b/src/core/wee-string.h
index 477d86e4c..19b0d0bb0 100644
--- a/src/core/wee-string.h
+++ b/src/core/wee-string.h
@@ -54,7 +54,7 @@ extern char *string_iconv (int from_utf8, const char *from_code,
extern char *string_iconv_to_internal (const char *charset, const char *string);
extern char *string_iconv_from_internal (const char *charset,
const char *string);
-extern void string_iconv_fprintf (FILE *file, const char *data, ...);
+extern int string_iconv_fprintf (FILE *file, const char *data, ...);
extern char *string_format_size (unsigned long size);
extern void string_encode_base64 (const char *from, int length, char *to);
extern int string_decode_base64 (const char *from, char *to);
diff --git a/src/plugins/alias/alias-config.c b/src/plugins/alias/alias-config.c
index 4657a7d1c..75719c5c7 100644
--- a/src/plugins/alias/alias-config.c
+++ b/src/plugins/alias/alias-config.c
@@ -144,7 +144,7 @@ alias_config_reload (void *data, struct t_config_file *config_file)
* file in section "cmd" (command)
*/
-void
+int
alias_config_cmd_write_default_cb (void *data,
struct t_config_file *config_file,
const char *section_name)
@@ -152,38 +152,71 @@ alias_config_cmd_write_default_cb (void *data,
/* make C compiler happy */
(void) data;
- weechat_config_write_line (config_file, section_name, NULL);
+ if (!weechat_config_write_line (config_file, section_name, NULL))
+ return WEECHAT_CONFIG_WRITE_ERROR;
+
+ if (!weechat_config_write_line (config_file, "AAWAY", "%s", "\"allserv /away\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ if (!weechat_config_write_line (config_file, "AME", "%s", "\"allchan /me\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ if (!weechat_config_write_line (config_file, "AMSG", "%s", "\"allchan /msg *\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ if (!weechat_config_write_line (config_file, "ANICK", "%s", "\"allserv /nick\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ if (!weechat_config_write_line (config_file, "BYE", "%s", "\"quit\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ if (!weechat_config_write_line (config_file, "C", "%s", "\"buffer clear\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ if (!weechat_config_write_line (config_file, "CL", "%s", "\"buffer clear\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ if (!weechat_config_write_line (config_file, "CLOSE", "%s", "\"buffer close\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ if (!weechat_config_write_line (config_file, "CHAT", "%s", "\"dcc chat\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ if (!weechat_config_write_line (config_file, "EXIT", "%s", "\"quit\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ if (!weechat_config_write_line (config_file, "IG", "%s", "\"ignore\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ if (!weechat_config_write_line (config_file, "J", "%s", "\"join\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ if (!weechat_config_write_line (config_file, "K", "%s", "\"kick\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ if (!weechat_config_write_line (config_file, "KB", "%s", "\"kickban\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ if (!weechat_config_write_line (config_file, "LEAVE", "%s", "\"part\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ if (!weechat_config_write_line (config_file, "M", "%s", "\"msg\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ if (!weechat_config_write_line (config_file, "MUB", "%s", "\"unban *\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ if (!weechat_config_write_line (config_file, "N", "%s", "\"names\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ if (!weechat_config_write_line (config_file, "Q", "%s", "\"query\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ if (!weechat_config_write_line (config_file, "REDRAW", "%s", "\"window refresh\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ if (!weechat_config_write_line (config_file, "SAY", "%s", "\"msg *\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ if (!weechat_config_write_line (config_file, "SIGNOFF", "%s", "\"quit\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ if (!weechat_config_write_line (config_file, "T", "%s", "\"topic\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ if (!weechat_config_write_line (config_file, "UB", "%s", "\"unban\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ if (!weechat_config_write_line (config_file, "V", "%s", "\"command core version\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ if (!weechat_config_write_line (config_file, "W", "%s", "\"who\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ if (!weechat_config_write_line (config_file, "WC", "%s", "\"window merge\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ if (!weechat_config_write_line (config_file, "WI", "%s", "\"whois\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ if (!weechat_config_write_line (config_file, "WII", "%s", "\"whois $1 $1\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
+ if (!weechat_config_write_line (config_file, "WW", "%s", "\"whowas\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
- weechat_config_write_line (config_file, "AAWAY", "%s", "\"allserv /away\"");
- weechat_config_write_line (config_file, "AME", "%s", "\"allchan /me\"");
- weechat_config_write_line (config_file, "AMSG", "%s", "\"allchan /msg *\"");
- weechat_config_write_line (config_file, "ANICK", "%s", "\"allserv /nick\"");
- weechat_config_write_line (config_file, "BYE", "%s", "\"quit\"");
- weechat_config_write_line (config_file, "C", "%s", "\"buffer clear\"");
- weechat_config_write_line (config_file, "CL", "%s", "\"buffer clear\"");
- weechat_config_write_line (config_file, "CLOSE", "%s", "\"buffer close\"");
- weechat_config_write_line (config_file, "CHAT", "%s", "\"dcc chat\"");
- weechat_config_write_line (config_file, "EXIT", "%s", "\"quit\"");
- weechat_config_write_line (config_file, "IG", "%s", "\"ignore\"");
- weechat_config_write_line (config_file, "J", "%s", "\"join\"");
- weechat_config_write_line (config_file, "K", "%s", "\"kick\"");
- weechat_config_write_line (config_file, "KB", "%s", "\"kickban\"");
- weechat_config_write_line (config_file, "LEAVE", "%s", "\"part\"");
- weechat_config_write_line (config_file, "M", "%s", "\"msg\"");
- weechat_config_write_line (config_file, "MUB", "%s", "\"unban *\"");
- weechat_config_write_line (config_file, "N", "%s", "\"names\"");
- weechat_config_write_line (config_file, "Q", "%s", "\"query\"");
- weechat_config_write_line (config_file, "REDRAW", "%s", "\"window refresh\"");
- weechat_config_write_line (config_file, "SAY", "%s", "\"msg *\"");
- weechat_config_write_line (config_file, "SIGNOFF", "%s", "\"quit\"");
- weechat_config_write_line (config_file, "T", "%s", "\"topic\"");
- weechat_config_write_line (config_file, "UB", "%s", "\"unban\"");
- weechat_config_write_line (config_file, "V", "%s", "\"command core version\"");
- weechat_config_write_line (config_file, "W", "%s", "\"who\"");
- weechat_config_write_line (config_file, "WC", "%s", "\"window merge\"");
- weechat_config_write_line (config_file, "WI", "%s", "\"whois\"");
- weechat_config_write_line (config_file, "WII", "%s", "\"whois $1 $1\"");
- weechat_config_write_line (config_file, "WW", "%s", "\"whowas\"");
+ return WEECHAT_CONFIG_WRITE_OK;
}
/*
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index 5665ec60a..404130a80 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -744,15 +744,15 @@ irc_config_ctcp_create_option (void *data, struct t_config_file *config_file,
}
/*
- * irc_config_ignore_read: read ignore option from configuration file
- * return 1 if ok, 0 if error
+ * irc_config_ignore_read_cb: read ignore option from configuration file
+ * return 1 if ok, 0 if error
*/
int
-irc_config_ignore_read (void *data,
- struct t_config_file *config_file,
- struct t_config_section *section,
- const char *option_name, const char *value)
+irc_config_ignore_read_cb (void *data,
+ struct t_config_file *config_file,
+ struct t_config_section *section,
+ const char *option_name, const char *value)
{
char **argv, **argv_eol;
int argc;
@@ -783,30 +783,34 @@ irc_config_ignore_read (void *data,
}
/*
- * irc_config_ignore_write: write ignore section in configuration file
+ * irc_config_ignore_write_cb: write ignore section in configuration file
*/
-void
-irc_config_ignore_write (void *data, struct t_config_file *config_file,
- const char *section_name)
+int
+irc_config_ignore_write_cb (void *data, struct t_config_file *config_file,
+ const char *section_name)
{
struct t_irc_ignore *ptr_ignore;
/* make C compiler happy */
(void) data;
- weechat_config_write_line (config_file, section_name, NULL);
+ if (!weechat_config_write_line (config_file, section_name, NULL))
+ return WEECHAT_CONFIG_WRITE_ERROR;
for (ptr_ignore = irc_ignore_list; ptr_ignore;
ptr_ignore = ptr_ignore->next_ignore)
{
- weechat_config_write_line (config_file,
- "ignore",
- "%s;%s;%s",
- (ptr_ignore->server) ? ptr_ignore->server : "*",
- (ptr_ignore->channel) ? ptr_ignore->channel : "*",
- ptr_ignore->mask);
+ if (!weechat_config_write_line (config_file,
+ "ignore",
+ "%s;%s;%s",
+ (ptr_ignore->server) ? ptr_ignore->server : "*",
+ (ptr_ignore->channel) ? ptr_ignore->channel : "*",
+ ptr_ignore->mask))
+ return WEECHAT_CONFIG_WRITE_ERROR;
}
+
+ return WEECHAT_CONFIG_WRITE_OK;
}
/*
@@ -814,7 +818,7 @@ irc_config_ignore_write (void *data, struct t_config_file *config_file,
* configuration file
*/
-void
+int
irc_config_server_write_default_cb (void *data,
struct t_config_file *config_file,
const char *section_name)
@@ -825,7 +829,8 @@ irc_config_server_write_default_cb (void *data,
/* make C compiler happy */
(void) data;
- weechat_config_write_line (config_file, section_name, NULL);
+ if (!weechat_config_write_line (config_file, section_name, NULL))
+ return WEECHAT_CONFIG_WRITE_ERROR;
for (i = 0; i < IRC_SERVER_NUM_OPTIONS; i++)
{
@@ -835,17 +840,21 @@ irc_config_server_write_default_cb (void *data,
switch (i)
{
case IRC_SERVER_OPTION_ADDRESSES:
- weechat_config_write_line (config_file,
- option_name,
- "%s", "\"chat.freenode.net/6667\"");
+ if (!weechat_config_write_line (config_file,
+ option_name,
+ "%s", "\"chat.freenode.net/6667\""))
+ return WEECHAT_CONFIG_WRITE_ERROR;
break;
default:
- weechat_config_write_line (config_file,
- option_name,
- WEECHAT_CONFIG_OPTION_NULL);
+ if (!weechat_config_write_line (config_file,
+ option_name,
+ WEECHAT_CONFIG_OPTION_NULL))
+ return WEECHAT_CONFIG_WRITE_ERROR;
break;
}
}
+
+ return WEECHAT_CONFIG_WRITE_OK;
}
/*
@@ -1251,7 +1260,7 @@ irc_config_server_read_cb (void *data, struct t_config_file *config_file,
* irc_config_server_write_cb: write server section in configuration file
*/
-void
+int
irc_config_server_write_cb (void *data, struct t_config_file *config_file,
const char *section_name)
{
@@ -1261,7 +1270,8 @@ irc_config_server_write_cb (void *data, struct t_config_file *config_file,
/* make C compiler happy */
(void) data;
- weechat_config_write_line (config_file, section_name, NULL);
+ if (!weechat_config_write_line (config_file, section_name, NULL))
+ return WEECHAT_CONFIG_WRITE_ERROR;
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
@@ -1270,11 +1280,14 @@ irc_config_server_write_cb (void *data, struct t_config_file *config_file,
{
for (i = 0; i < IRC_SERVER_NUM_OPTIONS; i++)
{
- weechat_config_write_option (config_file,
- ptr_server->options[i]);
+ if (!weechat_config_write_option (config_file,
+ ptr_server->options[i]))
+ return WEECHAT_CONFIG_WRITE_ERROR;
}
}
}
+
+ return WEECHAT_CONFIG_WRITE_OK;
}
/*
@@ -1741,9 +1754,9 @@ irc_config_init ()
/* ignore */
ptr_section = weechat_config_new_section (irc_config_file, "ignore",
0, 0,
- &irc_config_ignore_read, NULL,
- &irc_config_ignore_write, NULL,
- &irc_config_ignore_write, NULL,
+ &irc_config_ignore_read_cb, NULL,
+ &irc_config_ignore_write_cb, NULL,
+ &irc_config_ignore_write_cb, NULL,
NULL, NULL, NULL, NULL);
if (!ptr_section)
{
diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c
index 3c124282b..1a0de8ee6 100644
--- a/src/plugins/scripts/lua/weechat-lua-api.c
+++ b/src/plugins/scripts/lua/weechat-lua-api.c
@@ -1345,14 +1345,14 @@ weechat_lua_api_config_read_cb (void *data,
* weechat_lua_api_config_section_write_cb: callback for writing section
*/
-void
+int
weechat_lua_api_config_section_write_cb (void *data,
struct t_config_file *config_file,
const char *section_name)
{
struct t_script_callback *script_callback;
char *lua_argv[4], empty_arg[1] = { '\0' };
- int *rc;
+ int *rc, ret;
script_callback = (struct t_script_callback *)data;
@@ -1368,11 +1368,20 @@ weechat_lua_api_config_section_write_cb (void *data,
script_callback->function,
lua_argv);
- if (rc)
+ if (!rc)
+ ret = WEECHAT_CONFIG_WRITE_ERROR;
+ else
+ {
+ ret = *rc;
free (rc);
+ }
if (lua_argv[1])
free (lua_argv[1]);
+
+ return ret;
}
+
+ return WEECHAT_CONFIG_WRITE_ERROR;
}
/*
@@ -1380,14 +1389,14 @@ weechat_lua_api_config_section_write_cb (void *data,
* default values for section
*/
-void
+int
weechat_lua_api_config_section_write_default_cb (void *data,
struct t_config_file *config_file,
const char *section_name)
{
struct t_script_callback *script_callback;
char *lua_argv[4], empty_arg[1] = { '\0' };
- int *rc;
+ int *rc, ret;
script_callback = (struct t_script_callback *)data;
@@ -1403,11 +1412,20 @@ weechat_lua_api_config_section_write_default_cb (void *data,
script_callback->function,
lua_argv);
- if (rc)
+ if (!rc)
+ ret = WEECHAT_CONFIG_WRITE_ERROR;
+ else
+ {
+ ret = *rc;
free (rc);
+ }
if (lua_argv[1])
free (lua_argv[1]);
+
+ return ret;
}
+
+ return WEECHAT_CONFIG_WRITE_ERROR;
}
/*
diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c
index 9d48b32c0..b4e08ad42 100644
--- a/src/plugins/scripts/perl/weechat-perl-api.c
+++ b/src/plugins/scripts/perl/weechat-perl-api.c
@@ -1119,14 +1119,14 @@ weechat_perl_api_config_section_read_cb (void *data,
* weechat_perl_api_config_section_write_cb: callback for writing section
*/
-void
+int
weechat_perl_api_config_section_write_cb (void *data,
struct t_config_file *config_file,
const char *section_name)
{
struct t_script_callback *script_callback;
char *perl_argv[4], empty_arg[1] = { '\0' };
- int *rc;
+ int *rc, ret;
script_callback = (struct t_script_callback *)data;
@@ -1142,11 +1142,20 @@ weechat_perl_api_config_section_write_cb (void *data,
script_callback->function,
perl_argv);
- if (rc)
+ if (!rc)
+ ret = WEECHAT_CONFIG_WRITE_ERROR;
+ else
+ {
+ ret = *rc;
free (rc);
+ }
if (perl_argv[1])
free (perl_argv[1]);
+
+ return ret;
}
+
+ return WEECHAT_CONFIG_WRITE_ERROR;
}
/*
@@ -1154,17 +1163,17 @@ weechat_perl_api_config_section_write_cb (void *data,
* default values for section
*/
-void
+int
weechat_perl_api_config_section_write_default_cb (void *data,
struct t_config_file *config_file,
const char *section_name)
{
struct t_script_callback *script_callback;
char *perl_argv[4], empty_arg[1] = { '\0' };
- int *rc;
+ int *rc, ret;
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
@@ -1176,12 +1185,21 @@ weechat_perl_api_config_section_write_default_cb (void *data,
WEECHAT_SCRIPT_EXEC_INT,
script_callback->function,
perl_argv);
-
- if (rc)
+
+ if (!rc)
+ ret = WEECHAT_CONFIG_WRITE_ERROR;
+ else
+ {
+ ret = *rc;
free (rc);
+ }
if (perl_argv[1])
free (perl_argv[1]);
+
+ return ret;
}
+
+ return WEECHAT_CONFIG_WRITE_ERROR;
}
/*
diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c
index 8c98a99b4..dd7ec0f0a 100644
--- a/src/plugins/scripts/python/weechat-python-api.c
+++ b/src/plugins/scripts/python/weechat-python-api.c
@@ -1184,14 +1184,14 @@ weechat_python_api_config_read_cb (void *data,
* weechat_python_api_config_section_write_cb: callback for writing section
*/
-void
+int
weechat_python_api_config_section_write_cb (void *data,
struct t_config_file *config_file,
const char *section_name)
{
struct t_script_callback *script_callback;
char *python_argv[4], empty_arg[1] = { '\0' };
- int *rc;
+ int *rc, ret;
script_callback = (struct t_script_callback *)data;
@@ -1207,11 +1207,20 @@ weechat_python_api_config_section_write_cb (void *data,
script_callback->function,
python_argv);
- if (rc)
+ if (!rc)
+ ret = WEECHAT_CONFIG_WRITE_ERROR;
+ else
+ {
+ ret = *rc;
free (rc);
+ }
if (python_argv[1])
free (python_argv[1]);
+
+ return ret;
}
+
+ return WEECHAT_CONFIG_WRITE_ERROR;
}
/*
@@ -1219,14 +1228,14 @@ weechat_python_api_config_section_write_cb (void *data,
* default values for section
*/
-void
+int
weechat_python_api_config_section_write_default_cb (void *data,
struct t_config_file *config_file,
const char *section_name)
{
struct t_script_callback *script_callback;
char *python_argv[4], empty_arg[1] = { '\0' };
- int *rc;
+ int *rc, ret;
script_callback = (struct t_script_callback *)data;
@@ -1242,11 +1251,20 @@ weechat_python_api_config_section_write_default_cb (void *data,
script_callback->function,
python_argv);
- if (rc)
+ if (!rc)
+ ret = WEECHAT_CONFIG_WRITE_ERROR;
+ else
+ {
+ ret = *rc;
free (rc);
+ }
if (python_argv[1])
free (python_argv[1]);
+
+ return ret;
}
+
+ return WEECHAT_CONFIG_WRITE_ERROR;
}
/*
diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c
index 5ee74aa54..0fd26943c 100644
--- a/src/plugins/scripts/ruby/weechat-ruby-api.c
+++ b/src/plugins/scripts/ruby/weechat-ruby-api.c
@@ -1353,14 +1353,14 @@ weechat_ruby_api_config_read_cb (void *data,
* weechat_ruby_api_config_section_write_cb: callback for writing section
*/
-void
+int
weechat_ruby_api_config_section_write_cb (void *data,
struct t_config_file *config_file,
const char *section_name)
{
struct t_script_callback *script_callback;
char *ruby_argv[4], empty_arg[1] = { '\0' };
- int *rc;
+ int *rc, ret;
script_callback = (struct t_script_callback *)data;
@@ -1376,11 +1376,20 @@ weechat_ruby_api_config_section_write_cb (void *data,
script_callback->function,
ruby_argv);
- if (rc)
+ if (!rc)
+ ret = WEECHAT_CONFIG_WRITE_ERROR;
+ else
+ {
+ ret = *rc;
free (rc);
+ }
if (ruby_argv[1])
free (ruby_argv[1]);
+
+ return ret;
}
+
+ return WEECHAT_CONFIG_WRITE_ERROR;
}
/*
@@ -1388,17 +1397,17 @@ weechat_ruby_api_config_section_write_cb (void *data,
* default values for section
*/
-void
+int
weechat_ruby_api_config_section_write_default_cb (void *data,
struct t_config_file *config_file,
const char *section_name)
{
struct t_script_callback *script_callback;
char *ruby_argv[4], empty_arg[1] = { '\0' };
- int *rc;
+ int *rc, ret;
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
@@ -1411,11 +1420,20 @@ weechat_ruby_api_config_section_write_default_cb (void *data,
script_callback->function,
ruby_argv);
- if (rc)
+ if (!rc)
+ ret = WEECHAT_CONFIG_WRITE_ERROR;
+ else
+ {
+ ret = *rc;
free (rc);
+ }
if (ruby_argv[1])
free (ruby_argv[1]);
+
+ return ret;
}
+
+ return WEECHAT_CONFIG_WRITE_ERROR;
}
/*
diff --git a/src/plugins/scripts/script-api.c b/src/plugins/scripts/script-api.c
index 879e5bb97..c5e2ef2a4 100644
--- a/src/plugins/scripts/script-api.c
+++ b/src/plugins/scripts/script-api.c
@@ -108,14 +108,14 @@ script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
const char *value),
const char *function_read,
const char *data_read,
- void (*callback_write)(void *data,
- struct t_config_file *config_file,
- const char *section_name),
+ int (*callback_write)(void *data,
+ struct t_config_file *config_file,
+ const char *section_name),
const char *function_write,
const char *data_write,
- void (*callback_write_default)(void *data,
- struct t_config_file *config_file,
- const char *section_name),
+ int (*callback_write_default)(void *data,
+ struct t_config_file *config_file,
+ const char *section_name),
const char *function_write_default,
const char *data_write_default,
int (*callback_create_option)(void *data,
diff --git a/src/plugins/scripts/script-api.h b/src/plugins/scripts/script-api.h
index 2f99b819e..fab902e2a 100644
--- a/src/plugins/scripts/script-api.h
+++ b/src/plugins/scripts/script-api.h
@@ -41,12 +41,12 @@ extern struct t_config_section *script_api_config_new_section (struct t_weechat_
const char *value),
const char *function_read,
const char *data_read,
- void (*callback_write)(void *data,
+ int (*callback_write)(void *data,
struct t_config_file *config_file,
const char *section_name),
const char *function_write,
const char *data_write,
- void (*callback_write_default)(void *data,
+ int (*callback_write_default)(void *data,
struct t_config_file *config_file,
const char *section_name),
const char *function_write_default,
diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c
index a9d84a962..8f34c5cb9 100644
--- a/src/plugins/scripts/tcl/weechat-tcl-api.c
+++ b/src/plugins/scripts/tcl/weechat-tcl-api.c
@@ -1352,34 +1352,43 @@ weechat_tcl_api_config_section_read_cb (void *data,
* weechat_tcl_api_config_section_write_cb: callback for writing section
*/
-void
+int
weechat_tcl_api_config_section_write_cb (void *data,
struct t_config_file *config_file,
const char *section_name)
{
struct t_script_callback *script_callback;
char *tcl_argv[4], empty_arg[1] = { '\0' };
- int *rc;
+ int *rc, ret;
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
tcl_argv[1] = script_ptr2str (config_file);
tcl_argv[2] = (section_name) ? (char *)section_name : empty_arg;
tcl_argv[3] = NULL;
-
+
rc = (int *) weechat_tcl_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- tcl_argv);
+ WEECHAT_SCRIPT_EXEC_INT,
+ script_callback->function,
+ tcl_argv);
- if (rc)
+ if (!rc)
+ ret = WEECHAT_CONFIG_WRITE_ERROR;
+ else
+ {
+ ret = *rc;
free (rc);
+ }
if (tcl_argv[1])
free (tcl_argv[1]);
+
+ return ret;
}
+
+ return WEECHAT_CONFIG_WRITE_ERROR;
}
/*
@@ -1387,17 +1396,17 @@ weechat_tcl_api_config_section_write_cb (void *data,
* default values for section
*/
-void
+int
weechat_tcl_api_config_section_write_default_cb (void *data,
struct t_config_file *config_file,
const char *section_name)
{
struct t_script_callback *script_callback;
char *tcl_argv[4], empty_arg[1] = { '\0' };
- int *rc;
+ int *rc, ret;
script_callback = (struct t_script_callback *)data;
-
+
if (script_callback && script_callback->function && script_callback->function[0])
{
tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
@@ -1406,15 +1415,24 @@ weechat_tcl_api_config_section_write_default_cb (void *data,
tcl_argv[3] = NULL;
rc = (int *) weechat_tcl_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- tcl_argv);
+ WEECHAT_SCRIPT_EXEC_INT,
+ script_callback->function,
+ tcl_argv);
- if (rc)
+ if (!rc)
+ ret = WEECHAT_CONFIG_WRITE_ERROR;
+ else
+ {
+ ret = *rc;
free (rc);
+ }
if (tcl_argv[1])
free (tcl_argv[1]);
+
+ return ret;
}
+
+ return WEECHAT_CONFIG_WRITE_ERROR;
}
/*
@@ -1445,9 +1463,9 @@ weechat_tcl_api_config_section_create_option_cb (void *data,
tcl_argv[5] = NULL;
rc = (int *) weechat_tcl_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- tcl_argv);
+ WEECHAT_SCRIPT_EXEC_INT,
+ script_callback->function,
+ tcl_argv);
if (!rc)
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
@@ -1493,9 +1511,9 @@ weechat_tcl_api_config_section_delete_option_cb (void *data,
tcl_argv[4] = NULL;
rc = (int *) weechat_tcl_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- tcl_argv);
+ WEECHAT_SCRIPT_EXEC_INT,
+ script_callback->function,
+ tcl_argv);
if (!rc)
ret = WEECHAT_CONFIG_OPTION_UNSET_ERROR;
@@ -1654,9 +1672,9 @@ weechat_tcl_api_config_option_check_value_cb (void *data,
tcl_argv[3] = NULL;
rc = (int *) weechat_tcl_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- tcl_argv);
+ WEECHAT_SCRIPT_EXEC_INT,
+ script_callback->function,
+ tcl_argv);
if (!rc)
ret = 0;
@@ -1695,9 +1713,9 @@ weechat_tcl_api_config_option_change_cb (void *data,
tcl_argv[2] = NULL;
rc = (int *) weechat_tcl_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- tcl_argv);
+ WEECHAT_SCRIPT_EXEC_INT,
+ script_callback->function,
+ tcl_argv);
if (tcl_argv[1])
free (tcl_argv[1]);
@@ -1728,9 +1746,9 @@ weechat_tcl_api_config_option_delete_cb (void *data,
tcl_argv[2] = NULL;
rc = (int *) weechat_tcl_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_INT,
- script_callback->function,
- tcl_argv);
+ WEECHAT_SCRIPT_EXEC_INT,
+ script_callback->function,
+ tcl_argv);
if (tcl_argv[1])
free (tcl_argv[1]);
diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h
index 1600f886d..43e70ff8b 100644
--- a/src/plugins/weechat-plugin.h
+++ b/src/plugins/weechat-plugin.h
@@ -248,13 +248,13 @@ struct t_weechat_plugin
const char *option_name,
const char *value),
void *callback_read_data,
- void (*callback_write)(void *data,
- struct t_config_file *config_file,
- const char *section_name),
+ int (*callback_write)(void *data,
+ struct t_config_file *config_file,
+ const char *section_name),
void *callback_write_data,
- void (*callback_write_default)(void *data,
- struct t_config_file *config_file,
- const char *section_name),
+ int (*callback_write_default)(void *data,
+ struct t_config_file *config_file,
+ const char *section_name),
void *callback_write_default_data,
int (*callback_create_option)(void *data,
struct t_config_file *config_file,
@@ -325,11 +325,11 @@ struct t_weechat_plugin
const char *(*config_string_default) (struct t_config_option *option);
const char *(*config_color) (struct t_config_option *option);
const char *(*config_color_default) (struct t_config_option *option);
- void (*config_write_option) (struct t_config_file *config_file,
- struct t_config_option *option);
- void (*config_write_line) (struct t_config_file *config_file,
- const char *option_name,
- const char *value, ...);
+ int (*config_write_option) (struct t_config_file *config_file,
+ struct t_config_option *option);
+ int (*config_write_line) (struct t_config_file *config_file,
+ const char *option_name,
+ const char *value, ...);
int (*config_write) (struct t_config_file *config_file);
int (*config_read) (struct t_config_file *config_file);
int (*config_reload) (struct t_config_file *config_file);