1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-26 04:46:37 +02:00

Added completion system for plugins/scripts commands, fixed plugins autoload

This commit is contained in:
Sebastien Helleu
2005-12-16 14:16:03 +00:00
parent 6eabc3aa61
commit d5b58ff068
48 changed files with 6694 additions and 6012 deletions
+4
View File
@@ -426,6 +426,7 @@ static XS (XS_weechat_add_message_handler)
static XS (XS_weechat_add_command_handler)
{
char *command, *function, *description, *arguments, *arguments_description;
char *completion_template;
unsigned int integer;
dXSARGS;
@@ -453,12 +454,14 @@ static XS (XS_weechat_add_command_handler)
description = (items >= 3) ? SvPV (ST (2), integer) : NULL;
arguments = (items >= 4) ? SvPV (ST (3), integer) : NULL;
arguments_description = (items >= 5) ? SvPV (ST (4), integer) : NULL;
completion_template = (items >= 6) ? SvPV (ST (5), integer) : NULL;
if (perl_plugin->cmd_handler_add (perl_plugin,
command,
description,
arguments,
arguments_description,
completion_template,
weechat_perl_handler,
function,
(void *)perl_current_script))
@@ -1197,6 +1200,7 @@ weechat_plugin_init (t_weechat_plugin *plugin)
"[load filename] | [autoload] | [reload] | [unload]",
"filename: Perl script (file) to load\n\n"
"Without argument, /perl command lists all loaded Perl scripts.",
"load|autoload|reload|unload",
weechat_perl_cmd, NULL, NULL);
plugin->mkdir_home (plugin, "perl");
+7 -2
View File
@@ -333,6 +333,7 @@ static PyObject *
weechat_python_add_command_handler (PyObject *self, PyObject *args)
{
char *command, *function, *description, *arguments, *arguments_description;
char *completion_template;
/* make gcc happy */
(void) self;
@@ -350,9 +351,11 @@ weechat_python_add_command_handler (PyObject *self, PyObject *args)
description = NULL;
arguments = NULL;
arguments_description = NULL;
completion_template = NULL;
if (!PyArg_ParseTuple (args, "ss|sss", &command, &function,
&description, &arguments, &arguments_description))
if (!PyArg_ParseTuple (args, "ss|ssss", &command, &function,
&description, &arguments, &arguments_description,
completion_template))
{
python_plugin->printf_server (python_plugin,
"Python error: wrong parameters for "
@@ -365,6 +368,7 @@ weechat_python_add_command_handler (PyObject *self, PyObject *args)
description,
arguments,
arguments_description,
completion_template,
weechat_python_handler,
function,
(void *)python_current_script))
@@ -1151,6 +1155,7 @@ weechat_plugin_init (t_weechat_plugin *plugin)
"[load filename] | [autoload] | [reload] | [unload]",
"filename: Python script (file) to load\n\n"
"Without argument, /python command lists all loaded Python scripts.",
"load|autoload|reload|unload",
weechat_python_cmd, NULL, NULL);
plugin->mkdir_home (plugin, "python");
+16 -3
View File
@@ -448,7 +448,9 @@ static VALUE
weechat_ruby_add_command_handler (int argc, VALUE *argv, VALUE class)
{
VALUE command, function, description, arguments, arguments_description;
VALUE completion_template;
char *c_command, *c_function, *c_description, *c_arguments, *c_arguments_description;
char *c_completion_template;
/* make gcc happy */
(void) class;
@@ -466,14 +468,16 @@ weechat_ruby_add_command_handler (int argc, VALUE *argv, VALUE class)
description = Qnil;
arguments = Qnil;
arguments_description = Qnil;
completion_template = Qnil;
c_command = NULL;
c_function = NULL;
c_description = NULL;
c_arguments = NULL;
c_arguments_description = NULL;
c_completion_template = NULL;
rb_scan_args (argc, argv, "23", &command, &function, &description,
&arguments, &arguments_description);
rb_scan_args (argc, argv, "24", &command, &function, &description,
&arguments, &arguments_description, &completion_template);
if (NIL_P (command) || NIL_P (function))
{
@@ -500,16 +504,24 @@ weechat_ruby_add_command_handler (int argc, VALUE *argv, VALUE class)
c_arguments = STR2CSTR (arguments);
}
if (!NIL_P (arguments_description)) {
if (!NIL_P (arguments_description))
{
Check_Type (arguments_description, T_STRING);
c_arguments_description = STR2CSTR (arguments_description);
}
if (!NIL_P (completion_template))
{
Check_Type (completion_template, T_STRING);
c_completion_template = STR2CSTR (completion_template);
}
if (ruby_plugin->cmd_handler_add (ruby_plugin,
c_command,
c_description,
c_arguments,
c_arguments_description,
c_completion_template,
weechat_ruby_handler,
c_function,
(void *)ruby_current_script))
@@ -1322,6 +1334,7 @@ weechat_plugin_init (t_weechat_plugin *plugin)
"[load filename] | [autoload] | [reload] | [unload]",
"filename: Ruby script (file) to load\n\n"
"Without argument, /ruby command lists all loaded Ruby scripts.",
"load|autoload|reload|unload",
weechat_ruby_cmd, NULL, NULL);
plugin->mkdir_home (plugin, "ruby");