New arguments for function "register" in scripts (author, license), with optional check of license when script is loaded

v2.8-utf8proc
Sebastien Helleu 2008-01-11 15:08:36 +01:00
parent 8a67299912
commit add64d6f47
22 changed files with 395 additions and 149 deletions

View File

@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2008-01-09 15:15+0100\n"
"POT-Creation-Date: 2008-01-11 14:53+0100\n"
"PO-Revision-Date: 2007-09-06 12:44+0200\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -4159,6 +4159,10 @@ msgstr "%s server \"%s\" nenalezen\n"
msgid "Registered Perl scripts:"
msgstr ""
#, c-format
msgid " %s v%s (%s), by %s, license %s"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: unknown option for command \"%s\""
msgstr "%s neznámá volba pro příkaz \"%s\"\n"
@ -4188,6 +4192,12 @@ msgstr ""
msgid "%s: error loading script \"%s\" (bad name, spaces are forbidden)"
msgstr ""
#, c-format
msgid ""
"%s%s: warning, license \"%s\" for script \"%s\" differs from plugin license "
"(\"%s\")"
msgstr ""
#, fuzzy, c-format
msgid "%s: error loading script \"%s\" (not enough memory)"
msgstr "%s nemohu načíst plugin \"%s\" (nedostatek paměti)\n"

View File

@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2008-01-09 15:15+0100\n"
"POT-Creation-Date: 2008-01-11 14:53+0100\n"
"PO-Revision-Date: 2007-09-06 12:44+0200\n"
"Last-Translator: Thomas Schuetz <i18n@internet-villa.de>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -4156,6 +4156,10 @@ msgstr "%s Server \"%s\" nicht gefunden\n"
msgid "Registered Perl scripts:"
msgstr ""
#, c-format
msgid " %s v%s (%s), by %s, license %s"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: unknown option for command \"%s\""
msgstr "%s unbekannte Option für den \"%s\"-Befehl\n"
@ -4185,6 +4189,12 @@ msgstr ""
msgid "%s: error loading script \"%s\" (bad name, spaces are forbidden)"
msgstr ""
#, c-format
msgid ""
"%s%s: warning, license \"%s\" for script \"%s\" differs from plugin license "
"(\"%s\")"
msgstr ""
#, fuzzy, c-format
msgid "%s: error loading script \"%s\" (not enough memory)"
msgstr "%s kann das Plugin \"%s\" nicht laden (Speichermangel)\n"

View File

@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2008-01-09 15:15+0100\n"
"POT-Creation-Date: 2008-01-11 14:53+0100\n"
"PO-Revision-Date: 2007-09-19 12:09+0200\n"
"Last-Translator: Roberto González Cardenete <robert.glez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -4170,6 +4170,10 @@ msgstr "%s servidor \"%s\" no encontrado\n"
msgid "Registered Perl scripts:"
msgstr ""
#, c-format
msgid " %s v%s (%s), by %s, license %s"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: unknown option for command \"%s\""
msgstr "%s opción desconocida para el comando \"%s\"\n"
@ -4197,6 +4201,12 @@ msgstr ""
msgid "%s: error loading script \"%s\" (bad name, spaces are forbidden)"
msgstr ""
#, c-format
msgid ""
"%s%s: warning, license \"%s\" for script \"%s\" differs from plugin license "
"(\"%s\")"
msgstr ""
#, fuzzy, c-format
msgid "%s: error loading script \"%s\" (not enough memory)"
msgstr ""

