mirror of
https://github.com/weechat/weechat.git
synced 2026-07-05 01:03:14 +02:00
api: add hashtable with variables in plugin structure
This commit is contained in:
@@ -592,6 +592,10 @@ plugin_load (const char *filename, int init_plugin, int argc, char **argv)
|
||||
new_plugin->initialized = 0;
|
||||
ptr_option = config_weechat_debug_get (name);
|
||||
new_plugin->debug = (ptr_option) ? CONFIG_INTEGER(ptr_option) : 0;
|
||||
new_plugin->variables = hashtable_new (
|
||||
32,
|
||||
WEECHAT_HASHTABLE_STRING, WEECHAT_HASHTABLE_STRING,
|
||||
NULL, NULL);
|
||||
|
||||
/* functions */
|
||||
new_plugin->plugin_get_name = &plugin_get_name;
|
||||
@@ -1174,6 +1178,7 @@ plugin_remove (struct t_weechat_plugin *plugin)
|
||||
free (plugin->license);
|
||||
if (plugin->charset)
|
||||
free (plugin->charset);
|
||||
hashtable_free (plugin->variables);
|
||||
|
||||
free (plugin);
|
||||
|
||||
@@ -1406,6 +1411,7 @@ plugin_hdata_plugin_cb (const void *pointer, void *data,
|
||||
HDATA_VAR(struct t_weechat_plugin, priority, INTEGER, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, initialized, INTEGER, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, debug, INTEGER, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, variables, HASHTABLE, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, prev_plugin, POINTER, 0, NULL, hdata_name);
|
||||
HDATA_VAR(struct t_weechat_plugin, next_plugin, POINTER, 0, NULL, hdata_name);
|
||||
HDATA_LIST(weechat_plugins, WEECHAT_HDATA_LIST_CHECK_POINTERS);
|
||||
@@ -1463,6 +1469,8 @@ plugin_add_to_infolist (struct t_infolist *infolist,
|
||||
return 0;
|
||||
if (!infolist_new_var_integer (ptr_item, "debug", plugin->debug))
|
||||
return 0;
|
||||
if (!hashtable_add_to_infolist (plugin->variables, ptr_item, "var"))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -1492,6 +1500,7 @@ plugin_print_log ()
|
||||
log_printf (" priority . . . . . . . : %d", ptr_plugin->priority);
|
||||
log_printf (" initialized. . . . . . : %d", ptr_plugin->initialized);
|
||||
log_printf (" debug. . . . . . . . . : %d", ptr_plugin->debug);
|
||||
hashtable_print_log (ptr_plugin->variables, "variables");
|
||||
log_printf (" prev_plugin. . . . . . : 0x%lx", ptr_plugin->prev_plugin);
|
||||
log_printf (" next_plugin. . . . . . : 0x%lx", ptr_plugin->next_plugin);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user