mirror of
https://github.com/weechat/weechat.git
synced 2026-06-25 04:16:38 +02:00
Fixed bugs in "get_info" and "command" interface functions of plugins
This commit is contained in:
@@ -508,7 +508,7 @@ static XS (XS_weechat_remove_handler)
|
||||
|
||||
static XS (XS_weechat_get_info)
|
||||
{
|
||||
char *arg, *info, *server_name, *channel_name;
|
||||
char *arg, *info, *server_name;
|
||||
unsigned int integer;
|
||||
dXSARGS;
|
||||
|
||||
@@ -523,7 +523,7 @@ static XS (XS_weechat_get_info)
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
if ((items < 1) || (items > 3))
|
||||
if ((items < 1) || (items > 2))
|
||||
{
|
||||
perl_plugin->printf_server (perl_plugin,
|
||||
"Perl error: wrong parameters for "
|
||||
@@ -531,18 +531,12 @@ static XS (XS_weechat_get_info)
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
server_name = NULL;
|
||||
channel_name = NULL;
|
||||
|
||||
if (items >= 2)
|
||||
server_name = SvPV (ST (1), integer);
|
||||
if (items == 3)
|
||||
channel_name = SvPV (ST (2), integer);
|
||||
server_name = (items == 2) ? SvPV (ST (1), integer) : NULL;
|
||||
|
||||
arg = SvPV (ST (0), integer);
|
||||
if (arg)
|
||||
{
|
||||
info = perl_plugin->get_info (perl_plugin, arg, server_name, channel_name);
|
||||
info = perl_plugin->get_info (perl_plugin, arg, server_name);
|
||||
|
||||
if (info)
|
||||
{
|
||||
@@ -1111,7 +1105,7 @@ weechat_perl_cmd (t_weechat_plugin *plugin,
|
||||
path_script = NULL;
|
||||
else
|
||||
{
|
||||
dir_home = plugin->get_info (plugin, "weechat_dir", NULL, NULL);
|
||||
dir_home = plugin->get_info (plugin, "weechat_dir", NULL);
|
||||
if (dir_home)
|
||||
{
|
||||
path_length = strlen (dir_home) + strlen (argv[1]) + 16;
|
||||
|
||||
@@ -409,7 +409,7 @@ weechat_python_remove_handler (PyObject *self, PyObject *args)
|
||||
static PyObject *
|
||||
weechat_python_get_info (PyObject *self, PyObject *args)
|
||||
{
|
||||
char *arg, *server_name, *channel_name, *info;
|
||||
char *arg, *server_name, *info;
|
||||
PyObject *object;
|
||||
|
||||
/* make gcc happy */
|
||||
@@ -425,9 +425,8 @@ weechat_python_get_info (PyObject *self, PyObject *args)
|
||||
|
||||
arg = NULL;
|
||||
server_name = NULL;
|
||||
channel_name = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple (args, "s|ss", &arg, &server_name, &channel_name))
|
||||
if (!PyArg_ParseTuple (args, "s|s", &arg, &server_name))
|
||||
{
|
||||
python_plugin->printf_server (python_plugin,
|
||||
"Python error: wrong parameters for "
|
||||
@@ -437,7 +436,7 @@ weechat_python_get_info (PyObject *self, PyObject *args)
|
||||
|
||||
if (arg)
|
||||
{
|
||||
info = python_plugin->get_info (python_plugin, arg, server_name, channel_name);
|
||||
info = python_plugin->get_info (python_plugin, arg, server_name);
|
||||
|
||||
if (info)
|
||||
{
|
||||
@@ -1040,7 +1039,7 @@ weechat_python_cmd (t_weechat_plugin *plugin,
|
||||
path_script = NULL;
|
||||
else
|
||||
{
|
||||
dir_home = plugin->get_info (plugin, "weechat_dir", NULL, NULL);
|
||||
dir_home = plugin->get_info (plugin, "weechat_dir", NULL);
|
||||
if (dir_home)
|
||||
{
|
||||
path_length = strlen (dir_home) + strlen (argv[1]) + 16;
|
||||
|
||||
@@ -452,10 +452,9 @@ weechat_ruby_remove_handler (VALUE class, VALUE command, VALUE function)
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_get_info (VALUE class, VALUE arg, VALUE server_name,
|
||||
VALUE channel_name)
|
||||
weechat_ruby_get_info (VALUE class, VALUE arg, VALUE server_name)
|
||||
{
|
||||
char *c_arg, *c_server_name, *c_channel_name, *info;
|
||||
char *c_arg, *c_server_name, *info;
|
||||
VALUE return_value;
|
||||
|
||||
/* make gcc happy */
|
||||
@@ -471,7 +470,6 @@ weechat_ruby_get_info (VALUE class, VALUE arg, VALUE server_name,
|
||||
|
||||
c_arg = NULL;
|
||||
c_server_name = NULL;
|
||||
c_channel_name = NULL;
|
||||
|
||||
if (NIL_P (arg))
|
||||
{
|
||||
@@ -484,19 +482,14 @@ weechat_ruby_get_info (VALUE class, VALUE arg, VALUE server_name,
|
||||
Check_Type (arg, T_STRING);
|
||||
if (!NIL_P (server_name))
|
||||
Check_Type (server_name, T_STRING);
|
||||
if (!NIL_P (channel_name))
|
||||
Check_Type (channel_name, T_STRING);
|
||||
|
||||
c_arg = STR2CSTR (arg);
|
||||
if (!NIL_P (server_name))
|
||||
c_server_name = STR2CSTR (server_name);
|
||||
if (!NIL_P (channel_name))
|
||||
c_channel_name = STR2CSTR (channel_name);
|
||||
|
||||
if (c_arg)
|
||||
{
|
||||
info = ruby_plugin->get_info (ruby_plugin, c_arg,
|
||||
c_server_name, c_channel_name);
|
||||
info = ruby_plugin->get_info (ruby_plugin, c_arg, c_server_name);
|
||||
|
||||
if (info)
|
||||
{
|
||||
@@ -893,7 +886,7 @@ weechat_ruby_cmd (t_weechat_plugin *plugin,
|
||||
path_script = NULL;
|
||||
else
|
||||
{
|
||||
dir_home = plugin->get_info (plugin, "weechat_dir", NULL, NULL);
|
||||
dir_home = plugin->get_info (plugin, "weechat_dir", NULL);
|
||||
if (dir_home)
|
||||
{
|
||||
path_length = strlen (dir_home) + strlen (argv[1]) + 16;
|
||||
|
||||
@@ -44,7 +44,7 @@ weechat_script_auto_load (t_weechat_plugin *plugin, char *language,
|
||||
int dir_length;
|
||||
|
||||
/* build directory, adding WeeChat home */
|
||||
dir_home = plugin->get_info (plugin, "weechat_dir", NULL, NULL);
|
||||
dir_home = plugin->get_info (plugin, "weechat_dir", NULL);
|
||||
if (!dir_home)
|
||||
return;
|
||||
dir_length = strlen (dir_home) + strlen (language) + 16;
|
||||
|
||||
Reference in New Issue
Block a user