diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/wee-command.c | 3 | ||||
-rw-r--r-- | src/gui/curses/gui-curses-status.c | 3 | ||||
-rw-r--r-- | src/gui/gui-bar-item.c | 8 | ||||
-rw-r--r-- | src/gui/gui-buffer.c | 13 | ||||
-rw-r--r-- | src/gui/gui-layout.c | 18 | ||||
-rw-r--r-- | src/plugins/charset/charset.c | 7 | ||||
-rw-r--r-- | src/plugins/logger/logger.c | 2 | ||||
-rw-r--r-- | src/plugins/notify/notify.c | 7 | ||||
-rw-r--r-- | src/plugins/plugin.c | 14 | ||||
-rw-r--r-- | src/plugins/plugin.h | 3 | ||||
-rw-r--r-- | src/plugins/scripts/lua/weechat-lua-api.c | 39 | ||||
-rw-r--r-- | src/plugins/scripts/perl/weechat-perl-api.c | 450 | ||||
-rw-r--r-- | src/plugins/scripts/python/weechat-python-api.c | 33 | ||||
-rw-r--r-- | src/plugins/scripts/ruby/weechat-ruby-api.c | 37 | ||||
-rw-r--r-- | src/plugins/scripts/tcl/weechat-tcl-api.c | 36 | ||||
-rw-r--r-- | src/plugins/weechat-plugin.h | 7 |
16 files changed, 435 insertions, 245 deletions
diff --git a/src/core/wee-command.c b/src/core/wee-command.c index 20b46bcce..f9a2037c6 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -502,8 +502,7 @@ command_buffer (void *data, struct t_gui_buffer *buffer, ptr_buffer->number, GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS), GUI_COLOR(GUI_COLOR_CHAT), - (ptr_buffer->plugin) ? - ptr_buffer->plugin->name : "core", + plugin_get_name (ptr_buffer->plugin), ptr_buffer->name); } diff --git a/src/gui/curses/gui-curses-status.c b/src/gui/curses/gui-curses-status.c index fe2042270..ad9bfde11 100644 --- a/src/gui/curses/gui-curses-status.c +++ b/src/gui/curses/gui-curses-status.c @@ -81,8 +81,7 @@ gui_status_draw (int erase) gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, GUI_COLOR_STATUS); wprintw (GUI_CURSES(ptr_win)->win_status, "%s", - (ptr_win->buffer->plugin) ? - ptr_win->buffer->plugin->name : "core"); + plugin_get_name (ptr_win->buffer->plugin)); gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, GUI_COLOR_STATUS_DELIMITERS); wprintw (GUI_CURSES(ptr_win)->win_status, "] "); diff --git a/src/gui/gui-bar-item.c b/src/gui/gui-bar-item.c index f0eebe196..f2c2dcea3 100644 --- a/src/gui/gui-bar-item.c +++ b/src/gui/gui-bar-item.c @@ -742,6 +742,8 @@ gui_bar_item_default_buffer_plugin (void *data, struct t_gui_bar_item *item, struct t_gui_window *window, int max_width, int max_height) { + char *plugin_name; + /* make C compiler happy */ (void) data; (void) item; @@ -750,9 +752,9 @@ gui_bar_item_default_buffer_plugin (void *data, struct t_gui_bar_item *item, if (!window) window = gui_current_window; - - return (window->buffer->plugin) ? - strdup (window->buffer->plugin->name) : strdup ("core"); + + plugin_name = plugin_get_name (window->buffer->plugin); + return (plugin_name) ? strdup (plugin_name) : strdup (""); } /* diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index c8c78e4e5..adfc26f01 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -149,7 +149,7 @@ gui_buffer_new (struct t_weechat_plugin *plugin, if (!name) return NULL; - if (gui_buffer_search_by_name ((plugin) ? plugin->name : "core", name)) + if (gui_buffer_search_by_name (plugin_get_name (plugin), name)) { gui_chat_printf (NULL, _("%sError: a buffer with same name (%s) already " @@ -167,7 +167,7 @@ gui_buffer_new (struct t_weechat_plugin *plugin, new_buffer->plugin = plugin; new_buffer->plugin_name_for_upgrade = NULL; /* number will be set later (when inserting buffer in list) */ - new_buffer->layout_number = gui_layout_buffer_get_number ((plugin) ? plugin->name : "core", + new_buffer->layout_number = gui_layout_buffer_get_number (plugin_get_name (plugin), name); new_buffer->name = strdup (name); new_buffer->type = GUI_BUFFER_TYPE_FORMATED; @@ -354,7 +354,7 @@ gui_buffer_get_string (struct t_gui_buffer *buffer, const char *property) if (buffer && property) { if (string_strcasecmp (property, "plugin") == 0) - return (buffer->plugin) ? buffer->plugin->name : NULL; + return plugin_get_name (buffer->plugin); else if (string_strcasecmp (property, "name") == 0) return buffer->name; else if (string_strcasecmp (property, "title") == 0) @@ -773,7 +773,7 @@ gui_buffer_search_by_name (const char *plugin, const char *name) } else { - if (strcmp (plugin, "core") != 0) + if (strcmp (plugin, PLUGIN_CORE) != 0) plugin_match = 0; } } @@ -818,7 +818,7 @@ gui_buffer_search_by_partial_name (const char *plugin, const char *name) } else { - if (strcmp (plugin, "core") != 0) + if (strcmp (plugin, PLUGIN_CORE) != 0) plugin_match = 0; } } @@ -1256,8 +1256,7 @@ gui_buffer_add_to_infolist (struct t_infolist *infolist, if (!infolist_new_var_pointer (ptr_item, "plugin", buffer->plugin)) return 0; if (!infolist_new_var_string (ptr_item, "plugin_name", - (buffer->plugin) ? - buffer->plugin->name : NULL)) + plugin_get_name (buffer->plugin))) return 0; if (!infolist_new_var_integer (ptr_item, "number", buffer->number)) return 0; diff --git a/src/gui/gui-layout.c b/src/gui/gui-layout.c index 33044f066..ad89f1f56 100644 --- a/src/gui/gui-layout.c +++ b/src/gui/gui-layout.c @@ -148,8 +148,7 @@ gui_layout_buffer_save () for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer) { - gui_layout_buffer_add ((ptr_buffer->plugin) ? - ptr_buffer->plugin->name : "core", + gui_layout_buffer_add (plugin_get_name (ptr_buffer->plugin), ptr_buffer->name, ptr_buffer->number); } @@ -187,14 +186,14 @@ void gui_layout_buffer_apply () { struct t_gui_buffer *ptr_buffer; - char *plugin_core = "core", *plugin_name; + char *plugin_name; if (gui_layout_buffers) { for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer) { - plugin_name = (ptr_buffer->plugin) ? ptr_buffer->plugin->name : plugin_core; + plugin_name = plugin_get_name (ptr_buffer->plugin); ptr_buffer->layout_number = gui_layout_buffer_get_number (plugin_name, ptr_buffer->name); if ((ptr_buffer->layout_number > 0) @@ -370,8 +369,7 @@ gui_layout_window_save_tree (struct t_gui_layout_window *parent_layout, layout_window = gui_layout_window_add (internal_id++, parent_layout, 0, 0, - (tree->window->buffer->plugin) ? - tree->window->buffer->plugin->name : "core", + plugin_get_name (tree->window->buffer->plugin), tree->window->buffer->name); } else @@ -412,9 +410,9 @@ void gui_layout_window_check_buffer (struct t_gui_buffer *buffer) { struct t_gui_window *ptr_win; - char *plugin_core = "core", *plugin_name; + char *plugin_name; - plugin_name = (buffer->plugin) ? buffer->plugin->name : plugin_core; + plugin_name = plugin_get_name (buffer->plugin); for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) { @@ -440,7 +438,7 @@ gui_layout_window_check_all_buffers () { struct t_gui_window *ptr_win; struct t_gui_buffer *ptr_buffer; - char *plugin_core = "core", *plugin_name; + char *plugin_name; for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) { @@ -449,7 +447,7 @@ gui_layout_window_check_all_buffers () for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer) { - plugin_name = (ptr_buffer->plugin) ? ptr_buffer->plugin->name : plugin_core; + plugin_name = plugin_get_name (ptr_buffer->plugin); if ((strcmp (ptr_win->layout_plugin_name, plugin_name) == 0) && (strcmp (ptr_win->layout_buffer_name, ptr_buffer->name) == 0)) diff --git a/src/plugins/charset/charset.c b/src/plugins/charset/charset.c index a92f28110..b76d1dc5e 100644 --- a/src/plugins/charset/charset.c +++ b/src/plugins/charset/charset.c @@ -443,15 +443,12 @@ charset_command_cb (void *data, struct t_gui_buffer *buffer, int argc, plugin_name = weechat_buffer_get_string (buffer, "plugin"); name = weechat_buffer_get_string (buffer, "name"); - length = ((plugin_name) ? strlen (plugin_name) : strlen ("core")) + 1 + - strlen (name) + 1; + length = strlen (plugin_name) + 1 + strlen (name) + 1; option_name = malloc (length); if (!option_name) return WEECHAT_RC_ERROR; - snprintf (option_name, length, "%s.%s", - (plugin_name) ? plugin_name : "core", - name); + snprintf (option_name, length, "%s.%s", plugin_name, name); if ((argc > 1) && (weechat_strcasecmp (argv[1], "reset") == 0)) { diff --git a/src/plugins/logger/logger.c b/src/plugins/logger/logger.c index e7b182cb2..4ef830652 100644 --- a/src/plugins/logger/logger.c +++ b/src/plugins/logger/logger.c @@ -131,7 +131,7 @@ logger_get_filename (struct t_gui_buffer *buffer) { plugin_name = weechat_infolist_string (ptr_infolist, "plugin_name"); plugin_name2 = (plugin_name) ? - weechat_string_replace (plugin_name, dir_separator, "_") : strdup ("core"); + weechat_string_replace (plugin_name, dir_separator, "_") : NULL; name = weechat_infolist_string (ptr_infolist, "name"); name2 = (name) ? weechat_string_replace (name, dir_separator, "_") : NULL; diff --git a/src/plugins/notify/notify.c b/src/plugins/notify/notify.c index 25e519c81..9c4ed29e4 100644 --- a/src/plugins/notify/notify.c +++ b/src/plugins/notify/notify.c @@ -84,15 +84,12 @@ notify_build_option_name (struct t_gui_buffer *buffer) plugin_name = weechat_buffer_get_string (buffer, "plugin"); name = weechat_buffer_get_string (buffer, "name"); - length = ((plugin_name) ? strlen (plugin_name) : strlen ("core")) + 1 + - strlen (name) + 1; + length = strlen (plugin_name) + 1 + strlen (name) + 1; option_name = malloc (length); if (!option_name) return NULL; - snprintf (option_name, length, "%s.%s", - (plugin_name) ? plugin_name : "core", - name); + snprintf (option_name, length, "%s.%s", plugin_name, name); return option_name; } diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index c08de42ad..4b549ec3e 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -86,6 +86,18 @@ plugin_search (const char *name) } /* + * plugin_get_name: get name of plugin with a pointer + */ + +char * +plugin_get_name (struct t_weechat_plugin *plugin) +{ + static char *plugin_core = PLUGIN_CORE; + + return (plugin) ? plugin->name : plugin_core; +} + +/* * plugin_load: load a WeeChat plugin (a dynamic library) * return: pointer to new WeeChat plugin, NULL if error */ @@ -281,6 +293,8 @@ plugin_load (const char *filename) new_plugin->charset = (charset) ? strdup (charset) : NULL; /* functions */ + new_plugin->plugin_get_name = &plugin_get_name; + new_plugin->charset_set = &plugin_api_charset_set; new_plugin->iconv_to_internal = &string_iconv_to_internal; new_plugin->iconv_from_internal = &string_iconv_from_internal; diff --git a/src/plugins/plugin.h b/src/plugins/plugin.h index 7c7cead09..57b6584ad 100644 --- a/src/plugins/plugin.h +++ b/src/plugins/plugin.h @@ -22,6 +22,8 @@ #include "weechat-plugin.h" +#define PLUGIN_CORE "core" + typedef int (t_weechat_init_func) (struct t_weechat_plugin *plugin, int argc, char *argv[]); typedef int (t_weechat_end_func) (struct t_weechat_plugin *plugin); @@ -32,6 +34,7 @@ extern struct t_weechat_plugin *last_weechat_plugin; //extern t_plugin_irc_color plugins_irc_colors[GUI_NUM_IRC_COLORS]; extern struct t_weechat_plugin *plugin_search (const char *name); +extern char *plugin_get_name (struct t_weechat_plugin *plugin); extern struct t_weechat_plugin *plugin_load (const char *filename); extern void plugin_auto_load (); extern void plugin_remove (struct t_weechat_plugin *plugin); diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c index 07e889ea1..342ca5e57 100644 --- a/src/plugins/scripts/lua/weechat-lua-api.c +++ b/src/plugins/scripts/lua/weechat-lua-api.c @@ -133,6 +133,44 @@ weechat_lua_api_register (lua_State *L) } /* + * weechat_lua_api_plugin_get_name: get name of plugin (return "core" for + * WeeChat core) + */ + +static int +weechat_lua_api_plugin_get_name (lua_State *L) +{ + const char *plugin; + char *result; + int n; + + /* make C compiler happy */ + (void) L; + + if (!lua_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("plugin_get_name"); + LUA_RETURN_EMPTY; + } + + plugin = NULL; + + n = lua_gettop (lua_current_interpreter); + + if (n < 1) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("plugin_get_name"); + LUA_RETURN_EMPTY; + } + + plugin = lua_tostring (lua_current_interpreter, -1); + + result = weechat_plugin_get_name (script_str2ptr (plugin)); + + LUA_RETURN_STRING(result); +} + +/* * weechat_lua_api_charset_set: set script charset */ @@ -5554,6 +5592,7 @@ weechat_lua_api_constant_weechat_hook_signal_pointer (lua_State *L) const struct luaL_reg weechat_lua_api_funcs[] = { { "register", &weechat_lua_api_register }, + { "plugin_get_name", &weechat_lua_api_plugin_get_name }, { "charset_set", &weechat_lua_api_charset_set }, { "iconv_to_internal", &weechat_lua_api_iconv_to_internal }, { "iconv_from_internal", &weechat_lua_api_iconv_from_internal }, diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c index fb9d5dfbc..25ffd7dac 100644 --- a/src/plugins/scripts/perl/weechat-perl-api.c +++ b/src/plugins/scripts/perl/weechat-perl-api.c @@ -65,7 +65,7 @@ extern void boot_DynaLoader (pTHX_ CV* cv); * weechat::register: startup function for all WeeChat Perl scripts */ -static XS (XS_weechat_register) +static XS (XS_weechat_api_register) { char *name, *author, *version, *license, *description, *shutdown_func; char *charset; @@ -125,10 +125,39 @@ static XS (XS_weechat_register) } /* + * weechat::plugin_get_name: get name of plugin (return "core" for WeeChat core) + */ + +static XS (XS_weechat_api_plugin_get_name) +{ + char *result; + dXSARGS; + + /* make C compiler happy */ + (void) cv; + + if (!perl_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("plugin_get_name"); + PERL_RETURN_EMPTY; + } + + if (items < 1) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("plugin_get_name"); + PERL_RETURN_EMPTY; + } + + result = weechat_plugin_get_name (script_str2ptr (SvPV (ST (0), PL_na))); /* plugin */ + + PERL_RETURN_STRING(result); +} + +/* * weechat::charser_set: set script charset */ -static XS (XS_weechat_charset_set) +static XS (XS_weechat_api_charset_set) { dXSARGS; @@ -157,7 +186,7 @@ static XS (XS_weechat_charset_set) * weechat::iconv_to_internal: convert string to internal WeeChat charset */ -static XS (XS_weechat_iconv_to_internal) +static XS (XS_weechat_api_iconv_to_internal) { char *result, *charset, *string; dXSARGS; @@ -189,7 +218,7 @@ static XS (XS_weechat_iconv_to_internal) * to another one */ -static XS (XS_weechat_iconv_from_internal) +static XS (XS_weechat_api_iconv_from_internal) { char *result, *charset, *string; dXSARGS; @@ -220,7 +249,7 @@ static XS (XS_weechat_iconv_from_internal) * weechat::gettext: get translated string */ -static XS (XS_weechat_gettext) +static XS (XS_weechat_api_gettext) { char *result; dXSARGS; @@ -249,7 +278,7 @@ static XS (XS_weechat_gettext) * weechat::ngettext: get translated string with plural form */ -static XS (XS_weechat_ngettext) +static XS (XS_weechat_api_ngettext) { char *result, *single, *plural; dXSARGS; @@ -281,7 +310,7 @@ static XS (XS_weechat_ngettext) * weechat::mkdir_home: create a directory in WeeChat home */ -static XS (XS_weechat_mkdir_home) +static XS (XS_weechat_api_mkdir_home) { dXSARGS; @@ -311,7 +340,7 @@ static XS (XS_weechat_mkdir_home) * weechat::mkdir: create a directory */ -static XS (XS_weechat_mkdir) +static XS (XS_weechat_api_mkdir) { dXSARGS; @@ -341,7 +370,7 @@ static XS (XS_weechat_mkdir) * weechat::list_new: create a new list */ -static XS (XS_weechat_list_new) +static XS (XS_weechat_api_list_new) { char *result; dXSARGS; @@ -365,7 +394,7 @@ static XS (XS_weechat_list_new) * weechat::list_add: add a string to list */ -static XS (XS_weechat_list_add) +static XS (XS_weechat_api_list_add) { char *result, *weelist, *data, *where; dXSARGS; @@ -399,7 +428,7 @@ static XS (XS_weechat_list_add) * weechat::list_search: search a string in list */ -static XS (XS_weechat_list_search) +static XS (XS_weechat_api_list_search) { char *result, *weelist, *data; dXSARGS; @@ -431,7 +460,7 @@ static XS (XS_weechat_list_search) * weechat::list_casesearch: search a string in list (ignore case) */ -static XS (XS_weechat_list_casesearch) +static XS (XS_weechat_api_list_casesearch) { char *result, *weelist, *data; dXSARGS; @@ -463,7 +492,7 @@ static XS (XS_weechat_list_casesearch) * weechat::list_get: get item by position */ -static XS (XS_weechat_list_get) +static XS (XS_weechat_api_list_get) { char *result; dXSARGS; @@ -493,7 +522,7 @@ static XS (XS_weechat_list_get) * weechat::list_set: set new value for item */ -static XS (XS_weechat_list_set) +static XS (XS_weechat_api_list_set) { char *item, *new_value; dXSARGS; @@ -524,7 +553,7 @@ static XS (XS_weechat_list_set) * weechat::list_next: get next item */ -static XS (XS_weechat_list_next) +static XS (XS_weechat_api_list_next) { char *result; dXSARGS; @@ -553,7 +582,7 @@ static XS (XS_weechat_list_next) * weechat::list_prev: get previous item */ -static XS (XS_weechat_list_prev) +static XS (XS_weechat_api_list_prev) { char *result; dXSARGS; @@ -582,7 +611,7 @@ static XS (XS_weechat_list_prev) * weechat::list_string: get string value of item */ -static XS (XS_weechat_list_string) +static XS (XS_weechat_api_list_string) { char *result; dXSARGS; @@ -611,7 +640,7 @@ static XS (XS_weechat_list_string) * weechat::list_size: get number of elements in list */ -static XS (XS_weechat_list_size) +static XS (XS_weechat_api_list_size) { int size; dXSARGS; @@ -640,7 +669,7 @@ static XS (XS_weechat_list_size) * weechat::list_remove: remove item from list */ -static XS (XS_weechat_list_remove) +static XS (XS_weechat_api_list_remove) { char *weelist, *item; dXSARGS; @@ -671,7 +700,7 @@ static XS (XS_weechat_list_remove) * weechat::list_remove_all: remove all items from list */ -static XS (XS_weechat_list_remove_all) +static XS (XS_weechat_api_list_remove_all) { dXSARGS; @@ -699,7 +728,7 @@ static XS (XS_weechat_list_remove_all) * weechat::list_free: free list */ -static XS (XS_weechat_list_free) +static XS (XS_weechat_api_list_free) { dXSARGS; @@ -767,7 +796,7 @@ weechat_perl_api_config_reload_cb (void *data, * weechat::config_new: create a new configuration file */ -static XS (XS_weechat_config_new) +static XS (XS_weechat_api_config_new) { char *result, *name, *function; dXSARGS; @@ -951,7 +980,7 @@ weechat_perl_api_config_section_create_option_cb (void *data, * weechat::config_new_section: create a new section in configuration file */ -static XS (XS_weechat_config_new_section) +static XS (XS_weechat_api_config_new_section) { char *result, *cfg_file, *name, *function_read, *function_write; char *function_write_default, *function_create_option; @@ -1000,7 +1029,7 @@ static XS (XS_weechat_config_new_section) * weechat::config_search_section: search section in configuration file */ -static XS (XS_weechat_config_search_section) +static XS (XS_weechat_api_config_search_section) { char *result, *config_file, *section_name; dXSARGS; @@ -1131,7 +1160,7 @@ weechat_perl_api_config_option_delete_cb (void *data, * weechat::config_new_option: create a new option in section */ -static XS (XS_weechat_config_new_option) +static XS (XS_weechat_api_config_new_option) { char *result, *config_file, *section, *name, *type; char *description, *string_values, *default_value; @@ -1188,7 +1217,7 @@ static XS (XS_weechat_config_new_option) * weechat::config_search_option: search option in configuration file or section */ -static XS (XS_weechat_config_search_option) +static XS (XS_weechat_api_config_search_option) { char *result, *config_file, *section, *option_name; dXSARGS; @@ -1222,7 +1251,7 @@ static XS (XS_weechat_config_search_option) * weechat::config_string_to_boolean: return boolean value of a string */ -static XS (XS_weechat_config_string_to_boolean) +static XS (XS_weechat_api_config_string_to_boolean) { int value; dXSARGS; @@ -1251,7 +1280,7 @@ static XS (XS_weechat_config_string_to_boolean) * weechat::config_option_reset: reset an option with default value */ -static XS (XS_weechat_config_option_reset) +static XS (XS_weechat_api_config_option_reset) { int rc; char *option; @@ -1283,7 +1312,7 @@ static XS (XS_weechat_config_option_reset) * weechat::config_option_set: set new value for option */ -static XS (XS_weechat_config_option_set) +static XS (XS_weechat_api_config_option_set) { int rc; char *option, *new_value; @@ -1317,7 +1346,7 @@ static XS (XS_weechat_config_option_set) * weechat::config_option_unset: unset an option */ -static XS (XS_weechat_config_option_unset) +static XS (XS_weechat_api_config_option_unset) { int rc; char *option; @@ -1348,7 +1377,7 @@ static XS (XS_weechat_config_option_unset) * weechat::config_option_rename: rename an option */ -static XS (XS_weechat_config_option_rename) +static XS (XS_weechat_api_config_option_rename) { char *option, *new_name; dXSARGS; @@ -1380,7 +1409,7 @@ static XS (XS_weechat_config_option_rename) * weechat::config_boolean: return boolean value of option */ -static XS (XS_weechat_config_boolean) +static XS (XS_weechat_api_config_boolean) { int value; dXSARGS; @@ -1409,7 +1438,7 @@ static XS (XS_weechat_config_boolean) * weechat::config_integer: return integer value of option */ -static XS (XS_weechat_config_integer) +static XS (XS_weechat_api_config_integer) { int value; dXSARGS; @@ -1438,7 +1467,7 @@ static XS (XS_weechat_config_integer) * weechat::config_string: return string value of option */ -static XS (XS_weechat_config_string) +static XS (XS_weechat_api_config_string) { char *result; dXSARGS; @@ -1467,7 +1496,7 @@ static XS (XS_weechat_config_string) * weechat::config_color: return color value of option */ -static XS (XS_weechat_config_color) +static XS (XS_weechat_api_config_color) { int value; dXSARGS; @@ -1496,7 +1525,7 @@ static XS (XS_weechat_config_color) * weechat::config_write_line: write a line in configuration file */ -static XS (XS_weechat_config_write_line) +static XS (XS_weechat_api_config_write_line) { char *config_file, *option_name, *value; dXSARGS; @@ -1529,7 +1558,7 @@ static XS (XS_weechat_config_write_line) * weechat::config_write: write configuration file */ -static XS (XS_weechat_config_write) +static XS (XS_weechat_api_config_write) { int rc; dXSARGS; @@ -1558,7 +1587,7 @@ static XS (XS_weechat_config_write) * weechat::config_read: read configuration file */ -static XS (XS_weechat_config_read) +static XS (XS_weechat_api_config_read) { int rc; dXSARGS; @@ -1587,7 +1616,7 @@ static XS (XS_weechat_config_read) * weechat::config_reload: reload configuration file */ -static XS (XS_weechat_config_reload) +static XS (XS_weechat_api_config_reload) { int rc; dXSARGS; @@ -1616,7 +1645,7 @@ static XS (XS_weechat_config_reload) * weechat::config_free: free configuration file */ -static XS (XS_weechat_config_free) +static XS (XS_weechat_api_config_free) { dXSARGS; @@ -1646,7 +1675,7 @@ static XS (XS_weechat_config_free) * weechat::config_get: get config option */ -static XS (XS_weechat_config_get) +static XS (XS_weechat_api_config_get) { char *result; dXSARGS; @@ -1675,7 +1704,7 @@ static XS (XS_weechat_config_get) * weechat::config_get_plugin: get value of a plugin option */ -static XS (XS_weechat_config_get_plugin) +static XS (XS_weechat_api_config_get_plugin) { char *result; dXSARGS; @@ -1706,7 +1735,7 @@ static XS (XS_weechat_config_get_plugin) * weechat::config_set_plugin: set value of a plugin option */ -static XS (XS_weechat_config_set_plugin) +static XS (XS_weechat_api_config_set_plugin) { char *option, *value; dXSARGS; @@ -1741,7 +1770,7 @@ static XS (XS_weechat_config_set_plugin) * weechat::prefix: get a prefix, used for display */ -static XS (XS_weechat_prefix) +static XS (XS_weechat_api_prefix) { char *result; dXSARGS; @@ -1770,7 +1799,7 @@ static XS (XS_weechat_prefix) * weechat::color: get a color code, used for display */ -static XS (XS_weechat_color) +static XS (XS_weechat_api_color) { char *result; dXSARGS; @@ -1799,7 +1828,7 @@ static XS (XS_weechat_color) * weechat::print: print message in a buffer */ -static XS (XS_weechat_print) +static XS (XS_weechat_api_print) { char *buffer, *message; dXSARGS; @@ -1828,7 +1857,7 @@ static XS (XS_weechat_print) * tags */ -static XS (XS_weechat_print_date_tags) +static XS (XS_weechat_api_print_date_tags) { char *buffer, *tags, *message; dXSARGS; @@ -1865,7 +1894,7 @@ static XS (XS_weechat_print_date_tags) * weechat::print_y: print message in a buffer with free content */ -static XS (XS_weechat_print_y) +static XS (XS_weechat_api_print_y) { char *buffer, *message; dXSARGS; @@ -1900,7 +1929,7 @@ static XS (XS_weechat_print_y) * weechat::log_print: print message in WeeChat log file */ -static XS (XS_weechat_log_print) +static XS (XS_weechat_api_log_print) { dXSARGS; @@ -1969,7 +1998,7 @@ weechat_perl_api_hook_command_cb (void *data, struct t_gui_buffer *buffer, * weechat::hook_command: hook a command */ -static XS (XS_weechat_hook_command) +static XS (XS_weechat_api_hook_command) { char *result, *command, *description, *args, *args_description; char *completion, *function; @@ -2044,7 +2073,7 @@ weechat_perl_api_hook_timer_cb (void *data) * weechat::hook_timer: hook a timer */ -static XS (XS_weechat_hook_timer) +static XS (XS_weechat_api_hook_timer) { char *result; dXSARGS; @@ -2110,7 +2139,7 @@ weechat_perl_api_hook_fd_cb (void *data) * weechat::hook_fd: hook a fd */ -static XS (XS_weechat_hook_fd) +static XS (XS_weechat_api_hook_fd) { char *result; dXSARGS; @@ -2182,7 +2211,7 @@ weechat_perl_api_hook_connect_cb (void *data, int status, * weechat::hook_connect: hook a connection */ -static XS (XS_weechat_hook_connect) +static XS (XS_weechat_api_hook_connect) { char *address, *local_hostname, *result; dXSARGS; @@ -2271,7 +2300,7 @@ weechat_perl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer, * weechat::hook_print: hook a print */ -static XS (XS_weechat_hook_print) +static XS (XS_weechat_api_hook_print) { char *result, *buffer, *tags, *message, *function; dXSARGS; @@ -2365,7 +2394,7 @@ weechat_perl_api_hook_signal_cb (void *data, const char *signal, const char *typ * weechat::hook_signal: hook a signal */ -static XS (XS_weechat_hook_signal) +static XS (XS_weechat_api_hook_signal) { char *result, *signal, *function; dXSARGS; @@ -2400,7 +2429,7 @@ static XS (XS_weechat_hook_signal) * weechat::hook_signal_send: send a signal */ -static XS (XS_weechat_hook_signal_send) +static XS (XS_weechat_api_hook_signal_send) { char *signal, *type_data; int number; @@ -2486,7 +2515,7 @@ weechat_perl_api_hook_config_cb (void *data, const char *option, const char *val * weechat::hook_config: hook a config option */ -static XS (XS_weechat_hook_config) +static XS (XS_weechat_api_hook_config) { char *result, *option, *function; dXSARGS; @@ -2561,7 +2590,7 @@ weechat_perl_api_hook_completion_cb (void *data, const char *completion_item, * weechat::hook_completion: hook a completion */ -static XS (XS_weechat_hook_completion) +static XS (XS_weechat_api_hook_completion) { char *result, *completion, *function; dXSARGS; @@ -2596,7 +2625,7 @@ static XS (XS_weechat_hook_completion) * weechat::hook_completion_list_add: add a word to list for a completion */ -static XS (XS_weechat_hook_completion_list_add) +static XS (XS_weechat_api_hook_completion_list_add) { char *completion, *word, *where; dXSARGS; @@ -2656,7 +2685,7 @@ weechat_perl_api_hook_modifier_cb (void *data, const char *modifier, * weechat::hook_modifier: hook a modifier */ -static XS (XS_weechat_hook_modifier) +static XS (XS_weechat_api_hook_modifier) { char *result, *modifier, *perl_fn; dXSARGS; @@ -2691,7 +2720,7 @@ static XS (XS_weechat_hook_modifier) * weechat::hook_modifier_exec: execute a modifier hook */ -static XS (XS_weechat_hook_modifier_exec) +static XS (XS_weechat_api_hook_modifier_exec) { char *result, *modifier, *modifier_data, *string; dXSARGS; @@ -2746,7 +2775,7 @@ weechat_perl_api_hook_info_cb (void *data, const char *info_name, * weechat::hook_info: hook an info */ -static XS (XS_weechat_hook_info) +static XS (XS_weechat_api_hook_info) { char *result, *info_name, *description, *perl_fn; dXSARGS; @@ -2813,7 +2842,7 @@ weechat_perl_api_hook_infolist_cb (void *data, const char *infolist_name, * weechat::hook_infolist: hook an infolist */ -static XS (XS_weechat_hook_infolist) +static XS (XS_weechat_api_hook_infolist) { char *result, *infolist_name, *description, *perl_fn; dXSARGS; @@ -2850,7 +2879,7 @@ static XS (XS_weechat_hook_infolist) * weechat::unhook: unhook something */ -static XS (XS_weechat_unhook) +static XS (XS_weechat_api_unhook) { dXSARGS; @@ -2880,7 +2909,7 @@ static XS (XS_weechat_unhook) * weechat::unhook_all: unhook all for script */ -static XS (XS_weechat_unhook_all) +static XS (XS_weechat_api_unhook_all) { dXSARGS; @@ -2971,7 +3000,7 @@ weechat_perl_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer) * weechat::buffer_new: create a new buffer */ -static XS (XS_weechat_buffer_new) +static XS (XS_weechat_api_buffer_new) { char *result, *name, *function_input, *function_close; dXSARGS; @@ -3009,7 +3038,7 @@ static XS (XS_weechat_buffer_new) * weechat::buffer_search: search a buffer */ -static XS (XS_weechat_buffer_search) +static XS (XS_weechat_api_buffer_search) { char *result, *plugin, *name; dXSARGS; @@ -3040,7 +3069,7 @@ static XS (XS_weechat_buffer_search) * weechat::buffer_clear: clear a buffer */ -static XS (XS_weechat_buffer_clear) +static XS (XS_weechat_api_buffer_clear) { dXSARGS; @@ -3068,7 +3097,7 @@ static XS (XS_weechat_buffer_clear) * weechat::buffer_close: close a buffer */ -static XS (XS_weechat_buffer_close) +static XS (XS_weechat_api_buffer_close) { dXSARGS; @@ -3099,7 +3128,7 @@ static XS (XS_weechat_buffer_close) * weechat::buffer_get_integer: get a buffer property as integer */ -static XS (XS_weechat_buffer_get_integer) +static XS (XS_weechat_api_buffer_get_integer) { char *buffer, *property; int value; @@ -3131,7 +3160,7 @@ static XS (XS_weechat_buffer_get_integer) * weechat::buffer_get_string: get a buffer property as string */ -static XS (XS_weechat_buffer_get_string) +static XS (XS_weechat_api_buffer_get_string) { char *result, *buffer, *property; dXSARGS; @@ -3162,7 +3191,7 @@ static XS (XS_weechat_buffer_get_string) * weechat::buffer_get_pointer: get a buffer property as pointer */ -static XS (XS_weechat_buffer_get_pointer) +static XS (XS_weechat_api_buffer_get_pointer) { char *result, *buffer, *property; dXSARGS; @@ -3194,7 +3223,7 @@ static XS (XS_weechat_buffer_get_pointer) * weechat::buffer_set: set a buffer property */ -static XS (XS_weechat_buffer_set) +static XS (XS_weechat_api_buffer_set) { char *buffer, *property, *value; dXSARGS; @@ -3226,7 +3255,7 @@ static XS (XS_weechat_buffer_set) * weechat::nicklist_add_group: add a group in nicklist */ -static XS (XS_weechat_nicklist_add_group) +static XS (XS_weechat_api_nicklist_add_group) { char *result, *buffer, *parent_group, *name, *color; dXSARGS; @@ -3263,7 +3292,7 @@ static XS (XS_weechat_nicklist_add_group) * weechat::nicklist_search_group: search a group in nicklist */ -static XS (XS_weechat_nicklist_search_group) +static XS (XS_weechat_api_nicklist_search_group) { char *result, *buffer, *from_group, *name; dXSARGS; @@ -3297,7 +3326,7 @@ static XS (XS_weechat_nicklist_search_group) * weechat::nicklist_add_nick: add a nick in nicklist */ -static XS (XS_weechat_nicklist_add_nick) +static XS (XS_weechat_api_nicklist_add_nick) { char *prefix, char_prefix, *result, *buffer, *group, *name, *color; char *prefix_color; @@ -3344,7 +3373,7 @@ static XS (XS_weechat_nicklist_add_nick) * weechat::nicklist_search_nick: search a nick in nicklist */ -static XS (XS_weechat_nicklist_search_nick) +static XS (XS_weechat_api_nicklist_search_nick) { char *result, *buffer, *from_group, *name; dXSARGS; @@ -3378,7 +3407,7 @@ static XS (XS_weechat_nicklist_search_nick) * weechat::nicklist_remove_group: remove a group from nicklist */ -static XS (XS_weechat_nicklist_remove_group) +static XS (XS_weechat_api_nicklist_remove_group) { char *buffer, *group; dXSARGS; @@ -3410,7 +3439,7 @@ static XS (XS_weechat_nicklist_remove_group) * weechat::nicklist_remove_nick: remove a nick from nicklist */ -static XS (XS_weechat_nicklist_remove_nick) +static XS (XS_weechat_api_nicklist_remove_nick) { char *buffer, *nick; dXSARGS; @@ -3442,7 +3471,7 @@ static XS (XS_weechat_nicklist_remove_nick) * weechat::nicklist_remove_all: remove all groups/nicks from nicklist */ -static XS (XS_weechat_nicklist_remove_all) +static XS (XS_weechat_api_nicklist_remove_all) { dXSARGS; @@ -3470,7 +3499,7 @@ static XS (XS_weechat_nicklist_remove_all) * weechat::bar_item_search: search a bar item */ -static XS (XS_weechat_bar_item_search) +static XS (XS_weechat_api_bar_item_search) { char *result; dXSARGS; @@ -3536,7 +3565,7 @@ weechat_perl_api_bar_item_build_cb (void *data, struct t_gui_bar_item *item, * weechat::bar_item_new: add a new bar item */ -static XS (XS_weechat_bar_item_new) +static XS (XS_weechat_api_bar_item_new) { char *result, *name, *function_build; dXSARGS; @@ -3571,7 +3600,7 @@ static XS (XS_weechat_bar_item_new) * weechat::bar_item_update: update a bar item on screen */ -static XS (XS_weechat_bar_item_update) +static XS (XS_weechat_api_bar_item_update) { dXSARGS; @@ -3599,7 +3628,7 @@ static XS (XS_weechat_bar_item_update) * weechat::bar_item_remove: remove a bar item */ -static XS (XS_weechat_bar_item_remove) +static XS (XS_weechat_api_bar_item_remove) { dXSARGS; @@ -3629,7 +3658,7 @@ static XS (XS_weechat_bar_item_remove) * weechat::bar_search: search a bar */ -static XS (XS_weechat_bar_search) +static XS (XS_weechat_api_bar_search) { char *result; dXSARGS; @@ -3658,7 +3687,7 @@ static XS (XS_weechat_bar_search) * weechat::bar_new: add a new bar */ -static XS (XS_weechat_bar_new) +static XS (XS_weechat_api_bar_new) { char *result, *name, *hidden, *priority, *type, *conditions, *position; char *filling_top_bottom, *filling_left_right, *size, *size_max, *color_fg; @@ -3718,7 +3747,7 @@ static XS (XS_weechat_bar_new) * weechat::bar_set: set a bar property */ -static XS (XS_weechat_bar_set) +static XS (XS_weechat_api_bar_set) { char *bar, *property, *value; dXSARGS; @@ -3750,7 +3779,7 @@ static XS (XS_weechat_bar_set) * weechat::bar_update: update a bar on screen */ -static XS (XS_weechat_bar_update) +static XS (XS_weechat_api_bar_update) { dXSARGS; @@ -3778,7 +3807,7 @@ static XS (XS_weechat_bar_update) * weechat::bar_remove: remove a bar */ -static XS (XS_weechat_bar_remove) +static XS (XS_weechat_api_bar_remove) { dXSARGS; @@ -3806,7 +3835,7 @@ static XS (XS_weechat_bar_remove) * weechat::command: execute a command on a buffer */ -static XS (XS_weechat_command) +static XS (XS_weechat_api_command) { char *buffer, *command; dXSARGS; @@ -3840,7 +3869,7 @@ static XS (XS_weechat_command) * weechat::info_get: get info about WeeChat */ -static XS (XS_weechat_info_get) +static XS (XS_weechat_api_info_get) { char *result; dXSARGS; @@ -3870,7 +3899,7 @@ static XS (XS_weechat_info_get) * weechat::infolist_new: create new infolist */ -static XS (XS_weechat_infolist_new) +static XS (XS_weechat_api_infolist_new) { char *result; dXSARGS; @@ -3894,7 +3923,7 @@ static XS (XS_weechat_infolist_new) * weechat::infolist_new_var_integer: create new integer variable in infolist */ -static XS (XS_weechat_infolist_new_var_integer) +static XS (XS_weechat_api_infolist_new_var_integer) { char *infolist, *name, *result; dXSARGS; @@ -3928,7 +3957,7 @@ static XS (XS_weechat_infolist_new_var_integer) * weechat::infolist_new_var_string: create new string variable in infolist */ -static XS (XS_weechat_infolist_new_var_string) +static XS (XS_weechat_api_infolist_new_var_string) { char *infolist, *name, *value, *result; dXSARGS; @@ -3963,7 +3992,7 @@ static XS (XS_weechat_infolist_new_var_string) * weechat::infolist_new_var_pointer: create new pointer variable in infolist */ -static XS (XS_weechat_infolist_new_var_pointer) +static XS (XS_weechat_api_infolist_new_var_pointer) { char *infolist, *name, *value, *result; dXSARGS; @@ -3998,7 +4027,7 @@ static XS (XS_weechat_infolist_new_var_pointer) * weechat::infolist_new_var_time: create new time variable in infolist */ -static XS (XS_weechat_infolist_new_var_time) +static XS (XS_weechat_api_infolist_new_var_time) { char *infolist, *name, *result; dXSARGS; @@ -4032,7 +4061,7 @@ static XS (XS_weechat_infolist_new_var_time) * weechat::infolist_get: get list with infos */ -static XS (XS_weechat_infolist_get) +static XS (XS_weechat_api_infolist_get) { char *result, *name, *pointer, *arguments; dXSARGS; @@ -4066,7 +4095,7 @@ static XS (XS_weechat_infolist_get) * weechat::infolist_next: move item pointer to next item in infolist */ -static XS (XS_weechat_infolist_next) +static XS (XS_weechat_api_infolist_next) { int value; dXSARGS; @@ -4095,7 +4124,7 @@ static XS (XS_weechat_infolist_next) * weechat::infolist_prev: move item pointer to previous item in infolist */ -static XS (XS_weechat_infolist_prev) +static XS (XS_weechat_api_infolist_prev) { int value; dXSARGS; @@ -4124,7 +4153,7 @@ static XS (XS_weechat_infolist_prev) * weechat::infolist_fields: get list of fields for current item of infolist */ -static XS (XS_weechat_infolist_fields) +static XS (XS_weechat_api_infolist_fields) { char *result; dXSARGS; @@ -4153,7 +4182,7 @@ static XS (XS_weechat_infolist_fields) * weechat::infolist_integer: get integer value of a variable in infolist */ -static XS (XS_weechat_infolist_integer) +static XS (XS_weechat_api_infolist_integer) { char *infolist, *variable; int value; @@ -4185,7 +4214,7 @@ static XS (XS_weechat_infolist_integer) * weechat::infolist_string: get string value of a variable in infolist */ -static XS (XS_weechat_infolist_string) +static XS (XS_weechat_api_infolist_string) { char *infolist, *variable; char *result; @@ -4217,7 +4246,7 @@ static XS (XS_weechat_infolist_string) * weechat::infolist_pointer: get pointer value of a variable in infolist */ -static XS (XS_weechat_infolist_pointer) +static XS (XS_weechat_api_infolist_pointer) { char *infolist, *variable; char *result; @@ -4249,7 +4278,7 @@ static XS (XS_weechat_infolist_pointer) * weechat::infolist_time: get time value of a variable in infolist */ -static XS (XS_weechat_infolist_time) +static XS (XS_weechat_api_infolist_time) { time_t time; char timebuffer[64], *result, *infolist, *variable; @@ -4283,7 +4312,7 @@ static XS (XS_weechat_infolist_time) * weechat::infolist_free: free infolist */ -static XS (XS_weechat_infolist_free) +static XS (XS_weechat_api_infolist_free) { dXSARGS; @@ -4319,111 +4348,112 @@ weechat_perl_api_init (pTHX) newXS ("DynaLoader::boot_DynaLoader", boot_DynaLoader, __FILE__); /* interface functions */ - newXS ("weechat::register", XS_weechat_register, "weechat"); - newXS ("weechat::charset_set", XS_weechat_charset_set, "weechat"); - newXS ("weechat::iconv_to_internal", XS_weechat_iconv_to_internal, "weechat"); - newXS ("weechat::iconv_from_internal", XS_weechat_iconv_from_internal, "weechat"); - newXS ("weechat::gettext", XS_weechat_gettext, "weechat"); - newXS ("weechat::ngettext", XS_weechat_ngettext, "weechat"); - newXS ("weechat::mkdir_home", XS_weechat_mkdir_home, "weechat"); - newXS ("weechat::mkdir", XS_weechat_mkdir, "weechat"); - newXS ("weechat::list_new", XS_weechat_list_new, "weechat"); - newXS ("weechat::list_add", XS_weechat_list_add, "weechat"); - newXS ("weechat::list_search", XS_weechat_list_search, "weechat"); - newXS ("weechat::list_casesearch", XS_weechat_list_casesearch, "weechat"); - newXS ("weechat::list_get", XS_weechat_list_get, "weechat"); - newXS ("weechat::list_set", XS_weechat_list_set, "weechat"); - newXS ("weechat::list_next", XS_weechat_list_next, "weechat"); - newXS ("weechat::list_prev", XS_weechat_list_prev, "weechat"); - newXS ("weechat::list_string", XS_weechat_list_string, "weechat"); - newXS ("weechat::list_size", XS_weechat_list_size, "weechat"); - newXS ("weechat::list_remove", XS_weechat_list_remove, "weechat"); - newXS ("weechat::list_remove_all", XS_weechat_list_remove_all, "weechat"); - newXS ("weechat::list_free", XS_weechat_list_free, "weechat"); - newXS ("weechat::config_new", XS_weechat_config_new, "weechat"); - newXS ("weechat::config_new_section", XS_weechat_config_new_section, "weechat"); - newXS ("weechat::config_search_section", XS_weechat_config_search_section, "weechat"); - newXS ("weechat::config_new_option", XS_weechat_config_new_option, "weechat"); - newXS ("weechat::config_search_option", XS_weechat_config_search_option, "weechat"); - newXS ("weechat::config_string_to_boolean", XS_weechat_config_string_to_boolean, "weechat"); - newXS ("weechat::config_option_reset", XS_weechat_config_option_reset, "weechat"); - newXS ("weechat::config_option_set", XS_weechat_config_option_set, "weechat"); - newXS ("weechat::config_option_unset", XS_weechat_config_option_unset, "weechat"); - newXS ("weechat::config_option_rename", XS_weechat_config_option_rename, "weechat"); - newXS ("weechat::config_boolean", XS_weechat_config_boolean, "weechat"); - newXS ("weechat::config_integer", XS_weechat_config_integer, "weechat"); - newXS ("weechat::config_string", XS_weechat_config_string, "weechat"); - newXS ("weechat::config_color", XS_weechat_config_color, "weechat"); - newXS ("weechat::config_write_line", XS_weechat_config_write_line, "weechat"); - newXS ("weechat::config_write", XS_weechat_config_write, "weechat"); - newXS ("weechat::config_read", XS_weechat_config_read, "weechat"); - newXS ("weechat::config_reload", XS_weechat_config_reload, "weechat"); - newXS ("weechat::config_free", XS_weechat_config_free, "weechat"); - newXS ("weechat::config_get", XS_weechat_config_get, "weechat"); - newXS ("weechat::config_get_plugin", XS_weechat_config_get_plugin, "weechat"); - newXS ("weechat::config_set_plugin", XS_weechat_config_set_plugin, "weechat"); - newXS ("weechat::prefix", XS_weechat_prefix, "weechat"); - newXS ("weechat::color", XS_weechat_color, "weechat"); - newXS ("weechat::print", XS_weechat_print, "weechat"); - newXS ("weechat::print_date_tags", XS_weechat_print_date_tags, "weechat"); - newXS ("weechat::print_y", XS_weechat_print_y, "weechat"); - newXS ("weechat::log_print", XS_weechat_log_print, "weechat"); - newXS ("weechat::hook_command", XS_weechat_hook_command, "weechat"); - newXS ("weechat::hook_timer", XS_weechat_hook_timer, "weechat"); - newXS ("weechat::hook_fd", XS_weechat_hook_fd, "weechat"); - newXS ("weechat::hook_connect", XS_weechat_hook_connect, "weechat"); - newXS ("weechat::hook_print", XS_weechat_hook_print, "weechat"); - newXS ("weechat::hook_signal", XS_weechat_hook_signal, "weechat"); - newXS ("weechat::hook_signal_send", XS_weechat_hook_signal_send, "weechat"); - newXS ("weechat::hook_config", XS_weechat_hook_config, "weechat"); - newXS ("weechat::hook_completion", XS_weechat_hook_completion, "weechat"); - newXS ("weechat::hook_completion_list_add", XS_weechat_hook_completion_list_add, "weechat"); - newXS ("weechat::hook_modifier", XS_weechat_hook_modifier, "weechat"); - newXS ("weechat::hook_modifier_exec", XS_weechat_hook_modifier_exec, "weechat"); - newXS ("weechat::hook_info", XS_weechat_hook_info, "weechat"); - newXS ("weechat::hook_infolist", XS_weechat_hook_infolist, "weechat"); - newXS ("weechat::unhook", XS_weechat_unhook, "weechat"); - newXS ("weechat::unhook_all", XS_weechat_unhook_all, "weechat"); - newXS ("weechat::buffer_new", XS_weechat_buffer_new, "weechat"); - newXS ("weechat::buffer_search", XS_weechat_buffer_search, "weechat"); - newXS ("weechat::buffer_clear", XS_weechat_buffer_clear, "weechat"); - newXS ("weechat::buffer_close", XS_weechat_buffer_close, "weechat"); - newXS ("weechat::buffer_get_integer", XS_weechat_buffer_get_integer, "weechat"); - newXS ("weechat::buffer_get_string", XS_weechat_buffer_get_string, "weechat"); - newXS ("weechat::buffer_get_pointer", XS_weechat_buffer_get_pointer, "weechat"); - newXS ("weechat::buffer_set", XS_weechat_buffer_set, "weechat"); - newXS ("weechat::nicklist_add_group", XS_weechat_nicklist_add_group, "weechat"); - newXS ("weechat::nicklist_search_group", XS_weechat_nicklist_search_group, "weechat"); - newXS ("weechat::nicklist_add_nick", XS_weechat_nicklist_add_nick, "weechat"); - newXS ("weechat::nicklist_search_nick", XS_weechat_nicklist_search_nick, "weechat"); - newXS ("weechat::nicklist_remove_group", XS_weechat_nicklist_remove_group, "weechat"); - newXS ("weechat::nicklist_remove_nick", XS_weechat_nicklist_remove_nick, "weechat"); - newXS ("weechat::nicklist_remove_all", XS_weechat_nicklist_remove_all, "weechat"); - newXS ("weechat::bar_item_search", XS_weechat_bar_item_search, "weechat"); - newXS ("weechat::bar_item_new", XS_weechat_bar_item_new, "weechat"); - newXS ("weechat::bar_item_update", XS_weechat_bar_item_update, "weechat"); - newXS ("weechat::bar_item_remove", XS_weechat_bar_item_remove, "weechat"); - newXS ("weechat::bar_search", XS_weechat_bar_search, "weechat"); - newXS ("weechat::bar_new", XS_weechat_bar_new, "weechat"); - newXS ("weechat::bar_set", XS_weechat_bar_set, "weechat"); - newXS ("weechat::bar_update", XS_weechat_bar_update, "weechat"); - newXS ("weechat::bar_remove", XS_weechat_bar_remove, "weechat"); - newXS ("weechat::command", XS_weechat_command, "weechat"); - newXS ("weechat::info_get", XS_weechat_info_get, "weechat"); - newXS ("weechat::infolist_new", XS_weechat_infolist_new, "weechat"); - newXS ("weechat::infolist_new_var_integer", XS_weechat_infolist_new_var_integer, "weechat"); - newXS ("weechat::infolist_new_var_string", XS_weechat_infolist_new_var_string, "weechat"); - newXS ("weechat::infolist_new_var_pointer", XS_weechat_infolist_new_var_pointer, "weechat"); - newXS ("weechat::infolist_new_var_time", XS_weechat_infolist_new_var_time, "weechat"); - newXS ("weechat::infolist_get", XS_weechat_infolist_get, "weechat"); - newXS ("weechat::infolist_next", XS_weechat_infolist_next, "weechat"); - newXS ("weechat::infolist_prev", XS_weechat_infolist_prev, "weechat"); - newXS ("weechat::infolist_fields", XS_weechat_infolist_fields, "weechat"); - newXS ("weechat::infolist_integer", XS_weechat_infolist_integer, "weechat"); - newXS ("weechat::infolist_string", XS_weechat_infolist_string, "weechat"); - newXS ("weechat::infolist_pointer", XS_weechat_infolist_pointer, "weechat"); - newXS ("weechat::infolist_time", XS_weechat_infolist_time, "weechat"); - newXS ("weechat::infolist_free", XS_weechat_infolist_free, "weechat"); + newXS ("weechat::register", XS_weechat_api_register, "weechat"); + newXS ("weechat::plugin_get_name", XS_weechat_api_plugin_get_name, "weechat"); + newXS ("weechat::charset_set", XS_weechat_api_charset_set, "weechat"); + newXS ("weechat::iconv_to_internal", XS_weechat_api_iconv_to_internal, "weechat"); + newXS ("weechat::iconv_from_internal", XS_weechat_api_iconv_from_internal, "weechat"); + newXS ("weechat::gettext", XS_weechat_api_gettext, "weechat"); + newXS ("weechat::ngettext", XS_weechat_api_ngettext, "weechat"); + newXS ("weechat::mkdir_home", XS_weechat_api_mkdir_home, "weechat"); + newXS ("weechat::mkdir", XS_weechat_api_mkdir, "weechat"); + newXS ("weechat::list_new", XS_weechat_api_list_new, "weechat"); + newXS ("weechat::list_add", XS_weechat_api_list_add, "weechat"); + newXS ("weechat::list_search", XS_weechat_api_list_search, "weechat"); + newXS ("weechat::list_casesearch", XS_weechat_api_list_casesearch, "weechat"); + newXS ("weechat::list_get", XS_weechat_api_list_get, "weechat"); + newXS ("weechat::list_set", XS_weechat_api_list_set, "weechat"); + newXS ("weechat::list_next", XS_weechat_api_list_next, "weechat"); + newXS ("weechat::list_prev", XS_weechat_api_list_prev, "weechat"); + newXS ("weechat::list_string", XS_weechat_api_list_string, "weechat"); + newXS ("weechat::list_size", XS_weechat_api_list_size, "weechat"); + newXS ("weechat::list_remove", XS_weechat_api_list_remove, "weechat"); + newXS ("weechat::list_remove_all", XS_weechat_api_list_remove_all, "weechat"); + newXS ("weechat::list_free", XS_weechat_api_list_free, "weechat"); + newXS ("weechat::config_new", XS_weechat_api_config_new, "weechat"); + newXS ("weechat::config_new_section", XS_weechat_api_config_new_section, "weechat"); + newXS ("weechat::config_search_section", XS_weechat_api_config_search_section, "weechat"); + newXS ("weechat::config_new_option", XS_weechat_api_config_new_option, "weechat"); + newXS ("weechat::config_search_option", XS_weechat_api_config_search_option, "weechat"); + newXS ("weechat::config_string_to_boolean", XS_weechat_api_config_string_to_boolean, "weechat"); + newXS ("weechat::config_option_reset", XS_weechat_api_config_option_reset, "weechat"); + newXS ("weechat::config_option_set", XS_weechat_api_config_option_set, "weechat"); + newXS ("weechat::config_option_unset", XS_weechat_api_config_option_unset, "weechat"); + newXS ("weechat::config_option_rename", XS_weechat_api_config_option_rename, "weechat"); + newXS ("weechat::config_boolean", XS_weechat_api_config_boolean, "weechat"); + newXS ("weechat::config_integer", XS_weechat_api_config_integer, "weechat"); + newXS ("weechat::config_string", XS_weechat_api_config_string, "weechat"); + newXS ("weechat::config_color", XS_weechat_api_config_color, "weechat"); + newXS ("weechat::config_write_line", XS_weechat_api_config_write_line, "weechat"); + newXS ("weechat::config_write", XS_weechat_api_config_write, "weechat"); + newXS ("weechat::config_read", XS_weechat_api_config_read, "weechat"); + newXS ("weechat::config_reload", XS_weechat_api_config_reload, "weechat"); + newXS ("weechat::config_free", XS_weechat_api_config_free, "weechat"); + newXS ("weechat::config_get", XS_weechat_api_config_get, "weechat"); + newXS ("weechat::config_get_plugin", XS_weechat_api_config_get_plugin, "weechat"); + newXS ("weechat::config_set_plugin", XS_weechat_api_config_set_plugin, "weechat"); + newXS ("weechat::prefix", XS_weechat_api_prefix, "weechat"); + newXS ("weechat::color", XS_weechat_api_color, "weechat"); + newXS ("weechat::print", XS_weechat_api_print, "weechat"); + newXS ("weechat::print_date_tags", XS_weechat_api_print_date_tags, "weechat"); + newXS ("weechat::print_y", XS_weechat_api_print_y, "weechat"); + newXS ("weechat::log_print", XS_weechat_api_log_print, "weechat"); + newXS ("weechat::hook_command", XS_weechat_api_hook_command, "weechat"); + newXS ("weechat::hook_timer", XS_weechat_api_hook_timer, "weechat"); + newXS ("weechat::hook_fd", XS_weechat_api_hook_fd, "weechat"); + newXS ("weechat::hook_connect", XS_weechat_api_hook_connect, "weechat"); + newXS ("weechat::hook_print", XS_weechat_api_hook_print, "weechat"); + newXS ("weechat::hook_signal", XS_weechat_api_hook_signal, "weechat"); + newXS ("weechat::hook_signal_send", XS_weechat_api_hook_signal_send, "weechat"); + newXS ("weechat::hook_config", XS_weechat_api_hook_config, "weechat"); + newXS ("weechat::hook_completion", XS_weechat_api_hook_completion, "weechat"); + newXS ("weechat::hook_completion_list_add", XS_weechat_api_hook_completion_list_add, "weechat"); + newXS ("weechat::hook_modifier", XS_weechat_api_hook_modifier, "weechat"); + newXS ("weechat::hook_modifier_exec", XS_weechat_api_hook_modifier_exec, "weechat"); + newXS ("weechat::hook_info", XS_weechat_api_hook_info, "weechat"); + newXS ("weechat::hook_infolist", XS_weechat_api_hook_infolist, "weechat"); + newXS ("weechat::unhook", XS_weechat_api_unhook, "weechat"); + newXS ("weechat::unhook_all", XS_weechat_api_unhook_all, "weechat"); + newXS ("weechat::buffer_new", XS_weechat_api_buffer_new, "weechat"); + newXS ("weechat::buffer_search", XS_weechat_api_buffer_search, "weechat"); + newXS ("weechat::buffer_clear", XS_weechat_api_buffer_clear, "weechat"); + newXS ("weechat::buffer_close", XS_weechat_api_buffer_close, "weechat"); + newXS ("weechat::buffer_get_integer", XS_weechat_api_buffer_get_integer, "weechat"); + newXS ("weechat::buffer_get_string", XS_weechat_api_buffer_get_string, "weechat"); + newXS ("weechat::buffer_get_pointer", XS_weechat_api_buffer_get_pointer, "weechat"); + newXS ("weechat::buffer_set", XS_weechat_api_buffer_set, "weechat"); + newXS ("weechat::nicklist_add_group", XS_weechat_api_nicklist_add_group, "weechat"); + newXS ("weechat::nicklist_search_group", XS_weechat_api_nicklist_search_group, "weechat"); + newXS ("weechat::nicklist_add_nick", XS_weechat_api_nicklist_add_nick, "weechat"); + newXS ("weechat::nicklist_search_nick", XS_weechat_api_nicklist_search_nick, "weechat"); + newXS ("weechat::nicklist_remove_group", XS_weechat_api_nicklist_remove_group, "weechat"); + newXS ("weechat::nicklist_remove_nick", XS_weechat_api_nicklist_remove_nick, "weechat"); + newXS ("weechat::nicklist_remove_all", XS_weechat_api_nicklist_remove_all, "weechat"); + newXS ("weechat::bar_item_search", XS_weechat_api_bar_item_search, "weechat"); + newXS ("weechat::bar_item_new", XS_weechat_api_bar_item_new, "weechat"); + newXS ("weechat::bar_item_update", XS_weechat_api_bar_item_update, "weechat"); + newXS ("weechat::bar_item_remove", XS_weechat_api_bar_item_remove, "weechat"); + newXS ("weechat::bar_search", XS_weechat_api_bar_search, "weechat"); + newXS ("weechat::bar_new", XS_weechat_api_bar_new, "weechat"); + newXS ("weechat::bar_set", XS_weechat_api_bar_set, "weechat"); + newXS ("weechat::bar_update", XS_weechat_api_bar_update, "weechat"); + newXS ("weechat::bar_remove", XS_weechat_api_bar_remove, "weechat"); + newXS ("weechat::command", XS_weechat_api_command, "weechat"); + newXS ("weechat::info_get", XS_weechat_api_info_get, "weechat"); + newXS ("weechat::infolist_new", XS_weechat_api_infolist_new, "weechat"); + newXS ("weechat::infolist_new_var_integer", XS_weechat_api_infolist_new_var_integer, "weechat"); + newXS ("weechat::infolist_new_var_string", XS_weechat_api_infolist_new_var_string, "weechat"); + newXS ("weechat::infolist_new_var_pointer", XS_weechat_api_infolist_new_var_pointer, "weechat"); + newXS ("weechat::infolist_new_var_time", XS_weechat_api_infolist_new_var_time, "weechat"); + newXS ("weechat::infolist_get", XS_weechat_api_infolist_get, "weechat"); + newXS ("weechat::infolist_next", XS_weechat_api_infolist_next, "weechat"); + newXS ("weechat::infolist_prev", XS_weechat_api_infolist_prev, "weechat"); + newXS ("weechat::infolist_fields", XS_weechat_api_infolist_fields, "weechat"); + newXS ("weechat::infolist_integer", XS_weechat_api_infolist_integer, "weechat"); + newXS ("weechat::infolist_string", XS_weechat_api_infolist_string, "weechat"); + newXS ("weechat::infolist_pointer", XS_weechat_api_infolist_pointer, "weechat"); + newXS ("weechat::infolist_time", XS_weechat_api_infolist_time, "weechat"); + newXS ("weechat::infolist_free", XS_weechat_api_infolist_free, "weechat"); /* interface constants */ stash = gv_stashpv ("weechat", TRUE); diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c index 90f791c5f..0311d4bf9 100644 --- a/src/plugins/scripts/python/weechat-python-api.c +++ b/src/plugins/scripts/python/weechat-python-api.c @@ -116,6 +116,38 @@ weechat_python_api_register (PyObject *self, PyObject *args) } /* + * weechat_python_api_plugin_get_name: get name of plugin (return "core" for + * WeeChat core) + */ + +static PyObject * +weechat_python_api_plugin_get_name (PyObject *self, PyObject *args) +{ + char *plugin, *result; + + /* make C compiler happy */ + (void) self; + + if (!python_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("plugin_get_name"); + PYTHON_RETURN_EMPTY; + } + + plugin = NULL; + + if (!PyArg_ParseTuple (args, "s", &plugin)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("plugin_get_name"); + PYTHON_RETURN_EMPTY; + } + + result = weechat_plugin_get_name (script_str2ptr (plugin)); + + PYTHON_RETURN_STRING(result); +} + +/* * weechat_python_api_charset_set: set script charset */ @@ -4588,6 +4620,7 @@ weechat_python_api_infolist_free (PyObject *self, PyObject *args) PyMethodDef weechat_python_funcs[] = { { "register", &weechat_python_api_register, METH_VARARGS, "" }, + { "plugin_get_name", &weechat_python_api_plugin_get_name, METH_VARARGS, "" }, { "charset_set", &weechat_python_api_charset_set, METH_VARARGS, "" }, { "iconv_to_internal", &weechat_python_api_iconv_to_internal, METH_VARARGS, "" }, { "iconv_from_internal", &weechat_python_api_iconv_from_internal, METH_VARARGS, "" }, diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c index 9e3d1c81d..0518cfd67 100644 --- a/src/plugins/scripts/ruby/weechat-ruby-api.c +++ b/src/plugins/scripts/ruby/weechat-ruby-api.c @@ -134,6 +134,42 @@ weechat_ruby_api_register (VALUE class, VALUE name, VALUE author, } /* + * weechat_ruby_api_plugin_get_name: get name of plugin (return "core" for + * WeeChat core) + */ + +static VALUE +weechat_ruby_api_plugin_get_name (VALUE class, VALUE plugin) +{ + char *c_plugin, *result; + + /* make C compiler happy */ + (void) class; + + if (!ruby_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("plugin_get_name"); + RUBY_RETURN_EMPTY; + } + + c_plugin = NULL; + + if (NIL_P (plugin)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("plugin_get_name"); + RUBY_RETURN_EMPTY; + } + + Check_Type (plugin, T_STRING); + + c_plugin = STR2CSTR (plugin); + + result = weechat_plugin_get_name (script_str2ptr (c_plugin)); + + RUBY_RETURN_STRING(result); +} + +/* * weechat_ruby_api_charset_set: set script charset */ @@ -5294,6 +5330,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat) rb_define_const(ruby_mWeechat, "WEECHAT_HOOK_SIGNAL_POINTER", rb_str_new2(WEECHAT_HOOK_SIGNAL_POINTER)); rb_define_module_function (ruby_mWeechat, "register", &weechat_ruby_api_register, 7); + rb_define_module_function (ruby_mWeechat, "plugin_get_name", &weechat_ruby_api_plugin_get_name, 1); rb_define_module_function (ruby_mWeechat, "charset_set", &weechat_ruby_api_charset_set, 1); rb_define_module_function (ruby_mWeechat, "iconv_to_internal", &weechat_ruby_api_iconv_to_internal, 2); rb_define_module_function (ruby_mWeechat, "iconv_from_internal", &weechat_ruby_api_iconv_from_internal, 2); diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c index dab0560a4..2de706169 100644 --- a/src/plugins/scripts/tcl/weechat-tcl-api.c +++ b/src/plugins/scripts/tcl/weechat-tcl-api.c @@ -220,6 +220,40 @@ weechat_tcl_api_register (ClientData clientData, Tcl_Interp *interp, int objc, } /* + * weechat::plugin_get_name: get name of plugin (return "core" for WeeChat core) + */ + +static int +weechat_tcl_api_plugin_get_name (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) +{ + Tcl_Obj* objp; + char *result, *plugin; + int i; + + /* make C compiler happy */ + (void) clientData; + + if (!tcl_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("plugin_get_name"); + TCL_RETURN_EMPTY; + } + + if (objc < 2) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("plugin_get_name"); + TCL_RETURN_EMPTY; + } + + plugin = Tcl_GetStringFromObj (objv[1], &i); + + result = weechat_plugin_get_name (script_str2ptr (plugin)); + + TCL_RETURN_STRING(result); +} + +/* * weechat::charset_set: set script charset */ @@ -4951,6 +4985,8 @@ void weechat_tcl_api_init (Tcl_Interp *interp) { /* interface functions */ Tcl_CreateObjCommand (interp,"weechat::register", weechat_tcl_api_register, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); + Tcl_CreateObjCommand (interp,"weechat::plugin_get_name", + weechat_tcl_api_plugin_get_name, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp,"weechat::charset_set", weechat_tcl_api_charset_set, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp,"weechat::iconv_to_internal", diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index 8cd5405d9..9b1242b80 100644 --- a/src/plugins/weechat-plugin.h +++ b/src/plugins/weechat-plugin.h @@ -119,6 +119,9 @@ struct t_weechat_plugin at the END of functions, for keeping backward compatibility with existing plugins */ + /* plugins */ + char *(*plugin_get_name) (struct t_weechat_plugin *plugin); + /* strings */ void (*charset_set) (struct t_weechat_plugin *plugin, const char *charset); char *(*iconv_to_internal) (const char *charset, const char *string); @@ -552,6 +555,10 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin); /* macros for easy call to plugin API */ +/* plugins */ +#define weechat_plugin_get_name(__plugin) \ + weechat_plugin->plugin_get_name(__plugin) + /* strings */ #define weechat_charset_set(__charset) \ weechat_plugin->charset_set(weechat_plugin, __charset) |