View File

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2008-01-09 15:15+0100\n"
"PO-Revision-Date: 2008-01-09 15:17+0100\n"
"POT-Creation-Date: 2008-01-11 14:53+0100\n"
"PO-Revision-Date: 2008-01-11 14:55+0100\n"
"Last-Translator: FlashCode <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"MIME-Version: 1.0\n"
@ -4080,6 +4080,10 @@ msgstr "%s%s: script \"%s\" non chargé"
msgid "Registered Perl scripts:"
msgstr "Scripts Perl chargés:"
#, c-format
msgid " %s v%s (%s), by %s, license %s"
msgstr " %s v%s (%s), par %s, licence %s"
#, c-format
msgid "%s%s: unknown option for command \"%s\""
msgstr "%s%s: option inconnue pour la commande \"%s\""
@ -4111,6 +4115,14 @@ msgstr ""
"%s: erreur de chargement du script \"%s\" (mauvais nom, les espaces sont "
"interdits)"
#, c-format
msgid ""
"%s%s: warning, license \"%s\" for script \"%s\" differs from plugin license "
"(\"%s\")"
msgstr ""
"%s%s: attention, la licence \"%s\" pour le script \"%s\" diffère de la "
"licence de l'extension (\"%s\")"
#, c-format
msgid "%s: error loading script \"%s\" (not enough memory)"
msgstr "%s: erreur de chargement du script \"%s\" (mémoire insuffisante)"

View File

@ -12,7 +12,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2008-01-09 15:15+0100\n"
"POT-Creation-Date: 2008-01-11 14:53+0100\n"
"PO-Revision-Date: 2007-10-10 18:07+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -4159,6 +4159,10 @@ msgstr "%s a \"%s\" szerver nem található\n"
msgid "Registered Perl scripts:"
msgstr ""
#, c-format
msgid " %s v%s (%s), by %s, license %s"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: unknown option for command \"%s\""
msgstr "%s ismeretlen opció a \"%s\" parancsnak\n"
@ -4188,6 +4192,12 @@ msgstr ""
msgid "%s: error loading script \"%s\" (bad name, spaces are forbidden)"
msgstr ""
#, c-format
msgid ""
"%s%s: warning, license \"%s\" for script \"%s\" differs from plugin license "
"(\"%s\")"
msgstr ""
#, fuzzy, c-format
msgid "%s: error loading script \"%s\" (not enough memory)"
msgstr "%s nem sikerült a modult betölteni \"%s\" (nincs elég memória)\n"

View File

@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2008-01-09 15:15+0100\n"
"POT-Creation-Date: 2008-01-11 14:53+0100\n"
"PO-Revision-Date: 2007-09-06 12:44+0200\n"
"Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -4141,6 +4141,10 @@ msgstr "%s сервер \"%s\" не найден\n"
msgid "Registered Perl scripts:"
msgstr ""
#, c-format
msgid " %s v%s (%s), by %s, license %s"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: unknown option for command \"%s\""
msgstr "%s неизвестный параметр для команды \"%s\"\n"
@ -4170,6 +4174,12 @@ msgstr ""
msgid "%s: error loading script \"%s\" (bad name, spaces are forbidden)"
msgstr ""
#, c-format
msgid ""
"%s%s: warning, license \"%s\" for script \"%s\" differs from plugin license "
"(\"%s\")"
msgstr ""
#, fuzzy, c-format
msgid "%s: error loading script \"%s\" (not enough memory)"
msgstr "%s не могу загрузить plugin \"%s\" (недостаточно памяти)\n"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2008-01-09 15:15+0100\n"
"POT-Creation-Date: 2008-01-11 14:53+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -3611,6 +3611,10 @@ msgstr ""
msgid "Registered Perl scripts:"
msgstr ""
#, c-format
msgid " %s v%s (%s), by %s, license %s"
msgstr ""
#, c-format
msgid "%s%s: unknown option for command \"%s\""
msgstr ""
@ -3636,6 +3640,12 @@ msgstr ""
msgid "%s: error loading script \"%s\" (bad name, spaces are forbidden)"
msgstr ""
#, c-format
msgid ""
"%s%s: warning, license \"%s\" for script \"%s\" differs from plugin license "
"(\"%s\")"
msgstr ""
#, c-format
msgid "%s: error loading script \"%s\" (not enough memory)"
msgstr ""

View File

@ -156,6 +156,69 @@ string_strncasecmp (char *string1, char *string2, int max)
return (string1[0]) ? 1 : ((string2[0]) ? -1 : 0);
}
/*
* 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
*/

View File

@ -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);

View File

@ -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;
}

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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 */

View File

@ -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;
}

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -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;

View File

@ -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,

View File

@ -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) \