diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/plugin.c | 9 | ||||
-rw-r--r-- | src/plugins/weechat-plugin.h | 3 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index ba0415bd0..64213e39a 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -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); } diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index 242d46c5f..cbb470a8e 100644 --- a/src/plugins/weechat-plugin.h +++ b/src/plugins/weechat-plugin.h @@ -67,7 +67,7 @@ struct timeval; * please change the date with current one; for a second change at same * date, increment the 01, otherwise please keep 01. */ -#define WEECHAT_PLUGIN_API_VERSION "20170704-01" +#define WEECHAT_PLUGIN_API_VERSION "20171223-01" /* macros for defining plugin infos */ #define WEECHAT_PLUGIN_NAME(__name) \ @@ -255,6 +255,7 @@ struct t_weechat_plugin int priority; /* plugin priority (default is 1000) */ int initialized; /* plugin initialized? (init called) */ int debug; /* debug level for plugin (0=off) */ + struct t_hashtable *variables; /* plugin custom variables */ struct t_weechat_plugin *prev_plugin; /* link to previous plugin */ struct t_weechat_plugin *next_plugin; /* link to next plugin */ |