1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-02 12:45:43 +02:00

Add description for info and infolist hooks

This commit is contained in:
Sebastien Helleu
2008-09-02 17:02:59 +02:00
parent e756f4770a
commit e7dcf13764
24 changed files with 970 additions and 227 deletions
+35 -17
View File
@@ -28,9 +28,8 @@
# /docgen
# XML files should be in ~/src/weechat/doc/xx/autogen/ (where xx is language)
#
# History:
# 2008-08-22, FlashCode <flashcode@flashtux.org>:
# script creation
# Script written on 2008-08-22 by FlashCode <flashcode@flashtux.org>
#
use strict;
@@ -70,6 +69,10 @@ my %plugin_list = ("weechat" => "co", "alias" => "",
"python" => "", "ruby" => "",
"lua" => "", "xfer" => "co");
# options to ignore
my @ignore_options = ("weechat\\.bar\\..*",
"irc\\.server\\..*");
# --------------------------------[ init ]--------------------------------------
weechat::register("docgen", "FlashCode <flashcode\@flashtux.org>", $version,
@@ -95,9 +98,9 @@ sub get_commands
{
if (($command eq $plugin) || ($plugin_list{$plugin} =~ /c/))
{
$commands{$plugin}{$command}{"description"} = weechat::infolist_string($infolist, "description_en");
$commands{$plugin}{$command}{"args"} = weechat::infolist_string($infolist, "args_en");
$commands{$plugin}{$command}{"args_description"} = weechat::infolist_string($infolist, "args_description_en");
$commands{$plugin}{$command}{"description"} = weechat::infolist_string($infolist, "description");
$commands{$plugin}{$command}{"args"} = weechat::infolist_string($infolist, "args");
$commands{$plugin}{$command}{"args_description"} = weechat::infolist_string($infolist, "args_description");
$commands{$plugin}{$command}{"completion"} = weechat::infolist_string($infolist, "completion");
}
}
@@ -115,17 +118,29 @@ sub get_options
my $infolist = weechat::infolist_get("option", "", "");
while (weechat::infolist_next($infolist))
{
my $config = weechat::infolist_string($infolist, "config_name");
my $section = weechat::infolist_string($infolist, "section_name");
my $option = weechat::infolist_string($infolist, "option_name");
if ($plugin_list{$config} =~ /o/)
my $full_name = weechat::infolist_string($infolist, "full_name");
# check if option is ignored or not
my $ignore = 0;
foreach my $mask (@ignore_options)
{
$options{$config}{$section}{$option}{"type"} = weechat::infolist_string($infolist, "type");
$options{$config}{$section}{$option}{"string_values"} = weechat::infolist_string($infolist, "string_values");
$options{$config}{$section}{$option}{"default_value"} = weechat::infolist_string($infolist, "default_value");
$options{$config}{$section}{$option}{"min"} = weechat::infolist_integer($infolist, "min");
$options{$config}{$section}{$option}{"max"} = weechat::infolist_integer($infolist, "max");
$options{$config}{$section}{$option}{"description"} = weechat::infolist_string($infolist, "description_en");
$ignore = 1 if ($full_name =~ /${mask}/);
}
if ($ignore ne 1)
{
my $config = weechat::infolist_string($infolist, "config_name");
my $section = weechat::infolist_string($infolist, "section_name");
my $option = weechat::infolist_string($infolist, "option_name");
if ($plugin_list{$config} =~ /o/)
{
$options{$config}{$section}{$option}{"type"} = weechat::infolist_string($infolist, "type");
$options{$config}{$section}{$option}{"string_values"} = weechat::infolist_string($infolist, "string_values");
$options{$config}{$section}{$option}{"default_value"} = weechat::infolist_string($infolist, "default_value");
$options{$config}{$section}{$option}{"min"} = weechat::infolist_integer($infolist, "min");
$options{$config}{$section}{$option}{"max"} = weechat::infolist_integer($infolist, "max");
$options{$config}{$section}{$option}{"description"} = weechat::infolist_string($infolist, "description");
}
}
}
weechat::infolist_free($infolist);
@@ -221,10 +236,12 @@ sub docgen
my $max = $plugin_options{$config}{$section}{$option}{"max"};
my $description = $plugin_options{$config}{$section}{$option}{"description"};
$description = $d->get($description) if ($description ne "");
my $type_nls = $type;
$type_nls = $d->get($type_nls) if ($type_nls ne "");
print FILE "<row>\n";
print FILE " <entry><option>".$config.".".$section.".".$option."</option></entry>\n";
print FILE " <entry>".$type."</entry>\n";
print FILE " <entry>".$type_nls."</entry>\n";
print FILE " <entry>";
if ($string_values eq "")
{
@@ -237,6 +254,7 @@ sub docgen
print FILE $string_values;
}
print FILE "</entry>\n";
print FILE " <entry>".$default_value."</entry>\n";
print FILE " <entry>".$description."</entry>\n";
print FILE "</row>\n";
}
+115 -4
View File
File diff suppressed because it is too large Load Diff
+119 -33
View File
File diff suppressed because it is too large Load Diff
+119 -33
View File
File diff suppressed because it is too large Load Diff
+95 -2
View File
File diff suppressed because it is too large Load Diff
+119 -33
View File
File diff suppressed because it is too large Load Diff
+119 -33
View File
File diff suppressed because it is too large Load Diff
+94 -1
View File
File diff suppressed because it is too large Load Diff
+6 -6
View File
@@ -45,7 +45,7 @@ struct t_config_file *config_files = NULL;
struct t_config_file *last_config_file = NULL;
char *config_option_type_string[CONFIG_NUM_OPTION_TYPES] =
{ "boolean", "integer", "string", "color" };
{ N_("boolean"), N_("integer"), N_("string"), N_("color") };
char *config_boolean_true[] = { "on", "yes", "y", "true", "t", "1", NULL };
char *config_boolean_false[] = { "off", "no", "n", "false", "f", "0", NULL };
@@ -2182,16 +2182,16 @@ config_file_add_to_infolist (struct t_infolist *infolist,
}
if (!infolist_new_var_string (ptr_item,
"description",
(ptr_option->description
&& ptr_option->description[0]) ?
_(ptr_option->description) : ""))
ptr_option->description))
{
free (option_full_name);
return 0;
}
if (!infolist_new_var_string (ptr_item,
"description_en",
ptr_option->description))
"description_nls",
(ptr_option->description
&& ptr_option->description[0]) ?
_(ptr_option->description) : ""))
{
free (option_full_name);
return 0;
+28 -6
View File
File diff suppressed because it is too large Load Diff
+4
View File
@@ -202,6 +202,7 @@ struct t_hook_info
{
t_hook_callback_info *callback; /* info callback */
char *info_name; /* name of info returned */
char *description; /* description */
};
typedef struct t_infolist *(t_hook_callback_infolist)(void *data,
@@ -213,6 +214,7 @@ struct t_hook_infolist
{
t_hook_callback_infolist *callback; /* infolist callback */
char *infolist_name; /* name of infolist returned */
char *description; /* description */
};
/* hook variables */
@@ -297,6 +299,7 @@ extern char *hook_modifier_exec (struct t_weechat_plugin *plugin,
const char *string);
extern struct t_hook *hook_info (struct t_weechat_plugin *plugin,
const char *info_name,
const char *description,
t_hook_callback_info *callback,
void *callback_data);
extern char *hook_info_get (struct t_weechat_plugin *plugin,
@@ -304,6 +307,7 @@ extern char *hook_info_get (struct t_weechat_plugin *plugin,
const char *arguments);
extern struct t_hook *hook_infolist (struct t_weechat_plugin *plugin,
const char *infolist_name,
const char *description,
t_hook_callback_infolist *callback,
void *callback_data);
extern struct t_infolist *hook_infolist_get (struct t_weechat_plugin *plugin,
+2 -1
View File
@@ -89,5 +89,6 @@ void
alias_info_init ()
{
/* alias infolist hooks */
weechat_hook_infolist ("alias", &alias_info_get_infolist_cb, NULL);
weechat_hook_infolist ("alias", N_("list of alias"),
&alias_info_get_infolist_cb, NULL);
}
+2 -1
View File
@@ -53,5 +53,6 @@ void
fifo_info_init ()
{
/* fifo info hooks */
weechat_hook_info ("fifo_filename", &fifo_info_get_info_cb, NULL);
weechat_hook_info ("fifo_filename", N_("fifo filename"),
&fifo_info_get_info_cb, NULL);
}
+12 -6
View File
@@ -326,12 +326,18 @@ void
irc_info_init ()
{
/* irc info hooks */
weechat_hook_info ("irc_is_channel", &irc_info_get_info_cb, NULL);
weechat_hook_info ("irc_nick_from_host", &irc_info_get_info_cb, NULL);
weechat_hook_info ("irc_buffer", &irc_info_get_info_cb, NULL);
weechat_hook_info ("irc_is_channel", N_("1 if string is an IRC channel"),
&irc_info_get_info_cb, NULL);
weechat_hook_info ("irc_nick_from_host", N_("get nick from IRC host"),
&irc_info_get_info_cb, NULL);
weechat_hook_info ("irc_buffer", N_("get buffer pointer for an IRC server/channel"),
&irc_info_get_info_cb, NULL);
/* irc infolist hooks */
weechat_hook_infolist ("irc_server", &irc_info_get_infolist_cb, NULL);
weechat_hook_infolist ("irc_channel", &irc_info_get_infolist_cb, NULL);
weechat_hook_infolist ("irc_nick", &irc_info_get_infolist_cb, NULL);
weechat_hook_infolist ("irc_server", N_("list of IRC servers"),
&irc_info_get_infolist_cb, NULL);
weechat_hook_infolist ("irc_channel", N_("list of channels for an IRC server"),
&irc_info_get_infolist_cb, NULL);
weechat_hook_infolist ("irc_nick", N_("list of nicks for an IRC channel"),
&irc_info_get_infolist_cb, NULL);
}
+2 -1
View File
@@ -92,5 +92,6 @@ void
logger_info_init ()
{
/* irc infolist hooks */
weechat_hook_infolist ("logger_buffer", &logger_info_get_infolist_cb, NULL);
weechat_hook_infolist ("logger_buffer", N_("list of logger buffers"),
&logger_info_get_infolist_cb, NULL);
}
+36 -19
View File
@@ -675,25 +675,42 @@ void
plugin_api_init ()
{
/* WeeChat core info hooks */
hook_info (NULL, "version", &plugin_api_info_get_internal, NULL);
hook_info (NULL, "date", &plugin_api_info_get_internal, NULL);
hook_info (NULL, "dir_separator", &plugin_api_info_get_internal, NULL);
hook_info (NULL, "weechat_dir", &plugin_api_info_get_internal, NULL);
hook_info (NULL, "weechat_libdir", &plugin_api_info_get_internal, NULL);
hook_info (NULL, "weechat_sharedir", &plugin_api_info_get_internal, NULL);
hook_info (NULL, "weechat_localedir", &plugin_api_info_get_internal, NULL);
hook_info (NULL, "charset_terminal", &plugin_api_info_get_internal, NULL);
hook_info (NULL, "charset_internal", &plugin_api_info_get_internal, NULL);
hook_info (NULL, "inactivity", &plugin_api_info_get_internal, NULL);
hook_info (NULL, "filters_enabled", &plugin_api_info_get_internal, NULL);
hook_info (NULL, "version", N_("WeeChat version"),
&plugin_api_info_get_internal, NULL);
hook_info (NULL, "date", N_("WeeChat compilation date"),
&plugin_api_info_get_internal, NULL);
hook_info (NULL, "dir_separator", N_("directory separator"),
&plugin_api_info_get_internal, NULL);
hook_info (NULL, "weechat_dir", N_("WeeChat directory"),
&plugin_api_info_get_internal, NULL);
hook_info (NULL, "weechat_libdir", N_("WeeChat \"lib\" directory"),
&plugin_api_info_get_internal, NULL);
hook_info (NULL, "weechat_sharedir", N_("WeeChat \"share\" directory"),
&plugin_api_info_get_internal, NULL);
hook_info (NULL, "weechat_localedir", N_("WeeChat \"locale\" directory"),
&plugin_api_info_get_internal, NULL);
hook_info (NULL, "charset_terminal", N_("terminal charset"),
&plugin_api_info_get_internal, NULL);
hook_info (NULL, "charset_internal", N_("WeeChat internal charset"),
&plugin_api_info_get_internal, NULL);
hook_info (NULL, "inactivity", N_("keyboard inactivity (seconds)"),
&plugin_api_info_get_internal, NULL);
hook_info (NULL, "filters_enabled", N_("1 if filters are enabled"),
&plugin_api_info_get_internal, NULL);
/* WeeChat core infolist hooks */
hook_infolist (NULL, "buffer", &plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "buffer_lines", &plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "buffer", &plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "nicklist", &plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "window", &plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "hotlist", &plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "option", &plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "hook", &plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "buffer", N_("list of buffers"),
&plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "buffer_lines", N_("lines of a buffer"),
&plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "nicklist", N_("nicks in nicklist for a buffer"),
&plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "window", N_("list of windows"),
&plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "hotlist", N_("list of buffers in hotlist"),
&plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "option", N_("list of options"),
&plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "hook", N_("list of hooks"),
&plugin_api_infolist_get_internal, NULL);
}
+10 -6
View File
@@ -3105,7 +3105,7 @@ weechat_lua_api_hook_info_cb (void *data, const char *info_name,
static int
weechat_lua_api_hook_info (lua_State *L)
{
const char *info_name, *function;
const char *info_name, *description, *function;
char *result;
int n;
@@ -3123,18 +3123,20 @@ weechat_lua_api_hook_info (lua_State *L)
n = lua_gettop (lua_current_interpreter);
if (n < 2)
if (n < 3)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("hook_info");
LUA_RETURN_EMPTY;
}
info_name = lua_tostring (lua_current_interpreter, -2);
info_name = lua_tostring (lua_current_interpreter, -3);
description = lua_tostring (lua_current_interpreter, -2);
function = lua_tostring (lua_current_interpreter, -1);
result = script_ptr2str (script_api_hook_info (weechat_lua_plugin,
lua_current_script,
info_name,
description,
&weechat_lua_api_hook_info_cb,
function));
@@ -3178,7 +3180,7 @@ weechat_lua_api_hook_infolist_cb (void *data, const char *info_name,
static int
weechat_lua_api_hook_infolist (lua_State *L)
{
const char *infolist_name, *function;
const char *infolist_name, *description, *function;
char *result;
int n;
@@ -3196,18 +3198,20 @@ weechat_lua_api_hook_infolist (lua_State *L)
n = lua_gettop (lua_current_interpreter);
if (n < 2)
if (n < 3)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("hook_infolist");
LUA_RETURN_EMPTY;
}
infolist_name = lua_tostring (lua_current_interpreter, -2);
infolist_name = lua_tostring (lua_current_interpreter, -3);
description = lua_tostring (lua_current_interpreter, -2);
function = lua_tostring (lua_current_interpreter, -1);
result = script_ptr2str (script_api_hook_infolist (weechat_lua_plugin,
lua_current_script,
infolist_name,
description,
&weechat_lua_api_hook_infolist_cb,
function));
+10 -6
View File
@@ -2597,7 +2597,7 @@ weechat_perl_api_hook_info_cb (void *data, const char *info_name,
static XS (XS_weechat_hook_info)
{
char *result, *info_name, *perl_fn;
char *result, *info_name, *description, *perl_fn;
dXSARGS;
/* make C compiler happy */
@@ -2609,17 +2609,19 @@ static XS (XS_weechat_hook_info)
PERL_RETURN_EMPTY;
}
if (items < 2)
if (items < 3)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("hook_info");
PERL_RETURN_EMPTY;
}
info_name = SvPV (ST (0), PL_na);
perl_fn = SvPV (ST (1), PL_na);
description = SvPV (ST (1), PL_na);
perl_fn = SvPV (ST (2), PL_na);
result = script_ptr2str (script_api_hook_info (weechat_perl_plugin,
perl_current_script,
info_name,
description,
&weechat_perl_api_hook_info_cb,
perl_fn));
@@ -2662,7 +2664,7 @@ weechat_perl_api_hook_infolist_cb (void *data, const char *infolist_name,
static XS (XS_weechat_hook_infolist)
{
char *result, *infolist_name, *perl_fn;
char *result, *infolist_name, *description, *perl_fn;
dXSARGS;
/* make C compiler happy */
@@ -2674,17 +2676,19 @@ static XS (XS_weechat_hook_infolist)
PERL_RETURN_EMPTY;
}
if (items < 2)
if (items < 3)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("hook_infolist");
PERL_RETURN_EMPTY;
}
infolist_name = SvPV (ST (0), PL_na);
perl_fn = SvPV (ST (1), PL_na);
description = SvPV (ST (1), PL_na);
perl_fn = SvPV (ST (2), PL_na);
result = script_ptr2str (script_api_hook_infolist (weechat_perl_plugin,
perl_current_script,
infolist_name,
description,
&weechat_perl_api_hook_infolist_cb,
perl_fn));
@@ -2754,7 +2754,7 @@ weechat_python_api_hook_info_cb (void *data, const char *info_name,
static PyObject *
weechat_python_api_hook_info (PyObject *self, PyObject *args)
{
char *info_name, *function, *result;
char *info_name, *description, *function, *result;
PyObject *object;
/* make C compiler happy */
@@ -2767,9 +2767,10 @@ weechat_python_api_hook_info (PyObject *self, PyObject *args)
}
info_name = NULL;
description = NULL;
function = NULL;
if (!PyArg_ParseTuple (args, "ss", &info_name, &function))
if (!PyArg_ParseTuple (args, "sss", &info_name, &description, &function))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("hook_info");
PYTHON_RETURN_EMPTY;
@@ -2778,6 +2779,7 @@ weechat_python_api_hook_info (PyObject *self, PyObject *args)
result = script_ptr2str(script_api_hook_info (weechat_python_plugin,
python_current_script,
info_name,
description,
&weechat_python_api_hook_info_cb,
function));
@@ -2821,7 +2823,7 @@ weechat_python_api_hook_infolist_cb (void *data, const char *infolist_name,
static PyObject *
weechat_python_api_hook_infolist (PyObject *self, PyObject *args)
{
char *infolist_name, *function, *result;
char *infolist_name, *description, *function, *result;
PyObject *object;
/* make C compiler happy */
@@ -2834,9 +2836,10 @@ weechat_python_api_hook_infolist (PyObject *self, PyObject *args)
}
infolist_name = NULL;
description = NULL;
function = NULL;
if (!PyArg_ParseTuple (args, "ss", &infolist_name, &function))
if (!PyArg_ParseTuple (args, "sss", &infolist_name, &description, &function))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("hook_infolist");
PYTHON_RETURN_EMPTY;
@@ -2845,6 +2848,7 @@ weechat_python_api_hook_infolist (PyObject *self, PyObject *args)
result = script_ptr2str(script_api_hook_infolist (weechat_python_plugin,
python_current_script,
infolist_name,
description,
&weechat_python_api_hook_infolist_cb,
function));
+18 -8
View File
@@ -3162,9 +3162,10 @@ weechat_ruby_api_hook_info_cb (void *data, const char *info_name,
*/
static VALUE
weechat_ruby_api_hook_info (VALUE class, VALUE info_name, VALUE function)
weechat_ruby_api_hook_info (VALUE class, VALUE info_name, VALUE description,
VALUE function)
{
char *c_info_name, *c_function, *result;
char *c_info_name, *c_description, *c_function, *result;
VALUE return_value;
/* make C compiler happy */
@@ -3177,23 +3178,27 @@ weechat_ruby_api_hook_info (VALUE class, VALUE info_name, VALUE function)
}
c_info_name = NULL;
c_description = NULL;
c_function = NULL;
if (NIL_P (info_name) || NIL_P (function))
if (NIL_P (info_name) || NIL_P (description) || NIL_P (function))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("hook_info");
RUBY_RETURN_EMPTY;
}
Check_Type (info_name, T_STRING);
Check_Type (description, T_STRING);
Check_Type (function, T_STRING);
c_info_name = STR2CSTR (info_name);
c_description = STR2CSTR (description);
c_function = STR2CSTR (function);
result = script_ptr2str (script_api_hook_info (weechat_ruby_plugin,
ruby_current_script,
c_info_name,
c_description,
&weechat_ruby_api_hook_info_cb,
c_function));
@@ -3235,9 +3240,10 @@ weechat_ruby_api_hook_infolist_cb (void *data, const char *infolist_name,
*/
static VALUE
weechat_ruby_api_hook_infolist (VALUE class, VALUE infolist_name, VALUE function)
weechat_ruby_api_hook_infolist (VALUE class, VALUE infolist_name,
VALUE description, VALUE function)
{
char *c_infolist_name, *c_function, *result;
char *c_infolist_name, *c_description, *c_function, *result;
VALUE return_value;
/* make C compiler happy */
@@ -3250,23 +3256,27 @@ weechat_ruby_api_hook_infolist (VALUE class, VALUE infolist_name, VALUE function
}
c_infolist_name = NULL;
c_description = NULL;
c_function = NULL;
if (NIL_P (infolist_name) || NIL_P (function))
if (NIL_P (infolist_name) || NIL_P (description) || NIL_P (function))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("hook_infolist");
RUBY_RETURN_EMPTY;
}
Check_Type (infolist_name, T_STRING);
Check_Type (description, T_STRING);
Check_Type (function, T_STRING);
c_infolist_name = STR2CSTR (infolist_name);
c_description = STR2CSTR (description);
c_function = STR2CSTR (function);
result = script_ptr2str (script_api_hook_infolist (weechat_ruby_plugin,
ruby_current_script,
c_infolist_name,
c_description,
&weechat_ruby_api_hook_infolist_cb,
c_function));
@@ -4964,8 +4974,8 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
rb_define_module_function (ruby_mWeechat, "hook_completion_list_add", &weechat_ruby_api_hook_completion_list_add, 4);
rb_define_module_function (ruby_mWeechat, "hook_modifier", &weechat_ruby_api_hook_modifier, 2);
rb_define_module_function (ruby_mWeechat, "hook_modifier_exec", &weechat_ruby_api_hook_modifier_exec, 3);
rb_define_module_function (ruby_mWeechat, "hook_info", &weechat_ruby_api_hook_info, 2);
rb_define_module_function (ruby_mWeechat, "hook_infolist", &weechat_ruby_api_hook_infolist, 2);
rb_define_module_function (ruby_mWeechat, "hook_info", &weechat_ruby_api_hook_info, 3);
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);
+5 -2
View File
@@ -884,6 +884,7 @@ struct t_hook *
script_api_hook_info (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *info_name,
const char *description,
char *(*callback)(void *data,
const char *info_name,
const char *arguments),
@@ -896,7 +897,8 @@ script_api_hook_info (struct t_weechat_plugin *weechat_plugin,
if (!new_script_callback)
return NULL;
new_hook = weechat_hook_info (info_name, callback, new_script_callback);
new_hook = weechat_hook_info (info_name, description,
callback, new_script_callback);
if (!new_hook)
{
script_callback_free_data (new_script_callback);
@@ -922,6 +924,7 @@ struct t_hook *
script_api_hook_infolist (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *infolist_name,
const char *description,
struct t_infolist *(*callback)(void *data,
const char *infolist_name,
void *pointer,
@@ -935,7 +938,7 @@ script_api_hook_infolist (struct t_weechat_plugin *weechat_plugin,
if (!new_script_callback)
return NULL;
new_hook = weechat_hook_infolist (infolist_name,
new_hook = weechat_hook_infolist (infolist_name, description,
callback, new_script_callback);
if (!new_hook)
{
+2
View File
@@ -153,6 +153,7 @@ extern struct t_hook *script_api_hook_modifier (struct t_weechat_plugin *weechat
extern struct t_hook *script_api_hook_info (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *info_name,
const char *description,
char *(*callback)(void *data,
const char *info_name,
const char *arguments),
@@ -160,6 +161,7 @@ extern struct t_hook *script_api_hook_info (struct t_weechat_plugin *weechat_plu
extern struct t_hook *script_api_hook_infolist (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *infolist_name,
const char *description,
struct t_infolist *(*callback)(void *data,
const char *infolist_name,
void *pointer,
+8 -4
View File
@@ -370,12 +370,14 @@ struct t_weechat_plugin
const char *string);
struct t_hook *(*hook_info) (struct t_weechat_plugin *plugin,
const char *info_name,
const char *description,
char *(*callback)(void *data,
const char *info_name,
const char *arguments),
void *callback_data);
struct t_hook *(*hook_infolist) (struct t_weechat_plugin *plugin,
const char *infolist_name,
const char *description,
struct t_infolist *(*callback)(void *data,
const char *infolist_name,
void *pointer,
@@ -836,12 +838,14 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
__string) \
weechat_plugin->hook_modifier_exec(weechat_plugin, __modifier, \
__modifier_data, __string)
#define weechat_hook_info(__info_name, __callback, __data) \
#define weechat_hook_info(__info_name, __description, __callback, \
__data) \
weechat_plugin->hook_info(weechat_plugin, __info_name, \
__callback, __data)
#define weechat_hook_infolist(__infolist_name, __callback, __data) \
__description, __callback, __data)
#define weechat_hook_infolist(__infolist_name, __description, \
__callback, __data) \
weechat_plugin->hook_infolist(weechat_plugin, __infolist_name, \
__callback, __data)
__description, __callback, __data)
#define weechat_unhook(__hook) \
weechat_plugin->unhook( __hook)
#define weechat_unhook_all() \
+2 -1
View File
@@ -90,5 +90,6 @@ void
xfer_info_init ()
{
/* xfer infolist hooks */
weechat_hook_infolist ("xfer", &xfer_info_get_infolist_cb, NULL);
weechat_hook_infolist ("xfer", N_("list of xfer"),
&xfer_info_get_infolist_cb, NULL);
}