1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-28 22:06:38 +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
+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
@@ -1331,6 +1331,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,
t_hook_callback_info *callback, void *callback_data)
{
struct t_hook *new_hook;
@@ -1354,6 +1355,8 @@ hook_info (struct t_weechat_plugin *plugin, const char *info_name,
new_hook->hook_data = new_hook_info;
new_hook_info->callback = callback;
new_hook_info->info_name = strdup (info_name);
new_hook_info->description = (description) ?
strdup (description) : strdup ("");
hook_add_to_list (new_hook);
@@ -1413,6 +1416,7 @@ 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,
t_hook_callback_infolist *callback, void *callback_data)
{
struct t_hook *new_hook;
@@ -1436,6 +1440,8 @@ hook_infolist (struct t_weechat_plugin *plugin, const char *infolist_name,
new_hook->hook_data = new_hook_infolist;
new_hook_infolist->callback = callback;
new_hook_infolist->infolist_name = strdup (infolist_name);
new_hook_infolist->description = (description) ?
strdup (description) : strdup ("");
hook_add_to_list (new_hook);
@@ -1706,26 +1712,26 @@ hook_add_to_infolist_type (struct t_infolist *infolist,
return 0;
if (!infolist_new_var_integer (ptr_item, "level", HOOK_COMMAND(ptr_hook, level)))
return 0;
if (!infolist_new_var_string (ptr_item, "description_en",
if (!infolist_new_var_string (ptr_item, "description",
HOOK_COMMAND(ptr_hook, description)))
return 0;
if (!infolist_new_var_string (ptr_item, "description",
if (!infolist_new_var_string (ptr_item, "description_nls",
(HOOK_COMMAND(ptr_hook, description)
&& HOOK_COMMAND(ptr_hook, description)[0]) ?
_(HOOK_COMMAND(ptr_hook, description)) : ""))
return 0;
if (!infolist_new_var_string (ptr_item, "args_en",
if (!infolist_new_var_string (ptr_item, "args",
HOOK_COMMAND(ptr_hook, args)))
return 0;
if (!infolist_new_var_string (ptr_item, "args",
if (!infolist_new_var_string (ptr_item, "args_nls",
(HOOK_COMMAND(ptr_hook, args)
&& HOOK_COMMAND(ptr_hook, args)[0]) ?
_(HOOK_COMMAND(ptr_hook, args)) : ""))
return 0;
if (!infolist_new_var_string (ptr_item, "args_description_en",
if (!infolist_new_var_string (ptr_item, "args_description",
HOOK_COMMAND(ptr_hook, args_description)))
return 0;
if (!infolist_new_var_string (ptr_item, "args_description",
if (!infolist_new_var_string (ptr_item, "args_description_nls",
(HOOK_COMMAND(ptr_hook, args_description)
&& HOOK_COMMAND(ptr_hook, args_description)[0]) ?
_(HOOK_COMMAND(ptr_hook, args_description)) : ""))
@@ -1854,6 +1860,13 @@ hook_add_to_infolist_type (struct t_infolist *infolist,
return 0;
if (!infolist_new_var_string (ptr_item, "info_name", HOOK_INFO(ptr_hook, info_name)))
return 0;
if (!infolist_new_var_string (ptr_item, "description", HOOK_INFO(ptr_hook, description)))
return 0;
if (!infolist_new_var_string (ptr_item, "description_nls",
(HOOK_INFO(ptr_hook, description)
&& HOOK_INFO(ptr_hook, description)[0]) ?
_(HOOK_INFO(ptr_hook, description)) : ""))
return 0;
}
break;
case HOOK_TYPE_INFOLIST:
@@ -1863,6 +1876,13 @@ hook_add_to_infolist_type (struct t_infolist *infolist,
return 0;
if (!infolist_new_var_string (ptr_item, "infolist_name", HOOK_INFOLIST(ptr_hook, infolist_name)))
return 0;
if (!infolist_new_var_string (ptr_item, "description", HOOK_INFOLIST(ptr_hook, description)))
return 0;
if (!infolist_new_var_string (ptr_item, "description_nls",
(HOOK_INFOLIST(ptr_hook, description)
&& HOOK_INFOLIST(ptr_hook, description)[0]) ?
_(HOOK_INFOLIST(ptr_hook, description)) : ""))
return 0;
}
break;
case HOOK_NUM_TYPES:
@@ -2043,6 +2063,7 @@ hook_print_log ()
log_printf (" info data:");
log_printf (" callback . . . . . . : 0x%x", 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));
}
break;
case HOOK_TYPE_INFOLIST:
@@ -2051,6 +2072,7 @@ hook_print_log ()
log_printf (" infolist data:");
log_printf (" callback . . . . . . : 0x%x", 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));
}
break;
case HOOK_NUM_TYPES:
+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,