diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2008-11-07 18:27:16 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2008-11-07 18:27:16 +0100 |
commit | 67d8312f461b74b747088b6661a21426ab2a01e6 (patch) | |
tree | 2f797a4e048205a1eb03b9ddbf82166e26046940 /src | |
parent | bc5bb29970ee029ee646b8805b83b3a9d71a2ef8 (diff) | |
download | weechat-67d8312f461b74b747088b6661a21426ab2a01e6.zip |
Update developer guide (add 50% of new C API functions)
Diffstat (limited to 'src')
-rw-r--r-- | src/core/wee-config-file.c | 23 | ||||
-rw-r--r-- | src/core/wee-config-file.h | 2 | ||||
-rw-r--r-- | src/plugins/scripts/lua/weechat-lua-api.c | 7 | ||||
-rw-r--r-- | src/plugins/scripts/perl/weechat-perl-api.c | 6 | ||||
-rw-r--r-- | src/plugins/scripts/python/weechat-python-api.c | 7 | ||||
-rw-r--r-- | src/plugins/scripts/ruby/weechat-ruby-api.c | 7 | ||||
-rw-r--r-- | src/plugins/scripts/tcl/weechat-tcl-api.c | 5 | ||||
-rw-r--r-- | src/plugins/weechat-plugin.h | 14 |
8 files changed, 33 insertions, 38 deletions
diff --git a/src/core/wee-config-file.c b/src/core/wee-config-file.c index e18a22440..e478e8114 100644 --- a/src/core/wee-config-file.c +++ b/src/core/wee-config-file.c @@ -804,14 +804,10 @@ config_file_string_to_boolean (const char *text) /* * config_file_option_reset: set default value for an option - * return one of these values: - * WEECHAT_CONFIG_OPTION_SET_OK_CHANGED - * WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE - * WEECHAT_CONFIG_OPTION_SET_ERROR - * - * 2 if ok (value changed) - * 1 if ok (value is the same) - * 0 if failed + * return one of these values: + * WEECHAT_CONFIG_OPTION_SET_OK_CHANGED + * WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE + * WEECHAT_CONFIG_OPTION_SET_ERROR */ int @@ -1447,16 +1443,13 @@ config_file_option_string (struct t_config_option *option) * config_file_option_color: return color value of an option */ -int +char * config_file_option_color (struct t_config_option *option) { if (!option) - return 0; - - if (option->type == CONFIG_OPTION_TYPE_COLOR) - return CONFIG_COLOR(option); - else - return 0; + return NULL; + + return gui_color_get_name (CONFIG_COLOR(option)); } /* diff --git a/src/core/wee-config-file.h b/src/core/wee-config-file.h index ba1c647e5..f8376a669 100644 --- a/src/core/wee-config-file.h +++ b/src/core/wee-config-file.h @@ -229,7 +229,7 @@ extern int config_file_option_unset_with_string (const char *option_name); extern int config_file_option_boolean (struct t_config_option *option); extern int config_file_option_integer (struct t_config_option *option); extern char *config_file_option_string (struct t_config_option *option); -extern int config_file_option_color (struct t_config_option *option); +extern char *config_file_option_color (struct t_config_option *option); extern void config_file_write_line (struct t_config_file *config_file, const char *option_name, const char *value, ...); diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c index 1c5767727..ce608643a 100644 --- a/src/plugins/scripts/lua/weechat-lua-api.c +++ b/src/plugins/scripts/lua/weechat-lua-api.c @@ -1886,7 +1886,8 @@ static int weechat_lua_api_config_color (lua_State *L) { const char *option; - int n, value; + char *result; + int n; /* make C compiler happy */ (void) L; @@ -1909,9 +1910,9 @@ weechat_lua_api_config_color (lua_State *L) option = lua_tostring (lua_current_interpreter, -1); - value = weechat_config_color (script_str2ptr (option)); + result = weechat_config_color (script_str2ptr (option)); - LUA_RETURN_INT(value); + LUA_RETURN_STRING(result); } /* diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c index 68cdcf6a6..3c5fc77cb 100644 --- a/src/plugins/scripts/perl/weechat-perl-api.c +++ b/src/plugins/scripts/perl/weechat-perl-api.c @@ -1583,7 +1583,7 @@ static XS (XS_weechat_api_config_string) static XS (XS_weechat_api_config_color) { - int value; + char *result; dXSARGS; /* make C compiler happy */ @@ -1601,9 +1601,9 @@ static XS (XS_weechat_api_config_color) PERL_RETURN_INT(0); } - value = weechat_config_color (script_str2ptr (SvPV (ST (0), PL_na))); /* option */ + result = weechat_config_color (script_str2ptr (SvPV (ST (0), PL_na))); /* option */ - PERL_RETURN_INT(value); + PERL_RETURN_STRING(result); } /* diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c index 4b60ea0d7..ee989cf6e 100644 --- a/src/plugins/scripts/python/weechat-python-api.c +++ b/src/plugins/scripts/python/weechat-python-api.c @@ -1672,8 +1672,7 @@ weechat_python_api_config_string (PyObject *self, PyObject *args) static PyObject * weechat_python_api_config_color (PyObject *self, PyObject *args) { - char *option; - int value; + char *option, *result; /* make C compiler happy */ (void) self; @@ -1692,9 +1691,9 @@ weechat_python_api_config_color (PyObject *self, PyObject *args) PYTHON_RETURN_INT(0); } - value = weechat_config_color (script_str2ptr (option)); + result = weechat_config_color (script_str2ptr (option)); - PYTHON_RETURN_INT(value); + PYTHON_RETURN_STRING(result); } /* diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c index 7758467ef..55cc44a6e 100644 --- a/src/plugins/scripts/ruby/weechat-ruby-api.c +++ b/src/plugins/scripts/ruby/weechat-ruby-api.c @@ -1924,8 +1924,7 @@ weechat_ruby_api_config_string (VALUE class, VALUE option) static VALUE weechat_ruby_api_config_color (VALUE class, VALUE option) { - char *c_option; - int value; + char *c_option, *result; /* make C compiler happy */ (void) class; @@ -1948,9 +1947,9 @@ weechat_ruby_api_config_color (VALUE class, VALUE option) c_option = STR2CSTR (option); - value = weechat_config_color (script_str2ptr (c_option)); + result = weechat_config_color (script_str2ptr (c_option)); - RUBY_RETURN_INT(value); + RUBY_RETURN_STRING(result); } /* diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c index 1eae1ae3e..7c0f4da6c 100644 --- a/src/plugins/scripts/tcl/weechat-tcl-api.c +++ b/src/plugins/scripts/tcl/weechat-tcl-api.c @@ -1855,7 +1855,8 @@ weechat_tcl_api_config_color (ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { Tcl_Obj *objp; - int result, i; + char *result; + int i; /* make C compiler happy */ (void) clientData; @@ -1874,7 +1875,7 @@ weechat_tcl_api_config_color (ClientData clientData, Tcl_Interp *interp, result = weechat_config_color (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */ - TCL_RETURN_INT(result); + TCL_RETURN_STRING(result); } /* diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index 9dafd4427..9a1f8c481 100644 --- a/src/plugins/weechat-plugin.h +++ b/src/plugins/weechat-plugin.h @@ -184,7 +184,7 @@ struct t_weechat_plugin long (*timeval_diff) (struct timeval *tv1, struct timeval *tv2); void (*timeval_add) (struct timeval *tv, long interval); - /* sorted list */ + /* sorted lists */ struct t_weelist *(*list_new) (); struct t_weelist_item *(*list_add) (struct t_weelist *weelist, const char *data, @@ -244,10 +244,12 @@ struct t_weechat_plugin const char *section_name); struct t_config_option *(*config_new_option) (struct t_config_file *config_file, struct t_config_section *section, - const char *name, const char *type, + const char *name, + const char *type, const char *description, const char *string_values, - int min, int max, + int min, + int max, const char *default_value, const char *value, int (*callback_check_value)(void *data, @@ -286,7 +288,7 @@ struct t_weechat_plugin int (*config_boolean) (struct t_config_option *option); int (*config_integer) (struct t_config_option *option); char *(*config_string) (struct t_config_option *option); - int (*config_color) (struct t_config_option *option); + char *(*config_color) (struct t_config_option *option); void (*config_write_line) (struct t_config_file *config_file, const char *option_name, const char *value, ...); @@ -826,8 +828,6 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin); #define weechat_printf(__buffer, __message, __argz...) \ weechat_plugin->printf_date_tags(__buffer, 0, NULL, __message, \ ##__argz) -#define weechat_printf_y(__buffer, __y, __message, __argz...) \ - weechat_plugin->printf_y(__buffer, __y, __message, ##__argz) #define weechat_printf_date(__buffer, __date, __message, __argz...) \ weechat_plugin->printf_date_tags(__buffer, __date, NULL, \ __message, ##__argz) @@ -838,6 +838,8 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin); __argz...) \ weechat_plugin->printf_date_tags(__buffer, __date, __tags, \ __message, ##__argz) +#define weechat_printf_y(__buffer, __y, __message, __argz...) \ + weechat_plugin->printf_y(__buffer, __y, __message, ##__argz) #define weechat_log_printf(__message, __argz...) \ weechat_plugin->log_printf(__message, ##__argz) |