summaryrefslogtreecommitdiff
path: root/src/plugins/scripts
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2008-09-18 18:44:03 +0200
committerSebastien Helleu <flashcode@flashtux.org>2008-09-18 18:44:03 +0200
commitc572e393e7399d125b543f4102d1baeb3b3b8391 (patch)
tree885fe3b4307148b377c3f5233c98e322a603c734 /src/plugins/scripts
parentc3df7da6411a44da6b9fc0f52700372a1d074758 (diff)
downloadweechat-c572e393e7399d125b543f4102d1baeb3b3b8391.zip
Remove "category" for buffers (keep only name).
Diffstat (limited to 'src/plugins/scripts')
-rw-r--r--src/plugins/scripts/lua/weechat-lua-api.c28
-rw-r--r--src/plugins/scripts/lua/weechat-lua.c32
-rw-r--r--src/plugins/scripts/lua/weechat-lua.h1
-rw-r--r--src/plugins/scripts/perl/weechat-perl-api.c28
-rw-r--r--src/plugins/scripts/perl/weechat-perl.c47
-rw-r--r--src/plugins/scripts/perl/weechat-perl.h1
-rw-r--r--src/plugins/scripts/python/weechat-python-api.c24
-rw-r--r--src/plugins/scripts/python/weechat-python.c49
-rw-r--r--src/plugins/scripts/python/weechat-python.h1
-rw-r--r--src/plugins/scripts/ruby/weechat-ruby-api.c41
-rw-r--r--src/plugins/scripts/ruby/weechat-ruby.c52
-rw-r--r--src/plugins/scripts/ruby/weechat-ruby.h1
-rw-r--r--src/plugins/scripts/script-api.c10
-rw-r--r--src/plugins/scripts/script-api.h2
14 files changed, 149 insertions, 168 deletions
diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c
index 9f4f1dd12..d540e8f76 100644
--- a/src/plugins/scripts/lua/weechat-lua-api.c
+++ b/src/plugins/scripts/lua/weechat-lua-api.c
@@ -100,7 +100,7 @@ weechat_lua_api_register (lua_State *L)
weechat_gettext ("%s%s: unable to register script "
"\"%s\" (another script already "
"exists with this name)"),
- weechat_prefix ("error"), "lua", name);
+ weechat_prefix ("error"), LUA_PLUGIN_NAME, name);
LUA_RETURN_ERROR;
}
@@ -121,7 +121,7 @@ weechat_lua_api_register (lua_State *L)
weechat_printf (NULL,
weechat_gettext ("%s: registered script \"%s\", "
"version %s (%s)"),
- "lua", name, version, description);
+ LUA_PLUGIN_NAME, name, version, description);
}
else
{
@@ -2092,12 +2092,6 @@ weechat_lua_api_print (lua_State *L)
/* make C compiler happy */
(void) L;
- if (!lua_current_script)
- {
- WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("print");
- LUA_RETURN_ERROR;
- }
-
buffer = NULL;
message = NULL;
@@ -3354,7 +3348,7 @@ weechat_lua_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
static int
weechat_lua_api_buffer_new (lua_State *L)
{
- const char *category, *name, *function_input, *function_close;
+ const char *name, *function_input, *function_close;
char *result;
int n;
@@ -3367,27 +3361,24 @@ weechat_lua_api_buffer_new (lua_State *L)
LUA_RETURN_EMPTY;
}
- category = NULL;
name = NULL;
function_input = NULL;
function_close = NULL;
n = lua_gettop (lua_current_interpreter);
- if (n < 4)
+ if (n < 3)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_new");
LUA_RETURN_EMPTY;
}
- category = lua_tostring (lua_current_interpreter, -4);
name = lua_tostring (lua_current_interpreter, -3);
function_input = lua_tostring (lua_current_interpreter, -2);
function_close = lua_tostring (lua_current_interpreter, -1);
result = script_ptr2str (script_api_buffer_new (weechat_lua_plugin,
lua_current_script,
- category,
name,
&weechat_lua_api_buffer_input_data_cb,
function_input,
@@ -3404,20 +3395,20 @@ weechat_lua_api_buffer_new (lua_State *L)
static int
weechat_lua_api_buffer_search (lua_State *L)
{
- const char *category, *name;
+ const char *plugin, *name;
char *result;
int n;
/* make C compiler happy */
(void) L;
-
+
if (!lua_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("buffer_search");
LUA_RETURN_EMPTY;
}
- category = NULL;
+ plugin = NULL;
name = NULL;
n = lua_gettop (lua_current_interpreter);
@@ -3428,11 +3419,10 @@ weechat_lua_api_buffer_search (lua_State *L)
LUA_RETURN_EMPTY;
}
- category = lua_tostring (lua_current_interpreter, -2);
+ plugin = lua_tostring (lua_current_interpreter, -2);
name = lua_tostring (lua_current_interpreter, -1);
- result = script_ptr2str (weechat_buffer_search (category,
- name));
+ result = script_ptr2str (weechat_buffer_search (plugin, name));
LUA_RETURN_STRING_FREE(result);
}
diff --git a/src/plugins/scripts/lua/weechat-lua.c b/src/plugins/scripts/lua/weechat-lua.c
index 1f4b7e058..636d91c06 100644
--- a/src/plugins/scripts/lua/weechat-lua.c
+++ b/src/plugins/scripts/lua/weechat-lua.c
@@ -32,7 +32,7 @@
#include "weechat-lua-api.h"
-WEECHAT_PLUGIN_NAME("lua");
+WEECHAT_PLUGIN_NAME(LUA_PLUGIN_NAME);
WEECHAT_PLUGIN_DESCRIPTION("Lua plugin for WeeChat");
WEECHAT_PLUGIN_AUTHOR("FlashCode <flashcode@flashtux.org>");
WEECHAT_PLUGIN_VERSION(WEECHAT_VERSION);
@@ -96,10 +96,10 @@ weechat_lua_exec (struct t_plugin_script *script,
{
weechat_printf (NULL,
weechat_gettext ("%s%s: unable to run function \"%s\""),
- weechat_prefix ("error"), "lua", function);
+ weechat_prefix ("error"), LUA_PLUGIN_NAME, function);
weechat_printf (NULL,
weechat_gettext ("%s%s: error: %s"),
- weechat_prefix ("error"), "lua",
+ weechat_prefix ("error"), LUA_PLUGIN_NAME,
lua_tostring (lua_current_interpreter, -1));
lua_current_script = old_lua_current_script;
return NULL;
@@ -144,13 +144,13 @@ weechat_lua_load (const char *filename)
{
weechat_printf (NULL,
weechat_gettext ("%s%s: script \"%s\" not found"),
- weechat_prefix ("error"), "lua", filename);
+ weechat_prefix ("error"), LUA_PLUGIN_NAME, filename);
return 0;
}
weechat_printf (NULL,
weechat_gettext ("%s: loading script \"%s\""),
- "lua", filename);
+ LUA_PLUGIN_NAME, filename);
lua_current_script = NULL;
@@ -161,7 +161,7 @@ weechat_lua_load (const char *filename)
weechat_printf (NULL,
weechat_gettext ("%s%s: unable to create new "
"sub-interpreter"),
- weechat_prefix ("error"), "lua");
+ weechat_prefix ("error"), LUA_PLUGIN_NAME);
fclose (fp);
return 0;
}
@@ -188,7 +188,7 @@ weechat_lua_load (const char *filename)
weechat_printf (NULL,
weechat_gettext ("%s%s: unable to redirect stdout "
"and stderr"),
- weechat_prefix ("error"), "lua");
+ weechat_prefix ("error"), LUA_PLUGIN_NAME);
}
lua_current_script_filename = filename;
@@ -197,10 +197,10 @@ weechat_lua_load (const char *filename)
{
weechat_printf (NULL,
weechat_gettext ("%s%s: unable to load file \"%s\""),
- weechat_prefix ("error"), "lua", filename);
+ weechat_prefix ("error"), LUA_PLUGIN_NAME, filename);
weechat_printf (NULL,
weechat_gettext ("%s%s: error: %s"),
- weechat_prefix ("error"), "lua",
+ weechat_prefix ("error"), LUA_PLUGIN_NAME,
lua_tostring (lua_current_interpreter, -1));
lua_close (lua_current_interpreter);
fclose (fp);
@@ -212,10 +212,10 @@ weechat_lua_load (const char *filename)
weechat_printf (NULL,
weechat_gettext ("%s%s: unable to execute file "
"\"%s\""),
- weechat_prefix ("error"), "lua", filename);
+ weechat_prefix ("error"), LUA_PLUGIN_NAME, filename);
weechat_printf (NULL,
weechat_gettext ("%s%s: error: %s"),
- weechat_prefix ("error"), "lua",
+ weechat_prefix ("error"), LUA_PLUGIN_NAME,
lua_tostring (lua_current_interpreter, -1));
lua_close (lua_current_interpreter);
fclose (fp);
@@ -232,7 +232,7 @@ weechat_lua_load (const char *filename)
weechat_printf (NULL,
weechat_gettext ("%s%s: function \"register\" not "
"found (or failed) in file \"%s\""),
- weechat_prefix ("error"), "lua", filename);
+ weechat_prefix ("error"), LUA_PLUGIN_NAME, filename);
lua_close (lua_current_interpreter);
return 0;
}
@@ -268,7 +268,7 @@ weechat_lua_unload (struct t_plugin_script *script)
weechat_printf (NULL,
weechat_gettext ("%s: unloading script \"%s\""),
- "lua", script->name);
+ LUA_PLUGIN_NAME, script->name);
if (script->shutdown_func && script->shutdown_func[0])
{
@@ -302,13 +302,13 @@ weechat_lua_unload_name (const char *name)
weechat_lua_unload (ptr_script);
weechat_printf (NULL,
weechat_gettext ("%s: script \"%s\" unloaded"),
- "lua", name);
+ LUA_PLUGIN_NAME, name);
}
else
{
weechat_printf (NULL,
weechat_gettext ("%s%s: script \"%s\" not loaded"),
- weechat_prefix ("error"), "lua", name);
+ weechat_prefix ("error"), LUA_PLUGIN_NAME, name);
}
}
@@ -401,7 +401,7 @@ weechat_lua_command_cb (void *data, struct t_gui_buffer *buffer,
weechat_printf (NULL,
weechat_gettext ("%s%s: unknown option for "
"command \"%s\""),
- weechat_prefix ("error"), "lua", "lua");
+ weechat_prefix ("error"), LUA_PLUGIN_NAME, "lua");
}
}
diff --git a/src/plugins/scripts/lua/weechat-lua.h b/src/plugins/scripts/lua/weechat-lua.h
index 020ef5a5f..9ab24fd7b 100644
--- a/src/plugins/scripts/lua/weechat-lua.h
+++ b/src/plugins/scripts/lua/weechat-lua.h
@@ -21,6 +21,7 @@
#define __WEECHAT_LUA_H 1
#define weechat_plugin weechat_lua_plugin
+#define LUA_PLUGIN_NAME "lua"
extern struct t_weechat_plugin *weechat_lua_plugin;
diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c
index c7842db10..a206ec4d6 100644
--- a/src/plugins/scripts/perl/weechat-perl-api.c
+++ b/src/plugins/scripts/perl/weechat-perl-api.c
@@ -97,7 +97,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_PLUGIN_NAME, name);
PERL_RETURN_ERROR;
}
@@ -113,7 +113,7 @@ static XS (XS_weechat_register)
weechat_printf (NULL,
weechat_gettext ("%s: registered script \"%s\", "
"version %s (%s)"),
- "perl", name, version, description);
+ PERL_PLUGIN_NAME, name, version, description);
}
else
{
@@ -1727,12 +1727,6 @@ static XS (XS_weechat_print)
/* make C compiler happy */
(void) cv;
- if (!perl_current_script)
- {
- WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("print");
- PERL_RETURN_ERROR;
- }
-
if (items < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("print");
@@ -2822,7 +2816,7 @@ weechat_perl_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
static XS (XS_weechat_buffer_new)
{
- char *result, *category, *name, *function_input, *function_close;
+ char *result, *name, *function_input, *function_close;
dXSARGS;
/* make C compiler happy */
@@ -2834,19 +2828,17 @@ static XS (XS_weechat_buffer_new)
PERL_RETURN_EMPTY;
}
- if (items < 4)
+ if (items < 3)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_new");
PERL_RETURN_EMPTY;
}
- category = SvPV (ST (0), PL_na);
- name = SvPV (ST (1), PL_na);
- function_input = SvPV (ST (2), PL_na);
- function_close = SvPV (ST (3), PL_na);
+ name = SvPV (ST (0), PL_na);
+ function_input = SvPV (ST (1), PL_na);
+ function_close = SvPV (ST (2), PL_na);
result = script_ptr2str (script_api_buffer_new (weechat_perl_plugin,
perl_current_script,
- category,
name,
&weechat_perl_api_buffer_input_data_cb,
function_input,
@@ -2862,7 +2854,7 @@ static XS (XS_weechat_buffer_new)
static XS (XS_weechat_buffer_search)
{
- char *result, *category, *name;
+ char *result, *plugin, *name;
dXSARGS;
/* make C compiler happy */
@@ -2880,9 +2872,9 @@ static XS (XS_weechat_buffer_search)
PERL_RETURN_EMPTY;
}
- category = SvPV (ST (0), PL_na);
+ plugin = SvPV (ST (0), PL_na);
name = SvPV (ST (1), PL_na);
- result = script_ptr2str (weechat_buffer_search (category, name));
+ result = script_ptr2str (weechat_buffer_search (plugin, name));
PERL_RETURN_STRING_FREE(result);
}
diff --git a/src/plugins/scripts/perl/weechat-perl.c b/src/plugins/scripts/perl/weechat-perl.c
index 21266aa13..bad90baad 100644
--- a/src/plugins/scripts/perl/weechat-perl.c
+++ b/src/plugins/scripts/perl/weechat-perl.c
@@ -30,7 +30,7 @@
#include "weechat-perl-api.h"
-WEECHAT_PLUGIN_NAME("perl");
+WEECHAT_PLUGIN_NAME(PERL_PLUGIN_NAME);
WEECHAT_PLUGIN_DESCRIPTION("Perl plugin for WeeChat");
WEECHAT_PLUGIN_AUTHOR("FlashCode <flashcode@flashtux.org>");
WEECHAT_PLUGIN_VERSION(WEECHAT_VERSION);
@@ -153,7 +153,8 @@ 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_PLUGIN_NAME,
+ SvPV_nolen (ERRSV));
(void) POPs; /* poping the 'undef' */
mem_err = 0;
}
@@ -164,7 +165,8 @@ 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_PLUGIN_NAME,
+ function, count);
mem_err = 0;
}
else
@@ -187,7 +189,8 @@ 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_PLUGIN_NAME,
+ function);
mem_err = 0;
}
}
@@ -206,7 +209,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_PLUGIN_NAME, function);
return NULL;
}
@@ -245,13 +248,13 @@ weechat_perl_load (const char *filename)
{
weechat_printf (NULL,
weechat_gettext ("%s%s: script \"%s\" not found"),
- weechat_prefix ("error"), "perl", filename);
+ weechat_prefix ("error"), PERL_PLUGIN_NAME, filename);
return 0;
}
weechat_printf (NULL,
weechat_gettext ("%s: loading script \"%s\""),
- "perl", filename);
+ PERL_PLUGIN_NAME, filename);
perl_current_script = NULL;
@@ -263,7 +266,7 @@ weechat_perl_load (const char *filename)
weechat_printf (NULL,
weechat_gettext ("%s%s: unable to create new "
"sub-interpreter"),
- weechat_prefix ("error"), "perl");
+ weechat_prefix ("error"), PERL_PLUGIN_NAME);
return 0;
}
@@ -295,7 +298,7 @@ weechat_perl_load (const 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_PLUGIN_NAME, filename);
return 0;
}
@@ -306,17 +309,18 @@ weechat_perl_load (const char *filename)
weechat_printf (NULL,
weechat_gettext ("%s%s: unable to parse file "
"\"%s\""),
- weechat_prefix ("error"), "perl", filename);
+ weechat_prefix ("error"), PERL_PLUGIN_NAME,
+ filename);
#ifdef MULTIPLICITY
weechat_printf (NULL,
weechat_gettext ("%s%s: error: %s"),
- weechat_prefix ("error"), "perl",
+ weechat_prefix ("error"), PERL_PLUGIN_NAME,
SvPV(perl_get_sv("weechat_perl_load_eval_file_error",
FALSE), len));
#else
weechat_printf (NULL,
weechat_gettext ("%s%s: error: %s"),
- weechat_prefix ("error"), "perl",
+ weechat_prefix ("error"), PERL_PLUGIN_NAME,
SvPV(perl_get_sv("WeechatPerlScriptLoader::"
"weechat_perl_load_eval_file_error",
FALSE), len));
@@ -326,14 +330,16 @@ weechat_perl_load (const char *filename)
{
weechat_printf (NULL,
weechat_gettext ("%s%s: unable to run file \"%s\""),
- weechat_prefix ("error"), "perl", filename);
+ weechat_prefix ("error"), PERL_PLUGIN_NAME,
+ filename);
}
else
{
weechat_printf (NULL,
weechat_gettext ("%s%s: unknown error while "
"loading file \"%s\""),
- weechat_prefix ("error"), "perl", filename);
+ weechat_prefix ("error"), PERL_PLUGIN_NAME,
+ filename);
}
#ifdef MULTIPLICITY
perl_destruct (perl_current_interpreter);
@@ -356,7 +362,7 @@ weechat_perl_load (const 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_PLUGIN_NAME, filename);
#ifdef MULTIPLICITY
perl_destruct (perl_current_interpreter);
perl_free (perl_current_interpreter);
@@ -399,7 +405,7 @@ weechat_perl_unload (struct t_plugin_script *script)
weechat_printf (NULL,
weechat_gettext ("%s: unloading script \"%s\""),
- "perl", script->name);
+ PERL_PLUGIN_NAME, script->name);
#ifdef MULTIPLICITY
PERL_SET_CONTEXT (script->interpreter);
@@ -445,13 +451,13 @@ weechat_perl_unload_name (const char *name)
weechat_perl_unload (ptr_script);
weechat_printf (NULL,
weechat_gettext ("%s: script \"%s\" unloaded"),
- "perl", name);
+ PERL_PLUGIN_NAME, name);
}
else
{
weechat_printf (NULL,
weechat_gettext ("%s%s: script \"%s\" not loaded"),
- weechat_prefix ("error"), "perl", name);
+ weechat_prefix ("error"), PERL_PLUGIN_NAME, name);
}
}
@@ -544,7 +550,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_PLUGIN_NAME, "perl");
}
}
@@ -634,7 +640,8 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
weechat_printf (NULL,
weechat_gettext ("%s%s: unable to initialize %s"),
- weechat_prefix ("error"), "perl", "perl");
+ weechat_prefix ("error"), PERL_PLUGIN_NAME,
+ PERL_PLUGIN_NAME);
return WEECHAT_RC_ERROR;
}
diff --git a/src/plugins/scripts/perl/weechat-perl.h b/src/plugins/scripts/perl/weechat-perl.h
index a9bba24ac..f79b5b3ca 100644
--- a/src/plugins/scripts/perl/weechat-perl.h
+++ b/src/plugins/scripts/perl/weechat-perl.h
@@ -21,6 +21,7 @@
#define __WEECHAT_PERL_H 1
#define weechat_plugin weechat_perl_plugin
+#define PERL_PLUGIN_NAME "perl"
extern struct t_weechat_plugin *weechat_perl_plugin;
diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c
index 64e788f99..f67a966b0 100644
--- a/src/plugins/scripts/python/weechat-python-api.c
+++ b/src/plugins/scripts/python/weechat-python-api.c
@@ -88,7 +88,7 @@ weechat_python_api_register (PyObject *self, PyObject *args)
weechat_gettext ("%s%s: unable to register script "
"\"%s\" (another script already "
"exists with this name)"),
- weechat_prefix ("error"), "python", name);
+ weechat_prefix ("error"), PYTHON_PLUGIN_NAME, name);
PYTHON_RETURN_ERROR;
}
@@ -104,7 +104,7 @@ weechat_python_api_register (PyObject *self, PyObject *args)
weechat_printf (NULL,
weechat_gettext ("%s: registered script \"%s\", "
"version %s (%s)"),
- "python", name, version, description);
+ PYTHON_PLUGIN_NAME, name, version, description);
}
else
{
@@ -1834,12 +1834,6 @@ weechat_python_api_prnt (PyObject *self, PyObject *args)
/* make C compiler happy */
(void) self;
- if (!python_current_script)
- {
- WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("prnt");
- PYTHON_RETURN_ERROR;
- }
-
buffer = NULL;
message = NULL;
@@ -2985,7 +2979,7 @@ weechat_python_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
static PyObject *
weechat_python_api_buffer_new (PyObject *self, PyObject *args)
{
- char *category, *name, *function_input, *function_close, *result;
+ char *name, *function_input, *function_close, *result;
PyObject *object;
/* make C compiler happy */
@@ -2997,12 +2991,11 @@ weechat_python_api_buffer_new (PyObject *self, PyObject *args)
PYTHON_RETURN_EMPTY;
}
- category = NULL;
name = NULL;
function_input = NULL;
function_close = NULL;
- if (!PyArg_ParseTuple (args, "ssss", &category, &name, &function_input,
+ if (!PyArg_ParseTuple (args, "sss", &name, &function_input,
&function_close))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_new");
@@ -3011,7 +3004,6 @@ weechat_python_api_buffer_new (PyObject *self, PyObject *args)
result = script_ptr2str (script_api_buffer_new (weechat_python_plugin,
python_current_script,
- category,
name,
&weechat_python_api_buffer_input_data_cb,
function_input,
@@ -3028,7 +3020,7 @@ weechat_python_api_buffer_new (PyObject *self, PyObject *args)
static PyObject *
weechat_python_api_buffer_search (PyObject *self, PyObject *args)
{
- char *category, *name;
+ char *plugin, *name;
char *result;
PyObject *object;
@@ -3041,16 +3033,16 @@ weechat_python_api_buffer_search (PyObject *self, PyObject *args)
PYTHON_RETURN_EMPTY;
}
- category = NULL;
+ plugin = NULL;
name = NULL;
- if (!PyArg_ParseTuple (args, "ss", &category, &name))
+ if (!PyArg_ParseTuple (args, "ss", &plugin, &name))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_search");
PYTHON_RETURN_EMPTY;
}
- result = script_ptr2str (weechat_buffer_search (category, name));
+ result = script_ptr2str (weechat_buffer_search (plugin, name));
PYTHON_RETURN_STRING_FREE(result);
}
diff --git a/src/plugins/scripts/python/weechat-python.c b/src/plugins/scripts/python/weechat-python.c
index 5a9439a1d..8c1f6f390 100644
--- a/src/plugins/scripts/python/weechat-python.c
+++ b/src/plugins/scripts/python/weechat-python.c
@@ -28,7 +28,7 @@
#include "weechat-python-api.h"
-WEECHAT_PLUGIN_NAME("python");
+WEECHAT_PLUGIN_NAME(PYTHON_PLUGIN_NAME);
WEECHAT_PLUGIN_DESCRIPTION("Python plugin for WeeChat");
WEECHAT_PLUGIN_AUTHOR("FlashCode <flashcode@flashtux.org>");
WEECHAT_PLUGIN_VERSION(WEECHAT_VERSION);
@@ -72,7 +72,7 @@ weechat_python_exec (struct t_plugin_script *script,
{
weechat_printf (NULL,
weechat_gettext ("%s%s unable to run function \"%s\""),
- weechat_prefix ("error"), "python", function);
+ weechat_prefix ("error"), PYTHON_PLUGIN_NAME, function);
/* PyEval_ReleaseThread (python_current_script->interpreter); */
return NULL;
}
@@ -151,7 +151,7 @@ weechat_python_exec (struct t_plugin_script *script,
weechat_printf (NULL,
weechat_gettext ("%s%s: function \"%s\" must return "
"a valid value"),
- weechat_prefix ("error"), "python", function);
+ weechat_prefix ("error"), PYTHON_PLUGIN_NAME, function);
/* PyEval_ReleaseThread (python_current_script->interpreter); */
python_current_script = old_python_current_script;
if (python_current_script)
@@ -164,7 +164,7 @@ weechat_python_exec (struct t_plugin_script *script,
weechat_printf (NULL,
weechat_gettext ("%s%s: not enough memory in "
"function \"%s\""),
- weechat_prefix ("error"), "python", function);
+ weechat_prefix ("error"), PYTHON_PLUGIN_NAME, function);
/* PyEval_ReleaseThread (python_current_script->interpreter); */
python_current_script = old_python_current_script;
if (python_current_script)
@@ -204,7 +204,7 @@ weechat_python_output (PyObject *self, PyObject *args)
{
weechat_printf (NULL,
weechat_gettext ("%s: stdout/stderr: %s%s"),
- "python", python_buffer_output, "");
+ PYTHON_PLUGIN_NAME, python_buffer_output, "");
python_buffer_output[0] = '\0';
}
}
@@ -218,7 +218,7 @@ weechat_python_output (PyObject *self, PyObject *args)
{
weechat_printf (NULL,
weechat_gettext ("%s: stdout/stderr: %s%s"),
- "python", python_buffer_output, m);
+ PYTHON_PLUGIN_NAME, python_buffer_output, m);
}
*p = '\n';
python_buffer_output[0] = '\0';
@@ -229,7 +229,7 @@ weechat_python_output (PyObject *self, PyObject *args)
{
weechat_printf (NULL,
weechat_gettext ("%s: stdout/stderr: %s%s"),
- "python", python_buffer_output, m);
+ PYTHON_PLUGIN_NAME, python_buffer_output, m);
python_buffer_output[0] = '\0';
}
else
@@ -269,13 +269,13 @@ weechat_python_load (const char *filename)
{
weechat_printf (NULL,
weechat_gettext ("%s%s: script \"%s\" not found"),
- weechat_prefix ("error"), "python", filename);
+ weechat_prefix ("error"), PYTHON_PLUGIN_NAME, filename);
return 0;
}
weechat_printf (NULL,
weechat_gettext ("%s: loading script \"%s\""),
- "python", filename);
+ PYTHON_PLUGIN_NAME, filename);
python_current_script = NULL;
@@ -288,7 +288,7 @@ weechat_python_load (const char *filename)
weechat_printf (NULL,
weechat_gettext ("%s%s: unable to create new "
"sub-interpreter"),
- weechat_prefix ("error"), "python");
+ weechat_prefix ("error"), PYTHON_PLUGIN_NAME);
fclose (fp);
/* PyEval_ReleaseLock (); */
return 0;
@@ -303,7 +303,7 @@ weechat_python_load (const char *filename)
weechat_printf (NULL,
weechat_gettext ("%s%s: unable to initialize WeeChat "
"module"),
- weechat_prefix ("error"), "python");
+ weechat_prefix ("error"), PYTHON_PLUGIN_NAME);
fclose (fp);
Py_EndInterpreter (python_current_interpreter);
@@ -317,7 +317,7 @@ weechat_python_load (const char *filename)
w_home = weechat_info_get ("weechat_dir", "");
if (w_home)
{
- len = strlen (w_home) + 1 + strlen("python") + 1;
+ len = strlen (w_home) + 1 + strlen(PYTHON_PLUGIN_NAME) + 1;
p_home = malloc (len);
if (p_home)
{
@@ -371,7 +371,7 @@ weechat_python_load (const char *filename)
weechat_printf (NULL,
weechat_gettext ("%s%s: unable to redirect stdout and "
"stderr"),
- weechat_prefix ("error"), "python");
+ weechat_prefix ("error"), PYTHON_PLUGIN_NAME);
}
else
{
@@ -379,13 +379,13 @@ weechat_python_load (const char *filename)
{
weechat_printf (NULL,
weechat_gettext ("%s%s: unable to redirect stdout"),
- weechat_prefix ("error"), "python");
+ weechat_prefix ("error"), PYTHON_PLUGIN_NAME);
}
if (PySys_SetObject("stderr", weechat_outputs) == -1)
{
weechat_printf (NULL,
weechat_gettext ("%s%s: unable to redirect stderr"),
- weechat_prefix ("error"), "python");
+ weechat_prefix ("error"), PYTHON_PLUGIN_NAME);
}
}
@@ -395,7 +395,7 @@ weechat_python_load (const char *filename)
{
weechat_printf (NULL,
weechat_gettext ("%s%s: unable to parse file \"%s\""),
- weechat_prefix ("error"), "python", filename);
+ weechat_prefix ("error"), PYTHON_PLUGIN_NAME, filename);
fclose (fp);
if (PyErr_Occurred ())
@@ -420,7 +420,7 @@ weechat_python_load (const char *filename)
weechat_printf (NULL,
weechat_gettext ("%s%s: function \"register\" not "
"found (or failed) in file \"%s\""),
- weechat_prefix ("error"), "python", filename);
+ weechat_prefix ("error"), PYTHON_PLUGIN_NAME, filename);
if (PyErr_Occurred ())
PyErr_Print ();
@@ -461,7 +461,7 @@ weechat_python_unload (struct t_plugin_script *script)
weechat_printf (NULL,
weechat_gettext ("%s: unloading script \"%s\""),
- "python", script->name);
+ PYTHON_PLUGIN_NAME, script->name);
if (script->shutdown_func && script->shutdown_func[0])
{
@@ -494,13 +494,13 @@ weechat_python_unload_name (const char *name)
weechat_python_unload (ptr_script);
weechat_printf (NULL,
weechat_gettext ("%s: script \"%s\" unloaded"),
- "python", name);
+ PYTHON_PLUGIN_NAME, name);
}
else
{
weechat_printf (NULL,
weechat_gettext ("%s%s: script \"%s\" not loaded"),
- weechat_prefix ("error"), "python", name);
+ weechat_prefix ("error"), PYTHON_PLUGIN_NAME, name);
}
}
@@ -593,7 +593,8 @@ weechat_python_command_cb (void *data, struct t_gui_buffer *buffer,
weechat_printf (NULL,
weechat_gettext ("%s%s: unknown option for "
"command \"%s\""),
- weechat_prefix ("error"), "python", "python");
+ weechat_prefix ("error"), PYTHON_PLUGIN_NAME,
+ "python");
}
}
@@ -679,7 +680,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_printf (NULL,
weechat_gettext ("%s%s: unable to launch global "
"interpreter"),
- weechat_prefix ("error"), "python");
+ weechat_prefix ("error"), PYTHON_PLUGIN_NAME);
return WEECHAT_RC_ERROR;
}
@@ -693,7 +694,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_printf (NULL,
weechat_gettext ("%s%s: unable to get current "
"interpreter state"),
- weechat_prefix ("error"), "python");
+ weechat_prefix ("error"), PYTHON_PLUGIN_NAME);
return WEECHAT_RC_ERROR;
}
@@ -735,7 +736,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
{
weechat_printf (NULL,
weechat_gettext ("%s%s: unable to free interpreter"),
- weechat_prefix ("error"), "python");
+ weechat_prefix ("error"), PYTHON_PLUGIN_NAME);
}
return WEECHAT_RC_OK;
diff --git a/src/plugins/scripts/python/weechat-python.h b/src/plugins/scripts/python/weechat-python.h
index 16a659664..d973ec38a 100644
--- a/src/plugins/scripts/python/weechat-python.h
+++ b/src/plugins/scripts/python/weechat-python.h
@@ -21,6 +21,7 @@
#define __WEECHAT_PYTHON_H 1
#define weechat_plugin weechat_python_plugin
+#define PYTHON_PLUGIN_NAME "python"
extern struct t_weechat_plugin *weechat_python_plugin;
diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c
index 81987d1dc..f30970e9e 100644
--- a/src/plugins/scripts/ruby/weechat-ruby-api.c
+++ b/src/plugins/scripts/ruby/weechat-ruby-api.c
@@ -104,7 +104,7 @@ weechat_ruby_api_register (VALUE class, VALUE name, VALUE author,
weechat_gettext ("%s%s: unable to register script "
"\"%s\" (another script already "
"exists with this name)"),
- weechat_prefix ("error"), "ruby", c_name);
+ weechat_prefix ("error"), RUBY_PLUGIN_NAME, c_name);
RUBY_RETURN_ERROR;
}
@@ -122,7 +122,7 @@ weechat_ruby_api_register (VALUE class, VALUE name, VALUE author,
weechat_printf (NULL,
weechat_gettext ("%s: registered script \"%s\", "
"version %s (%s)"),
- "ruby", c_name, c_version, c_description);
+ RUBY_PLUGIN_NAME, c_name, c_version, c_description);
}
else
{
@@ -2108,12 +2108,6 @@ weechat_ruby_api_print (VALUE class, VALUE buffer, VALUE message)
/* make C compiler happy */
(void) class;
- if (!ruby_current_script)
- {
- WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("print");
- RUBY_RETURN_ERROR;
- }
-
c_buffer = NULL;
c_message = NULL;
@@ -3416,10 +3410,10 @@ weechat_ruby_api_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
*/
static VALUE
-weechat_ruby_api_buffer_new (VALUE class, VALUE category, VALUE name,
- VALUE function_input, VALUE function_close)
+weechat_ruby_api_buffer_new (VALUE class, VALUE name, VALUE function_input,
+ VALUE function_close)
{
- char *c_category, *c_name, *c_function_input, *c_function_close, *result;
+ char *c_name, *c_function_input, *c_function_close, *result;
VALUE return_value;
/* make C compiler happy */
@@ -3431,31 +3425,26 @@ weechat_ruby_api_buffer_new (VALUE class, VALUE category, VALUE name,
RUBY_RETURN_EMPTY;
}
- c_category = NULL;
c_name = NULL;
c_function_input = NULL;
c_function_close = NULL;
- if (NIL_P (category) || NIL_P (name) || NIL_P (function_input)
- || NIL_P (function_close))
+ if (NIL_P (name) || NIL_P (function_input) || NIL_P (function_close))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_new");
RUBY_RETURN_EMPTY;
}
- Check_Type (category, T_STRING);
Check_Type (name, T_STRING);
Check_Type (function_input, T_STRING);
Check_Type (function_close, T_STRING);
- c_category = STR2CSTR (category);
c_name = STR2CSTR (name);
c_function_input = STR2CSTR (function_input);
c_function_close = STR2CSTR (function_close);
result = script_ptr2str (script_api_buffer_new (weechat_ruby_plugin,
ruby_current_script,
- c_category,
c_name,
&weechat_ruby_api_buffer_input_data_cb,
c_function_input,
@@ -3470,9 +3459,9 @@ weechat_ruby_api_buffer_new (VALUE class, VALUE category, VALUE name,
*/
static VALUE
-weechat_ruby_api_buffer_search (VALUE class, VALUE category, VALUE name)
+weechat_ruby_api_buffer_search (VALUE class, VALUE plugin, VALUE name)
{
- char *c_category, *c_name, *result;
+ char *c_plugin, *c_name, *result;
VALUE return_value;
/* make C compiler happy */
@@ -3483,23 +3472,23 @@ weechat_ruby_api_buffer_search (VALUE class, VALUE category, VALUE name)
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("buffer_search");
RUBY_RETURN_EMPTY;
}
-
- c_category = NULL;
+
+ c_plugin = NULL;
c_name = NULL;
- if (NIL_P (category) || NIL_P (name))
+ if (NIL_P (plugin) || NIL_P (name))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_search");
RUBY_RETURN_EMPTY;
}
- Check_Type (category, T_STRING);
+ Check_Type (plugin, T_STRING);
Check_Type (name, T_STRING);
- c_category = STR2CSTR (category);
+ c_plugin = STR2CSTR (plugin);
c_name = STR2CSTR (name);
- result = script_ptr2str (weechat_buffer_search (c_category, c_name));
+ result = script_ptr2str (weechat_buffer_search (c_plugin, c_name));
RUBY_RETURN_STRING_FREE(result);
}
@@ -4978,7 +4967,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
rb_define_module_function (ruby_mWeechat, "hook_infolist", &weechat_ruby_api_hook_infolist, 3);
rb_define_module_function (ruby_mWeechat, "unhook", &weechat_ruby_api_unhook, 1);
rb_define_module_function (ruby_mWeechat, "unhook_all", &weechat_ruby_api_unhook_all, 0);
- rb_define_module_function (ruby_mWeechat, "buffer_new", &weechat_ruby_api_buffer_new, 4);
+ rb_define_module_function (ruby_mWeechat, "buffer_new", &weechat_ruby_api_buffer_new, 3);
rb_define_module_function (ruby_mWeechat, "buffer_search", &weechat_ruby_api_buffer_search, 2);
rb_define_module_function (ruby_mWeechat, "buffer_clear", &weechat_ruby_api_buffer_clear, 1);
rb_define_module_function (ruby_mWeechat, "buffer_close", &weechat_ruby_api_buffer_close, 1);
diff --git a/src/plugins/scripts/ruby/weechat-ruby.c b/src/plugins/scripts/ruby/weechat-ruby.c
index 1b3ea6c07..fa08ab09c 100644
--- a/src/plugins/scripts/ruby/weechat-ruby.c
+++ b/src/plugins/scripts/ruby/weechat-ruby.c
@@ -31,7 +31,7 @@
#include "weechat-ruby-api.h"
-WEECHAT_PLUGIN_NAME("ruby");
+WEECHAT_PLUGIN_NAME(RUBY_PLUGIN_NAME);
WEECHAT_PLUGIN_DESCRIPTION("Ruby plugin for WeeChat");
WEECHAT_PLUGIN_AUTHOR("FlashCode <flashcode@flashtux.org>");
WEECHAT_PLUGIN_VERSION(WEECHAT_VERSION);
@@ -181,12 +181,13 @@ weechat_ruby_exec (struct t_plugin_script *script,
{
weechat_printf (NULL,
weechat_gettext ("%s%s: unable to run function \"%s\""),
- weechat_prefix ("error"), "ruby", function);
+ weechat_prefix ("error"), RUBY_PLUGIN_NAME, function);
err = rb_inspect(rb_gv_get("$!"));
weechat_printf (NULL,
weechat_gettext ("%s%s: error: \"%s\""),
- weechat_prefix ("error"), "ruby", STR2CSTR(err));
+ weechat_prefix ("error"), RUBY_PLUGIN_NAME,
+ STR2CSTR(err));
return NULL;
}
@@ -210,7 +211,7 @@ weechat_ruby_exec (struct t_plugin_script *script,
weechat_printf (NULL,
weechat_gettext ("%s%s: function \"%s\" must return a "
"valid value"),
- weechat_prefix ("error"), "ruby", function);
+ weechat_prefix ("error"), RUBY_PLUGIN_NAME, function);
ruby_current_script = old_ruby_current_script;
return WEECHAT_RC_OK;
}
@@ -220,7 +221,7 @@ weechat_ruby_exec (struct t_plugin_script *script,
weechat_printf (NULL,
weechat_gettext ("%s%s: not enough memory in function "
"\"%s\""),
- weechat_prefix ("error"), "ruby", function);
+ weechat_prefix ("error"), RUBY_PLUGIN_NAME, function);
ruby_current_script = old_ruby_current_script;
return NULL;
}
@@ -252,7 +253,7 @@ weechat_ruby_output (VALUE self, VALUE str)
{
weechat_printf (NULL,
weechat_gettext ("%s%s: stdout/stderr: %s%s"),
- weechat_prefix ("error"), "ruby",
+ weechat_prefix ("error"), RUBY_PLUGIN_NAME,
ruby_buffer_output, m);
}
*p = '\n';
@@ -264,7 +265,7 @@ weechat_ruby_output (VALUE self, VALUE str)
{
weechat_printf (NULL,
weechat_gettext ("%s%s: stdout/stderr: %s%s"),
- weechat_prefix ("error"), "ruby",
+ weechat_prefix ("error"), RUBY_PLUGIN_NAME,
ruby_buffer_output, m);
ruby_buffer_output[0] = '\0';
}
@@ -307,13 +308,13 @@ weechat_ruby_load (const char *filename)
{
weechat_printf (NULL,
weechat_gettext ("%s%s: script \"%s\" not found"),
- weechat_prefix ("error"), "ruby", filename);
+ weechat_prefix ("error"), RUBY_PLUGIN_NAME, filename);
return 0;
}
weechat_printf (NULL,
weechat_gettext ("%s: loading script \"%s\""),
- "ruby", filename);
+ RUBY_PLUGIN_NAME, filename);
ruby_current_script = NULL;
@@ -332,7 +333,8 @@ weechat_ruby_load (const char *filename)
err = rb_inspect(rb_gv_get("$!"));
weechat_printf (NULL,
weechat_gettext ("%s%s: error: \"%s\""),
- weechat_prefix ("error"), "ruby", STR2CSTR(err));
+ weechat_prefix ("error"), RUBY_PLUGIN_NAME,
+ STR2CSTR(err));
return 0;
}
@@ -346,20 +348,23 @@ weechat_ruby_load (const char *filename)
weechat_printf (NULL,
weechat_gettext ("%s%s: unable to read file "
"\"%s\""),
- weechat_prefix ("error"), "ruby", filename);
+ weechat_prefix ("error"), RUBY_PLUGIN_NAME,
+ filename);
break;
case 2:
weechat_printf (NULL,
weechat_gettext ("%s%s: error while loading "
"file \"%s\""),
- weechat_prefix ("error"), "ruby", filename);
+ weechat_prefix ("error"), RUBY_PLUGIN_NAME,
+ filename);
break;
case 3:
weechat_printf (NULL,
weechat_gettext ("%s%s: function "
"\"weechat_init\" is missing "
"in file \"%s\""),
- weechat_prefix ("error"), "ruby", filename);
+ weechat_prefix ("error"), RUBY_PLUGIN_NAME,
+ filename);
break;
}
@@ -370,7 +375,7 @@ weechat_ruby_load (const char *filename)
{
weechat_printf (NULL,
weechat_gettext ("%s%s: error: %s"),
- weechat_prefix ("error"), "ruby",
+ weechat_prefix ("error"), RUBY_PLUGIN_NAME,
STR2CSTR(ruby_eval_error));
}
}
@@ -386,12 +391,13 @@ weechat_ruby_load (const char *filename)
weechat_printf (NULL,
weechat_gettext ("%s%s: unable to eval function "
"\"weechat_init\" in file \"%s\""),
- weechat_prefix ("error"), "ruby", filename);
+ weechat_prefix ("error"), RUBY_PLUGIN_NAME, filename);
err = rb_inspect(rb_gv_get("$!"));
weechat_printf (NULL,
weechat_gettext ("%s%s: error: \"%s\""),
- weechat_prefix ("error"), "ruby", STR2CSTR(err));
+ weechat_prefix ("error"), RUBY_PLUGIN_NAME,
+ STR2CSTR(err));
if (ruby_current_script != NULL)
{
@@ -407,7 +413,7 @@ weechat_ruby_load (const char *filename)
weechat_printf (NULL,
weechat_gettext ("%s%s: function \"register\" not "
"found (or failed) in file \"%s\""),
- weechat_prefix ("error"), "ruby", filename);
+ weechat_prefix ("error"), RUBY_PLUGIN_NAME, filename);
return 0;
}
@@ -443,7 +449,7 @@ weechat_ruby_unload (struct t_plugin_script *script)
weechat_printf (NULL,
weechat_gettext ("%s: unloading script \"%s\""),
- "ruby", script->name);
+ RUBY_PLUGIN_NAME, script->name);
if (script->shutdown_func && script->shutdown_func[0])
{
@@ -478,13 +484,13 @@ weechat_ruby_unload_name (const char *name)
weechat_ruby_unload (ptr_script);
weechat_printf (NULL,
weechat_gettext ("%s: script \"%s\" unloaded"),
- "ruby", name);
+ RUBY_PLUGIN_NAME, name);
}
else
{
weechat_printf (NULL,
weechat_gettext ("%s%s: script \"%s\" not loaded"),
- weechat_prefix ("error"), "ruby", name);
+ weechat_prefix ("error"), RUBY_PLUGIN_NAME, name);
}
}
@@ -577,7 +583,7 @@ weechat_ruby_command_cb (void *data, struct t_gui_buffer *buffer,
weechat_printf (NULL,
weechat_gettext ("%s%s: unknown option for "
"command \"%s\""),
- weechat_prefix ("error"), "ruby", "ruby");
+ weechat_prefix ("error"), RUBY_PLUGIN_NAME, "ruby");
}
}
@@ -724,10 +730,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_printf (NULL,
weechat_gettext ("%s%s: unable to eval WeeChat ruby "
"internal code"),
- weechat_prefix ("error"), "ruby");
+ weechat_prefix ("error"), RUBY_PLUGIN_NAME);
weechat_printf (NULL,
weechat_gettext ("%s%s: error: %s"),
- weechat_prefix ("error"), "ruby",
+ weechat_prefix ("error"), RUBY_PLUGIN_NAME,
STR2CSTR(ruby_error_info));
return WEECHAT_RC_ERROR;
}
diff --git a/src/plugins/scripts/ruby/weechat-ruby.h b/src/plugins/scripts/ruby/weechat-ruby.h
index 02f514c0f..0529cb036 100644
--- a/src/plugins/scripts/ruby/weechat-ruby.h
+++ b/src/plugins/scripts/ruby/weechat-ruby.h
@@ -21,6 +21,7 @@
#define __WEECHAT_RUBY_H 1
#define weechat_plugin weechat_ruby_plugin
+#define RUBY_PLUGIN_NAME "ruby"
extern struct t_weechat_plugin *weechat_ruby_plugin;
diff --git a/src/plugins/scripts/script-api.c b/src/plugins/scripts/script-api.c
index d304e40ec..2900440d0 100644
--- a/src/plugins/scripts/script-api.c
+++ b/src/plugins/scripts/script-api.c
@@ -455,7 +455,7 @@ script_api_printf (struct t_weechat_plugin *weechat_plugin,
{
va_list argptr;
char *buf, *buf2;
-
+
buf = malloc (128 * 1024);
if (!buf)
return;
@@ -464,7 +464,7 @@ script_api_printf (struct t_weechat_plugin *weechat_plugin,
vsnprintf (buf, 128 * 1024, format, argptr);
va_end (argptr);
- buf2 = (script->charset && script->charset[0]) ?
+ buf2 = (script && script->charset && script->charset[0]) ?
weechat_iconv_to_internal (script->charset, buf) : NULL;
weechat_printf (buffer, "%s", (buf2) ? buf2 : buf);
@@ -1011,7 +1011,7 @@ script_api_unhook_all (struct t_plugin_script *script)
struct t_gui_buffer *
script_api_buffer_new (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- const char *category, const char *name,
+ const char *name,
int (*input_callback)(void *data,
struct t_gui_buffer *buffer,
const char *input_data),
@@ -1026,7 +1026,7 @@ script_api_buffer_new (struct t_weechat_plugin *weechat_plugin,
if ((!function_input || !function_input[0])
&& (!function_close || !function_close[0]))
- return weechat_buffer_new (category, name, NULL, NULL, NULL, NULL);
+ return weechat_buffer_new (name, NULL, NULL, NULL, NULL);
new_script_callback_input = NULL;
new_script_callback_close = NULL;
@@ -1052,7 +1052,7 @@ script_api_buffer_new (struct t_weechat_plugin *weechat_plugin,
}
}
- new_buffer = weechat_buffer_new (category, name,
+ new_buffer = weechat_buffer_new (name,
(new_script_callback_input) ?
input_callback : NULL,
(new_script_callback_input) ?
diff --git a/src/plugins/scripts/script-api.h b/src/plugins/scripts/script-api.h
index 1c09892a8..d31cec157 100644
--- a/src/plugins/scripts/script-api.h
+++ b/src/plugins/scripts/script-api.h
@@ -173,7 +173,7 @@ extern void script_api_unhook (struct t_weechat_plugin *weechat_plugin,
extern void script_api_unhook_all (struct t_plugin_script *script);
extern struct t_gui_buffer *script_api_buffer_new (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
- const char *category, const char *name,
+ const char *name,
int (*input_callback)(void *data,
struct t_gui_buffer *buffer,
const char *input_data),