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

Add description of arguments for API functions hook_info and hook_infolist

This commit is contained in:
Sebastien Helleu
2010-02-12 17:15:30 +01:00
parent 8d25a75200
commit 922e67cabd
42 changed files with 1697 additions and 294 deletions
+39 -2
View File
@@ -2000,7 +2000,7 @@ hook_modifier_exec (struct t_weechat_plugin *plugin, const char *modifier,
struct t_hook *
hook_info (struct t_weechat_plugin *plugin, const char *info_name,
const char *description,
const char *description, const char *args_description,
t_hook_callback_info *callback, void *callback_data)
{
struct t_hook *new_hook;
@@ -2026,6 +2026,8 @@ hook_info (struct t_weechat_plugin *plugin, const char *info_name,
new_hook_info->info_name = strdup (info_name);
new_hook_info->description = (description) ?
strdup (description) : strdup ("");
new_hook_info->args_description = (args_description) ?
strdup (args_description) : strdup ("");
hook_add_to_list (new_hook);
@@ -2085,7 +2087,8 @@ hook_info_get (struct t_weechat_plugin *plugin, const char *info_name,
struct t_hook *
hook_infolist (struct t_weechat_plugin *plugin, const char *infolist_name,
const char *description,
const char *description, const char *pointer_description,
const char *args_description,
t_hook_callback_infolist *callback, void *callback_data)
{
struct t_hook *new_hook;
@@ -2111,6 +2114,10 @@ hook_infolist (struct t_weechat_plugin *plugin, const char *infolist_name,
new_hook_infolist->infolist_name = strdup (infolist_name);
new_hook_infolist->description = (description) ?
strdup (description) : strdup ("");
new_hook_infolist->pointer_description = (pointer_description) ?
strdup (pointer_description) : strdup ("");
new_hook_infolist->args_description = (args_description) ?
strdup (args_description) : strdup ("");
hook_add_to_list (new_hook);
@@ -2311,12 +2318,18 @@ unhook (struct t_hook *hook)
free (HOOK_INFO(hook, info_name));
if (HOOK_INFO(hook, description))
free (HOOK_INFO(hook, description));
if (HOOK_INFO(hook, args_description))
free (HOOK_INFO(hook, args_description));
break;
case HOOK_TYPE_INFOLIST:
if (HOOK_INFOLIST(hook, infolist_name))
free (HOOK_INFOLIST(hook, infolist_name));
if (HOOK_INFOLIST(hook, description))
free (HOOK_INFOLIST(hook, description));
if (HOOK_INFOLIST(hook, pointer_description))
free (HOOK_INFOLIST(hook, pointer_description));
if (HOOK_INFOLIST(hook, args_description))
free (HOOK_INFOLIST(hook, args_description));
break;
case HOOK_NUM_TYPES:
/* this constant is used to count types only,
@@ -2632,6 +2645,13 @@ hook_add_to_infolist_type (struct t_infolist *infolist,
&& HOOK_INFO(ptr_hook, description)[0]) ?
_(HOOK_INFO(ptr_hook, description)) : ""))
return 0;
if (!infolist_new_var_string (ptr_item, "args_description", HOOK_INFO(ptr_hook, args_description)))
return 0;
if (!infolist_new_var_string (ptr_item, "args_description_nls",
(HOOK_INFO(ptr_hook, args_description)
&& HOOK_INFO(ptr_hook, args_description)[0]) ?
_(HOOK_INFO(ptr_hook, args_description)) : ""))
return 0;
}
break;
case HOOK_TYPE_INFOLIST:
@@ -2648,6 +2668,20 @@ hook_add_to_infolist_type (struct t_infolist *infolist,
&& HOOK_INFOLIST(ptr_hook, description)[0]) ?
_(HOOK_INFOLIST(ptr_hook, description)) : ""))
return 0;
if (!infolist_new_var_string (ptr_item, "pointer_description", HOOK_INFOLIST(ptr_hook, pointer_description)))
return 0;
if (!infolist_new_var_string (ptr_item, "pointer_description_nls",
(HOOK_INFOLIST(ptr_hook, pointer_description)
&& HOOK_INFOLIST(ptr_hook, pointer_description)[0]) ?
_(HOOK_INFOLIST(ptr_hook, pointer_description)) : ""))
return 0;
if (!infolist_new_var_string (ptr_item, "args_description", HOOK_INFOLIST(ptr_hook, args_description)))
return 0;
if (!infolist_new_var_string (ptr_item, "args_description_nls",
(HOOK_INFOLIST(ptr_hook, args_description)
&& HOOK_INFOLIST(ptr_hook, args_description)[0]) ?
_(HOOK_INFOLIST(ptr_hook, args_description)) : ""))
return 0;
}
break;
case HOOK_NUM_TYPES:
@@ -2878,6 +2912,7 @@ hook_print_log ()
log_printf (" callback. . . . . . . : 0x%lx", HOOK_INFO(ptr_hook, callback));
log_printf (" info_name . . . . . . : '%s'", HOOK_INFO(ptr_hook, info_name));
log_printf (" description . . . . . : '%s'", HOOK_INFO(ptr_hook, description));
log_printf (" args_description. . . : '%s'", HOOK_INFO(ptr_hook, args_description));
}
break;
case HOOK_TYPE_INFOLIST:
@@ -2887,6 +2922,8 @@ hook_print_log ()
log_printf (" callback. . . . . . . : 0x%lx", HOOK_INFOLIST(ptr_hook, callback));
log_printf (" infolist_name . . . . : '%s'", HOOK_INFOLIST(ptr_hook, infolist_name));
log_printf (" description . . . . . : '%s'", HOOK_INFOLIST(ptr_hook, description));
log_printf (" pointer_description . : '%s'", HOOK_INFOLIST(ptr_hook, pointer_description));
log_printf (" args_description. . . : '%s'", HOOK_INFOLIST(ptr_hook, args_description));
}
break;
case HOOK_NUM_TYPES:
+6
View File
@@ -290,6 +290,7 @@ struct t_hook_info
t_hook_callback_info *callback; /* info callback */
char *info_name; /* name of info returned */
char *description; /* description */
char *args_description; /* description of arguments */
};
/* hook infolist */
@@ -304,6 +305,8 @@ struct t_hook_infolist
t_hook_callback_infolist *callback; /* infolist callback */
char *infolist_name; /* name of infolist returned */
char *description; /* description */
char *pointer_description; /* description of pointer */
char *args_description; /* description of arguments */
};
/* hook variables */
@@ -409,6 +412,7 @@ extern char *hook_modifier_exec (struct t_weechat_plugin *plugin,
extern struct t_hook *hook_info (struct t_weechat_plugin *plugin,
const char *info_name,
const char *description,
const char *args_description,
t_hook_callback_info *callback,
void *callback_data);
extern const char *hook_info_get (struct t_weechat_plugin *plugin,
@@ -417,6 +421,8 @@ extern const char *hook_info_get (struct t_weechat_plugin *plugin,
extern struct t_hook *hook_infolist (struct t_weechat_plugin *plugin,
const char *infolist_name,
const char *description,
const char *pointer_description,
const char *args_description,
t_hook_callback_infolist *callback,
void *callback_data);
extern struct t_infolist *hook_infolist_get (struct t_weechat_plugin *plugin,