diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/wee-string.c | 63 | ||||
-rw-r--r-- | src/core/wee-string.h | 2 | ||||
-rw-r--r-- | src/plugins/alias/alias.c | 14 | ||||
-rw-r--r-- | src/plugins/demo/demo.c | 4 | ||||
-rw-r--r-- | src/plugins/fifo/fifo.c | 16 | ||||
-rw-r--r-- | src/plugins/logger/logger.c | 2 | ||||
-rw-r--r-- | src/plugins/plugin.c | 1 | ||||
-rw-r--r-- | src/plugins/scripts/lua/lua.c | 3 | ||||
-rw-r--r-- | src/plugins/scripts/perl/weechat-perl-api.c | 171 | ||||
-rw-r--r-- | src/plugins/scripts/perl/weechat-perl.c | 51 | ||||
-rw-r--r-- | src/plugins/scripts/python/python.c | 5 | ||||
-rw-r--r-- | src/plugins/scripts/ruby/ruby.c | 5 | ||||
-rw-r--r-- | src/plugins/scripts/script.c | 89 | ||||
-rw-r--r-- | src/plugins/scripts/script.h | 19 | ||||
-rw-r--r-- | src/plugins/weechat-plugin.h | 11 |
15 files changed, 315 insertions, 141 deletions
diff --git a/src/core/wee-string.c b/src/core/wee-string.c index 1363d5a6d..61aacd5ec 100644 --- a/src/core/wee-string.c +++ b/src/core/wee-string.c @@ -157,6 +157,69 @@ string_strncasecmp (char *string1, char *string2, int max) } /* + * string_strcmp_ignore_chars: compare 2 strings, ignoring ignore some chars + */ + +int +string_strcmp_ignore_chars (char *string1, char *string2, char *chars_ignored, + int case_sensitive) +{ + int diff; + + if (!string1 && !string2) + return 0; + if (!string1 && string2) + return -1; + if (string1 && !string2) + return 1; + + while (string1 && string1[0] && string2 && string2[0]) + { + /* skip digits */ + while (string1 && string1[0] && strchr (chars_ignored, string1[0])) + { + string1 = utf8_next_char (string1); + } + while (string2 && string2[0] && strchr (chars_ignored, string2[0])) + { + string2 = utf8_next_char (string2); + } + + /* end of one (or both) string(s) ? */ + if ((!string1 || !string1[0]) && (!string2 || !string2[0])) + return 0; + if ((!string1 || !string1[0]) && string2 && string2[0]) + return -1; + if (string1 && string1[0] && (!string2 || !string2[0])) + return 1; + + /* look at diff */ + diff = (case_sensitive) ? + (int)string1[0] - (int)string2[0] : utf8_charcasecmp (string1, string2); + if (diff != 0) + return diff; + + string1 = utf8_next_char (string1); + string2 = utf8_next_char (string2); + + /* skip digits */ + while (string1 && string1[0] && strchr (chars_ignored, string1[0])) + { + string1 = utf8_next_char (string1); + } + while (string2 && string2[0] && strchr (chars_ignored, string2[0])) + { + string2 = utf8_next_char (string2); + } + } + if ((!string1 || !string1[0]) && string2 && string2[0]) + return -1; + if (string1 && string1[0] && (!string2 || !string2[0])) + return 1; + return 0; +} + +/* * string_strcasestr: locale and case independent string search */ diff --git a/src/core/wee-string.h b/src/core/wee-string.h index 46f2af3e1..bcf0efa96 100644 --- a/src/core/wee-string.h +++ b/src/core/wee-string.h @@ -27,6 +27,8 @@ extern void string_tolower (char *string); extern void string_toupper (char *string); extern int string_strcasecmp (char *string1, char *string2); extern int string_strncasecmp (char *string1, char *string2, int max); +extern int string_strcmp_ignore_chars (char *string1, char *string2, + char *chars_ignored, int case_sensitive); extern char *string_strcasestr (char *string, char *search); extern char *string_replace (char *string, char *search, char *replace); extern char *string_remove_quotes (char *string, char *quotes); diff --git a/src/plugins/alias/alias.c b/src/plugins/alias/alias.c index bce60d65f..700c60230 100644 --- a/src/plugins/alias/alias.c +++ b/src/plugins/alias/alias.c @@ -195,7 +195,7 @@ alias_cb (void *data, struct t_gui_buffer *buffer, int argc, char **argv, weechat_printf (NULL, _("%s%s: error, circular reference when calling " "alias \"%s\""), - weechat_prefix ("error"), "Alias", + weechat_prefix ("error"), "alias", ptr_alias->name); return WEECHAT_RC_ERROR; } @@ -353,7 +353,7 @@ alias_get_final_command (struct t_alias *alias) weechat_printf (NULL, _("%s%s: error, circular reference when calling " "alias \"%s\""), - weechat_prefix ("error"), "Alias", + weechat_prefix ("error"), "alias", alias->name); return NULL; } @@ -434,7 +434,7 @@ alias_config_read_line (struct t_config_file *config_file, char *option_name, { weechat_printf (NULL, "%s%s: error creating alias \"%s\" => \"%s\"", - weechat_prefix ("error"), "Alias", + weechat_prefix ("error"), "alias", option_name, value); } } @@ -556,12 +556,12 @@ alias_config_reload_signal_cb (void *data, char *signal, char *type_data, { weechat_printf (NULL, _("%s%s: configuration file reloaded"), - weechat_prefix ("info"), "Alias"); + weechat_prefix ("info"), "alias"); return WEECHAT_RC_OK; } weechat_printf (NULL, _("%s%s: failed to reload configuration file"), - weechat_prefix ("error"), "Alias"); + weechat_prefix ("error"), "alias"); return WEECHAT_RC_ERROR; } @@ -601,7 +601,7 @@ alias_command_cb (void *data, struct t_gui_buffer *buffer, int argc, weechat_printf (NULL, _("%s%s: error creating alias \"%s\" " "=> \"%s\""), - weechat_prefix ("error"), "Alias", + weechat_prefix ("error"), "alias", alias_name, argv_eol[2]); return WEECHAT_RC_ERROR; } @@ -728,7 +728,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin) { weechat_printf (NULL, "%s%s: error creating configuration file \"%s\"", - weechat_prefix("error"), "Alias", + weechat_prefix("error"), "alias", ALIAS_CONFIG_FILENAME); return WEECHAT_RC_ERROR; } diff --git a/src/plugins/demo/demo.c b/src/plugins/demo/demo.c index 9df0bc912..8535963b6 100644 --- a/src/plugins/demo/demo.c +++ b/src/plugins/demo/demo.c @@ -251,7 +251,7 @@ demo_infolist_command_cb (void *data, struct t_gui_buffer *buffer, int argc, weechat_printf (NULL, _("%s%s: missing argument for \"%s\" command " "(try /help %s)"), - weechat_prefix ("error"), "Demo", + weechat_prefix ("error"), "demo", "demo_infolist", "demo_infolist"); return WEECHAT_RC_OK; @@ -279,7 +279,7 @@ demo_info_command_cb (void *data, struct t_gui_buffer *buffer, int argc, weechat_printf (NULL, _("%s%s: missing argument for \"%s\" command " "(try /help %s)"), - weechat_prefix ("error"), "Demo", + weechat_prefix ("error"), "demo", "demo_info", "demo_info"); return WEECHAT_RC_OK; diff --git a/src/plugins/fifo/fifo.c b/src/plugins/fifo/fifo.c index c1607314d..5cd3187cb 100644 --- a/src/plugins/fifo/fifo.c +++ b/src/plugins/fifo/fifo.c @@ -99,21 +99,21 @@ fifo_create () { weechat_printf (NULL, _("%s%s: pipe open"), - weechat_prefix ("info"), "Fifo"), + weechat_prefix ("info"), "fifo"), rc = 1; } else weechat_printf (NULL, _("%s%s: unable to open pipe (%s) for " "reading"), - weechat_prefix ("error"), "Fifo", + weechat_prefix ("error"), "fifo", fifo_filename); } else weechat_printf (NULL, _("%s%s: unable to create pipe for remote " "control (%s)"), - weechat_prefix ("error"), "Fifo", + weechat_prefix ("error"), "fifo", fifo_filename); } } @@ -153,7 +153,7 @@ fifo_remove () weechat_printf (NULL, _("%s%s: pipe closed"), - weechat_prefix ("info"), "Fifo"); + weechat_prefix ("info"), "fifo"); } /* @@ -185,7 +185,7 @@ fifo_exec (char *text) { weechat_printf (NULL, _("%s%s: error, invalid text received on pipe"), - weechat_prefix ("error"), "Fifo"); + weechat_prefix ("error"), "fifo"); return; } pos_msg[0] = '\0'; @@ -216,7 +216,7 @@ fifo_exec (char *text) { weechat_printf (NULL, _("%s%s: error, buffer not found for pipe data"), - weechat_prefix ("error"), "Fifo"); + weechat_prefix ("error"), "fifo"); return; } @@ -295,7 +295,7 @@ fifo_read () { weechat_printf (NULL, _("%s%s: error reading pipe, closing it"), - weechat_prefix ("error"), "Fifo"); + weechat_prefix ("error"), "fifo"); fifo_remove (); } else @@ -307,7 +307,7 @@ fifo_read () { weechat_printf (NULL, _("%s%s: error opening file, closing it"), - weechat_prefix ("error"), "Fifo"); + weechat_prefix ("error"), "fifo"); fifo_remove (); } else diff --git a/src/plugins/logger/logger.c b/src/plugins/logger/logger.c index 3c82642ce..3472efb97 100644 --- a/src/plugins/logger/logger.c +++ b/src/plugins/logger/logger.c @@ -260,7 +260,7 @@ logger_write_line (struct t_logger_buffer *logger_buffer, char *format, ...) { weechat_printf (NULL, _("%s%s: unable to write log file \"%s\""), - weechat_prefix ("error"), "Logger", + weechat_prefix ("error"), "logger", logger_buffer->log_filename); free (logger_buffer->log_filename); logger_buffer->log_filename = NULL; diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index 6405c3da9..f5cb53d31 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -235,6 +235,7 @@ plugin_load (char *filename) new_plugin->ngettext = &plugin_api_ngettext; new_plugin->strcasecmp = &string_strcasecmp; new_plugin->strncasecmp = &string_strncasecmp; + new_plugin->strcmp_ignore_chars = &string_strcmp_ignore_chars; new_plugin->strcasestr = &string_strcasestr; new_plugin->string_replace = &string_replace; new_plugin->string_explode = &string_explode; diff --git a/src/plugins/scripts/lua/lua.c b/src/plugins/scripts/lua/lua.c index 8ced9008b..36357ad02 100644 --- a/src/plugins/scripts/lua/lua.c +++ b/src/plugins/scripts/lua/lua.c @@ -2419,7 +2419,7 @@ weechat_lua_unload (t_weechat_plugin *plugin, t_plugin_script *script) "Unloading Lua script \"%s\"", script->name); - if (script->shutdown_func[0]) + if (script->shutdow_func && script->shutdown_func[0]) { r = weechat_lua_exec (plugin, script, SCRIPT_EXEC_INT, script->shutdown_func, NULL, NULL, NULL); @@ -2712,6 +2712,7 @@ weechat_plugin_init (t_weechat_plugin *plugin) plugin->mkdir_home (plugin, "lua"); plugin->mkdir_home (plugin, "lua/autoload"); + script_init (weechat_lua_plugin); weechat_script_auto_load (plugin, "lua", weechat_lua_load); /* init ok */ diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c index 14a0188f3..b532a44fc 100644 --- a/src/plugins/scripts/perl/weechat-perl-api.c +++ b/src/plugins/scripts/perl/weechat-perl-api.c @@ -44,7 +44,8 @@ extern void boot_DynaLoader (pTHX_ CV* cv); static XS (XS_weechat_register) { - char *name, *version, *shutdown_func, *description, *charset; + char *name, *author, *version, *license, *shutdown_func, *description; + char *charset; dXSARGS; /* make C compiler happy */ @@ -53,17 +54,25 @@ static XS (XS_weechat_register) perl_current_script = NULL; - if ((items < 4) || (items > 5)) + if (items < 5) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "register"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("register"); XSRETURN_NO; } name = SvPV (ST (0), PL_na); - version = SvPV (ST (1), PL_na); - shutdown_func = SvPV (ST (2), PL_na); - description = SvPV (ST (3), PL_na); - charset = (items == 5) ? SvPV (ST (4), PL_na) : NULL; + author = SvPV (ST (1), PL_na); + version = SvPV (ST (2), PL_na); + license = SvPV (ST (3), PL_na); + description = SvPV (ST (4), PL_na); + shutdown_func = NULL; + charset = NULL; + if (items > 5) + { + shutdown_func = SvPV (ST (5), PL_na); + if (items > 6) + charset = SvPV (ST (6), PL_na); + } if (script_search (weechat_perl_plugin, &perl_scripts, name)) { @@ -72,7 +81,7 @@ static XS (XS_weechat_register) weechat_gettext ("%s%s: unable to register script " "\"%s\" (another script already " "exists with this name)"), - weechat_prefix ("error"), "Perl", name); + weechat_prefix ("error"), "perl", name); XSRETURN_NO; } @@ -81,14 +90,14 @@ static XS (XS_weechat_register) &perl_scripts, (perl_current_script_filename) ? perl_current_script_filename : "", - name, version, shutdown_func, - description, charset); + name, author, version, license, + shutdown_func, description, charset); if (perl_current_script) { weechat_printf (NULL, weechat_gettext ("%s%s: registered script \"%s\", " "version %s (%s)"), - weechat_prefix ("info"), "Perl", + weechat_prefix ("info"), "perl", name, version, description); } else @@ -112,13 +121,13 @@ static XS (XS_weechat_charset_set) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "charset_set"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("charset_set"); XSRETURN_NO; } if (items < 1) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "charset_set"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("charset_set"); XSRETURN_NO; } @@ -142,13 +151,13 @@ static XS (XS_weechat_iconv_to_internal) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "iconv_to_internal"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("iconv_to_internal"); XSRETURN_EMPTY; } if (items < 1) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "iconv_to_internal"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("iconv_to_internal"); XSRETURN_EMPTY; } @@ -190,13 +199,13 @@ static XS (XS_weechat_iconv_from_internal) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "iconv_from_internal"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("iconv_from_internal"); XSRETURN_EMPTY; } if (items < 2) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "iconv_from_internal"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("iconv_from_internal"); XSRETURN_EMPTY; } @@ -228,13 +237,13 @@ static XS (XS_weechat_mkdir_home) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "mkdir_home"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("mkdir_home"); XSRETURN_NO; } if (items < 2) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "mkdir_home"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("mkdir_home"); XSRETURN_NO; } @@ -256,13 +265,13 @@ static XS (XS_weechat_mkdir) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "mkdir"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("mkdir"); XSRETURN_NO; } if (items < 2) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "mkdir"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("mkdir"); XSRETURN_NO; } @@ -286,13 +295,13 @@ static XS (XS_weechat_prefix) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "prefix"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("prefix"); XSRETURN_EMPTY; } if (items < 1) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "prefix"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("prefix"); XSRETURN_EMPTY; } @@ -321,13 +330,13 @@ static XS (XS_weechat_color) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "color"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("color"); XSRETURN_EMPTY; } if (items < 1) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "color"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("color"); XSRETURN_EMPTY; } @@ -356,13 +365,13 @@ static XS (XS_weechat_print) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "print"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("print"); XSRETURN_NO; } if (items < 1) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "print"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("print"); XSRETURN_NO; } @@ -397,13 +406,13 @@ static XS (XS_weechat_infobar_print) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "infobar_print"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("infobar_print"); XSRETURN_NO; } if (items < 3) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "infobar_print"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("infobar_print"); XSRETURN_NO; } @@ -429,7 +438,7 @@ static XS (XS_weechat_infobar_remove) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "infobar_remove"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("infobar_remove"); XSRETURN_NO; } @@ -451,13 +460,13 @@ static XS (XS_weechat_log_print) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "log_print"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("log_print"); XSRETURN_NO; } if (items < 1) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "log_print"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("log_print"); XSRETURN_NO; } @@ -524,13 +533,13 @@ static XS (XS_weechat_hook_command) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "hook_command"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("hook_command"); XSRETURN_NO; } if (items < 6) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "hook_command"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("hook_command"); XSRETURN_NO; } @@ -589,13 +598,13 @@ static XS (XS_weechat_hook_timer) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "hook_timer"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("hook_timer"); XSRETURN_NO; } if (items < 4) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "hook_timer"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("hook_timer"); XSRETURN_NO; } @@ -653,13 +662,13 @@ static XS (XS_weechat_hook_fd) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "hook_fd"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("hook_fd"); XSRETURN_NO; } if (items < 5) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "hook_fd"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("hook_fd"); XSRETURN_NO; } @@ -729,13 +738,13 @@ static XS (XS_weechat_hook_print) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "hook_print"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("hook_print"); XSRETURN_NO; } if (items < 4) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "hook_print"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("hook_print"); XSRETURN_NO; } @@ -817,13 +826,13 @@ static XS (XS_weechat_hook_signal) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "hook_signal"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("hook_signal"); XSRETURN_NO; } if (items < 2) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "hook_signal"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("hook_signal"); XSRETURN_NO; } @@ -850,13 +859,13 @@ static XS (XS_weechat_hook_signal_send) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "hook_signal_send"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("hook_signal_send"); XSRETURN_NO; } if (items < 3) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "hook_signal_send"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("hook_signal_send"); XSRETURN_NO; } @@ -914,13 +923,13 @@ static XS (XS_weechat_hook_config) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "hook_config"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("hook_config"); XSRETURN_NO; } if (items < 3) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "hook_config"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("hook_config"); XSRETURN_NO; } @@ -987,13 +996,13 @@ static XS (XS_weechat_hook_completion) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "hook_completion"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("hook_completion"); XSRETURN_NO; } if (items < 2) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "hook_completion"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("hook_completion"); XSRETURN_NO; } @@ -1020,13 +1029,13 @@ static XS (XS_weechat_unhook) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "unhook"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("unhook"); XSRETURN_NO; } if (items < 1) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "unhook"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("unhook"); XSRETURN_NO; } @@ -1050,7 +1059,7 @@ static XS (XS_weechat_unhook_all) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "unhook_all"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("unhook_all"); XSRETURN_NO; } @@ -1109,13 +1118,13 @@ static XS (XS_weechat_buffer_new) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "buffer_new"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("buffer_new"); XSRETURN_EMPTY; } if (items < 3) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "buffer_new"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_new"); XSRETURN_EMPTY; } @@ -1153,13 +1162,13 @@ static XS (XS_weechat_buffer_search) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "buffer_search"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("buffer_search"); XSRETURN_EMPTY; } if (items < 2) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "buffer_search"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_search"); XSRETURN_EMPTY; } @@ -1191,13 +1200,13 @@ static XS (XS_weechat_buffer_close) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "buffer_close"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("buffer_close"); XSRETURN_NO; } if (items < 2) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "buffer_close"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_close"); XSRETURN_NO; } @@ -1223,13 +1232,13 @@ static XS (XS_weechat_buffer_get) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "buffer_get"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("buffer_get"); XSRETURN_EMPTY; } if (items < 2) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "buffer_get"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_get"); XSRETURN_EMPTY; } @@ -1258,13 +1267,13 @@ static XS (XS_weechat_buffer_set) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "buffer_set"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("buffer_set"); XSRETURN_NO; } if (items < 3) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "buffer_set"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_set"); XSRETURN_NO; } @@ -1290,13 +1299,13 @@ static XS (XS_weechat_nicklist_add_group) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "nicklist_add_group"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("nicklist_add_group"); XSRETURN_EMPTY; } if (items < 5) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "nicklist_add_group"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("nicklist_add_group"); XSRETURN_EMPTY; } @@ -1333,13 +1342,13 @@ static XS (XS_weechat_nicklist_search_group) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "nicklist_search_group"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("nicklist_search_group"); XSRETURN_EMPTY; } if (items < 3) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "nicklist_search_group"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("nicklist_search_group"); XSRETURN_EMPTY; } @@ -1374,13 +1383,13 @@ static XS (XS_weechat_nicklist_add_nick) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "nicklist_add_nick"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("nicklist_add_nick"); XSRETURN_EMPTY; } if (items < 7) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "nicklist_add_nick"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("nicklist_add_nick"); XSRETURN_EMPTY; } @@ -1424,13 +1433,13 @@ static XS (XS_weechat_nicklist_search_nick) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "nicklist_search_nick"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("nicklist_search_nick"); XSRETURN_EMPTY; } if (items < 3) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "nicklist_search_nick"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("nicklist_search_nick"); XSRETURN_EMPTY; } @@ -1463,13 +1472,13 @@ static XS (XS_weechat_nicklist_remove_group) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "nicklist_remove_group"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("nicklist_remove_group"); XSRETURN_NO; } if (items < 2) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "nicklist_remove_group"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("nicklist_remove_group"); XSRETURN_NO; } @@ -1492,13 +1501,13 @@ static XS (XS_weechat_nicklist_remove_nick) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "nicklist_remove_nick"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("nicklist_remove_nick"); XSRETURN_NO; } if (items < 2) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "nicklist_remove_nick"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("nicklist_remove_nick"); XSRETURN_NO; } @@ -1521,13 +1530,13 @@ static XS (XS_weechat_nicklist_remove_all) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "nicklist_remove_all"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("nicklist_remove_all"); XSRETURN_NO; } if (items < 2) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "nicklist_remove_all"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("nicklist_remove_all"); XSRETURN_NO; } @@ -1550,13 +1559,13 @@ static XS (XS_weechat_command) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "command"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("command"); XSRETURN_NO; } if (items < 1) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "command"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("command"); XSRETURN_NO; } @@ -1592,13 +1601,13 @@ static XS (XS_weechat_info_get) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "info_get"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("info_get"); XSRETURN_EMPTY; } if (items < 1) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "info_get"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("info_get"); XSRETURN_EMPTY; } @@ -1697,13 +1706,13 @@ static XS (XS_weechat_config_get_weechat) if (!perl_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("Perl", "config_get_weechat"); + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_get_weechat"); XSRETURN_EMPTY; } if (items < 1) { - WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("Perl", "config_get_weechat"); + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_get_weechat"); XSRETURN_EMPTY; } diff --git a/src/plugins/scripts/perl/weechat-perl.c b/src/plugins/scripts/perl/weechat-perl.c index 97d9870db..90b074e7d 100644 --- a/src/plugins/scripts/perl/weechat-perl.c +++ b/src/plugins/scripts/perl/weechat-perl.c @@ -149,7 +149,7 @@ weechat_perl_exec (struct t_plugin_script *script, { weechat_printf (NULL, weechat_gettext ("%s%s: error: %s"), - weechat_prefix ("error"), "Perl", SvPV_nolen (ERRSV)); + weechat_prefix ("error"), "perl", SvPV_nolen (ERRSV)); (void) POPs; /* poping the 'undef' */ mem_err = 0; } @@ -160,7 +160,7 @@ weechat_perl_exec (struct t_plugin_script *script, weechat_printf (NULL, weechat_gettext ("%s%s: function \"%s\" must " "return one valid value (%d)"), - weechat_prefix ("error"), "Perl", function, count); + weechat_prefix ("error"), "perl", function, count); mem_err = 0; } else @@ -183,7 +183,7 @@ weechat_perl_exec (struct t_plugin_script *script, weechat_printf (NULL, weechat_gettext ("%s%s: function \"%s\" is " "internally misused"), - weechat_prefix ("error"), "Perl", function); + weechat_prefix ("error"), "perl", function); mem_err = 0; } } @@ -202,7 +202,7 @@ weechat_perl_exec (struct t_plugin_script *script, weechat_printf (NULL, weechat_gettext ("%s%s: not enough memory in function " "\"%s\""), - weechat_prefix ("error"), "Perl", function); + weechat_prefix ("error"), "perl", function); return NULL; } @@ -231,13 +231,13 @@ weechat_perl_load (char *filename) weechat_printf (NULL, weechat_gettext ("%s%s: loading Perl script \"%s\""), - weechat_prefix ("info"), "Perl", filename); + weechat_prefix ("info"), "perl", filename); if (stat (filename, &buf) != 0) { weechat_printf (NULL, weechat_gettext ("%s%s: script \"%s\" not found"), - weechat_prefix ("error"), "Perl", filename); + weechat_prefix ("error"), "perl", filename); return 0; } @@ -261,7 +261,7 @@ weechat_perl_load (char *filename) weechat_printf (NULL, weechat_gettext ("%s%s: unable to create new " "sub-interpreter"), - weechat_prefix ("error"), "Perl"); + weechat_prefix ("error"), "perl"); return 0; } @@ -286,7 +286,7 @@ weechat_perl_load (char *filename) weechat_printf (NULL, weechat_gettext ("%s%s: not enough memory to parse " "file \"%s\""), - weechat_prefix ("error"), "Perl", filename); + weechat_prefix ("error"), "perl", filename); return 0; } @@ -297,10 +297,10 @@ weechat_perl_load (char *filename) weechat_printf (NULL, weechat_gettext ("%s%s: unable to parse file " "\"%s\""), - weechat_prefix ("error"), "Perl", filename); + weechat_prefix ("error"), "perl", filename); weechat_printf (NULL, weechat_gettext ("%s%s: error: %s"), - weechat_prefix ("error"), "Perl", + weechat_prefix ("error"), "perl", #ifndef MULTIPLICITY SvPV(perl_get_sv("WeechatPerlScriptLoader::" "weechat_perl_load_eval_file_error", @@ -315,14 +315,14 @@ weechat_perl_load (char *filename) { weechat_printf (NULL, weechat_gettext ("%s%s: unable to run file \"%s\""), - weechat_prefix ("error"), "Perl", filename); + weechat_prefix ("error"), "perl", filename); } else { weechat_printf (NULL, weechat_gettext ("%s%s: unknown error while " "loading file \"%s\""), - weechat_prefix ("error"), "Perl", filename); + weechat_prefix ("error"), "perl", filename); } #ifdef MULTIPLICITY perl_destruct (perl_current_interpreter); @@ -345,7 +345,7 @@ weechat_perl_load (char *filename) weechat_printf (NULL, weechat_gettext ("%s%s: function \"register\" not " "found (or failed) in file \"%s\""), - weechat_prefix ("error"), "Perl", filename); + weechat_prefix ("error"), "perl", filename); #ifdef MULTIPLICITY perl_destruct (perl_current_interpreter); perl_free (perl_current_interpreter); @@ -387,7 +387,7 @@ weechat_perl_unload (struct t_plugin_script *script) weechat_printf (NULL, weechat_gettext ("%s%s: unloading script \"%s\""), - weechat_prefix ("info"), "Perl", script->name); + weechat_prefix ("info"), "perl", script->name); #ifndef MULTIPLICITY eval_pv (script->interpreter, TRUE); @@ -395,7 +395,7 @@ weechat_perl_unload (struct t_plugin_script *script) PERL_SET_CONTEXT (script->interpreter); #endif - if (script->shutdown_func[0]) + if (script->shutdown_func && script->shutdown_func[0]) { r = (int *) weechat_perl_exec (script, WEECHAT_SCRIPT_EXEC_INT, @@ -431,13 +431,13 @@ weechat_perl_unload_name (char *name) weechat_perl_unload (ptr_script); weechat_printf (NULL, weechat_gettext ("%s%s: script \"%s\" unloaded"), - weechat_prefix ("info"), "Perl", name); + weechat_prefix ("info"), "perl", name); } else { weechat_printf (NULL, weechat_gettext ("%s%s: script \"%s\" not loaded"), - weechat_prefix ("error"), "Perl", name); + weechat_prefix ("error"), "perl", name); } } @@ -479,15 +479,17 @@ weechat_perl_command_cb (void *data, struct t_gui_buffer *buffer, weechat_printf (NULL, weechat_gettext ("Registered Perl scripts:")); if (perl_scripts) { - for (ptr_script = perl_scripts; - ptr_script; ptr_script = ptr_script->next_script) + for (ptr_script = perl_scripts; ptr_script; + ptr_script = ptr_script->next_script) { weechat_printf (NULL, - " %s v%s%s%s", + weechat_gettext (" %s v%s (%s), by %s, " + "license %s"), ptr_script->name, ptr_script->version, - (ptr_script->description[0]) ? " - " : "", - ptr_script->description); + ptr_script->description, + ptr_script->author, + ptr_script->license); } } else @@ -654,7 +656,7 @@ weechat_perl_command_cb (void *data, struct t_gui_buffer *buffer, weechat_printf (NULL, weechat_gettext ("%s%s: unknown option for " "command \"%s\""), - weechat_prefix ("error"), "Perl", "perl"); + weechat_prefix ("error"), "perl", "perl"); } } @@ -679,7 +681,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin) { weechat_printf (NULL, weechat_gettext ("%s%s: unable to initialize Perl"), - weechat_prefix ("error"), "Perl"); + weechat_prefix ("error"), "perl"); return WEECHAT_RC_ERROR; } @@ -703,6 +705,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin) weechat_mkdir_home ("perl", 0644); weechat_mkdir_home ("perl/autoload", 0644); + script_init (weechat_perl_plugin); script_auto_load (weechat_perl_plugin, "perl", &weechat_perl_load_cb); /* init ok */ diff --git a/src/plugins/scripts/python/python.c b/src/plugins/scripts/python/python.c index cdb6ad35c..6a243243e 100644 --- a/src/plugins/scripts/python/python.c +++ b/src/plugins/scripts/python/python.c @@ -2377,7 +2377,7 @@ weechat_python_unload (t_weechat_plugin *plugin, t_plugin_script *script) "Unloading Python script \"%s\"", script->name); - if (script->shutdown_func[0]) + if (script->shutdown_func && script->shutdown_func[0]) { r = (int *) weechat_python_exec (plugin, script, SCRIPT_EXEC_INT, script->shutdown_func, NULL, NULL, NULL); @@ -2694,7 +2694,8 @@ weechat_plugin_init (t_weechat_plugin *plugin) plugin->mkdir_home (plugin, "python"); plugin->mkdir_home (plugin, "python/autoload"); - + + script_init (weechat_python_plugin); weechat_script_auto_load (plugin, "python", weechat_python_load); /* init ok */ diff --git a/src/plugins/scripts/ruby/ruby.c b/src/plugins/scripts/ruby/ruby.c index fdf174c4d..f749465f3 100644 --- a/src/plugins/scripts/ruby/ruby.c +++ b/src/plugins/scripts/ruby/ruby.c @@ -2273,7 +2273,7 @@ weechat_ruby_unload (t_weechat_plugin *plugin, t_plugin_script *script) "Unloading Ruby script \"%s\"", script->name); - if (script->shutdown_func[0]) + if (script->shutdown_func && script->shutdown_func[0]) { r = (int *) weechat_ruby_exec (plugin, script, SCRIPT_EXEC_INT, script->shutdown_func, NULL, NULL, NULL); @@ -2675,7 +2675,8 @@ weechat_plugin_init (t_weechat_plugin *plugin) "Ruby error: %s", STR2CSTR(ruby_error_info)); return PLUGIN_RC_KO; } - + + script_init (weechat_ruby_plugin); weechat_script_auto_load (plugin, "ruby", weechat_ruby_load); /* init ok */ diff --git a/src/plugins/scripts/script.c b/src/plugins/scripts/script.c index 20ef057ba..dfdb6acd4 100644 --- a/src/plugins/scripts/script.c +++ b/src/plugins/scripts/script.c @@ -22,6 +22,7 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> +#include <ctype.h> #include <sys/types.h> #include <sys/stat.h> #include <dirent.h> @@ -31,6 +32,73 @@ #include "script-callback.h" +#define SCRIPT_OPTION_CHECK_LICENSE "check_license" + +int script_option_check_license = 0; + + +/* + * script_config_read: read config options + */ + +void +script_config_read (struct t_weechat_plugin *weechat_plugin) +{ + char *string; + + weechat_printf (NULL, "script_config_read"); + + string = weechat_config_get_plugin (SCRIPT_OPTION_CHECK_LICENSE); + if (!string) + { + weechat_config_set_plugin (SCRIPT_OPTION_CHECK_LICENSE, "on"); + string = weechat_config_get_plugin (SCRIPT_OPTION_CHECK_LICENSE); + } + if (string && (weechat_config_string_to_boolean (string) > 0)) + script_option_check_license = 1; + else + script_option_check_license = 0; +} + +/* + * script_config_cb: callback called when config option is changed + */ + +int +script_config_cb (void *data, char *type, char *option, char *value) +{ + (void) type; + (void) option; + (void) value; + + script_config_read (data); + + return WEECHAT_RC_OK; +} + +/* + * script_init: initialize script + */ + +void +script_init (struct t_weechat_plugin *weechat_plugin) +{ + char *option; + int length; + + script_config_read (weechat_plugin); + + length = strlen (weechat_plugin->name) + 32; + option= (char *)malloc (length); + if (option) + { + snprintf (option, length - 1, "%s.%s", + weechat_plugin->name, SCRIPT_OPTION_CHECK_LICENSE); + weechat_hook_config ("plugin", option, + &script_config_cb, (void *)weechat_plugin); + } +} + /* * script_pointer_to_string: convert pointer to string for usage * in a script (any language) @@ -211,9 +279,8 @@ struct t_plugin_script * script_add (struct t_weechat_plugin *weechat_plugin, struct t_plugin_script **script_list, char *filename, - char *name, char *version, - char *shutdown_func, char *description, - char *charset) + char *name, char *author, char *version, char *license, + char *shutdown_func, char *description, char *charset) { struct t_plugin_script *new_script; @@ -226,15 +293,29 @@ script_add (struct t_weechat_plugin *weechat_plugin, return NULL; } + if (script_option_check_license + && (weechat_strcmp_ignore_chars (weechat_plugin->license, license, + "0123456789-.,/\\()[]{}", 0) != 0)) + { + weechat_printf (NULL, + _("%s%s: warning, license \"%s\" for script \"%s\" " + "differs from plugin license (\"%s\")"), + weechat_prefix ("error"), weechat_plugin->name, + license, name, weechat_plugin->license); + } + new_script = (struct t_plugin_script *)malloc (sizeof (struct t_plugin_script)); if (new_script) { new_script->filename = strdup (filename); new_script->interpreter = NULL; new_script->name = strdup (name); + new_script->author = strdup (author); new_script->version = strdup (version); - new_script->shutdown_func = strdup (shutdown_func); + new_script->license = strdup (license); new_script->description = strdup (description); + new_script->shutdown_func = (shutdown_func) ? + strdup (shutdown_func) : NULL; new_script->charset = (charset) ? strdup (charset) : NULL; new_script->callbacks = NULL; diff --git a/src/plugins/scripts/script.h b/src/plugins/scripts/script.h index 61771976f..218a0942c 100644 --- a/src/plugins/scripts/script.h +++ b/src/plugins/scripts/script.h @@ -23,17 +23,19 @@ #define WEECHAT_SCRIPT_EXEC_INT 1 #define WEECHAT_SCRIPT_EXEC_STRING 2 -#define WEECHAT_SCRIPT_MSG_NOT_INITIALIZED(__language, __function) \ +#define WEECHAT_SCRIPT_MSG_NOT_INITIALIZED(__function) \ weechat_printf (NULL, \ weechat_gettext("%s%s: unable to call function " \ "\"%s\", script is not " \ "initialized"), \ - weechat_prefix ("error"), __language, __function) -#define WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS(__language, __function) \ + weechat_prefix ("error"), weechat_plugin->name, \ + __function) +#define WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS(__function) \ weechat_printf (NULL, \ weechat_gettext("%s%s: wrong arguments for " \ "function \"%s\""), \ - weechat_prefix ("error"), __language, __function) + weechat_prefix ("error"), weechat_plugin->name, \ + __function) struct t_plugin_script { @@ -41,8 +43,10 @@ struct t_plugin_script char *filename; /* name of script on disk */ void *interpreter; /* interpreter for script */ char *name; /* script name */ - char *description; /* plugin description */ + char *author; /* author name/mail */ char *version; /* plugin version */ + char *license; /* script license */ + char *description; /* plugin description */ char *shutdown_func; /* function when script is unloaded*/ char *charset; /* script charset */ @@ -52,6 +56,7 @@ struct t_plugin_script struct t_plugin_script *next_script; /* link to next script */ }; +extern void script_init (struct t_weechat_plugin *weechat_plugin); extern char *script_pointer_to_string (void *pointer); extern void *script_string_to_pointer (char *pointer_str); extern void script_auto_load (struct t_weechat_plugin *weechat_plugin, @@ -65,8 +70,8 @@ extern char *script_search_full_name (struct t_weechat_plugin *weechat_plugin, extern struct t_plugin_script *script_add (struct t_weechat_plugin *weechat_plugin, struct t_plugin_script **script_list, char *filename, char *name, - char *version, - char *shutdown_func, + char *author, char *version, + char *license, char *shutdown_func, char *description, char *charset); extern void script_remove (struct t_weechat_plugin *weechat_plugin, diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index 247d12cc6..5815d7343 100644 --- a/src/plugins/weechat-plugin.h +++ b/src/plugins/weechat-plugin.h @@ -96,6 +96,8 @@ struct t_weechat_plugin char *(*ngettext) (char *single, char *plural, int count); int (*strcasecmp) (char *string1, char *string2); int (*strncasecmp) (char *string1, char *string2, int max); + int (*strcmp_ignore_chars) (char *string1, char *string2, + char *chars_ignored, int case_sensitive); char *(*strcasestr) (char *string1, char *string2); char *(*string_replace) (char *string, char *search, char *replace); char **(*string_explode) (char *string, char *separators, int keep_eol, @@ -338,6 +340,11 @@ struct t_weechat_plugin weechat_plugin->strcasecmp(__string1, __string2) #define weechat_strncasecmp(__string1, __string2, __max) \ weechat_plugin->strncasecmp(__string1, __string2, __max) +#define weechat_strcmp_ignore_chars(__string1, __string2, \ + __chars_ignored, __case_sensitive) \ + weechat_plugin->strcmp_ignore_chars(__string1, __string2, \ + __chars_ignored, \ + __case_sensitive) #define weechat_strcasestr(__string1, __string2) \ weechat_plugin->strcasestr(__string1, __string2) #define weechat_string_replace(__string, __search, __replace) \ @@ -372,8 +379,8 @@ struct t_weechat_plugin weechat_plugin->utf8_strnlen(__string, __bytes) #define weechat_utf8_strlen_screen(__string) \ weechat_plugin->utf8_strlen_screen(__string) -#define weechat_utf8_charcasecmp(__string) \ - weechat_plugin->utf8_charcasecmp(__string) +#define weechat_utf8_charcasecmp(__string1, __string2) \ + weechat_plugin->utf8_charcasecmp(__string1, __string2) #define weechat_utf8_char_size_screen(__string) \ weechat_plugin->utf8_char_size_screen(__string) #define weechat_utf8_add_offset(__string, __offset) \ |