diff options
-rw-r--r-- | ChangeLog.adoc | 1 | ||||
-rw-r--r-- | doc/de/autogen/plugin_api/hdata.adoc | 1 | ||||
-rw-r--r-- | doc/en/autogen/plugin_api/hdata.adoc | 1 | ||||
-rw-r--r-- | doc/fr/autogen/plugin_api/hdata.adoc | 1 | ||||
-rw-r--r-- | doc/it/autogen/plugin_api/hdata.adoc | 1 | ||||
-rw-r--r-- | doc/ja/autogen/plugin_api/hdata.adoc | 1 | ||||
-rw-r--r-- | doc/pl/autogen/plugin_api/hdata.adoc | 1 | ||||
-rw-r--r-- | src/plugins/plugin.c | 9 | ||||
-rw-r--r-- | src/plugins/weechat-plugin.h | 3 |
9 files changed, 18 insertions, 1 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 12784145f..0d845d612 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -21,6 +21,7 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] New features:: * core: add option weechat.completion.partial_completion_templates to force partial completion on specific templates + * api: add hashtable with variables in plugin structure [[v2.0.1]] == Version 2.0.1 (2017-12-20) diff --git a/doc/de/autogen/plugin_api/hdata.adoc b/doc/de/autogen/plugin_api/hdata.adoc index 89b793833..3507bc6d9 100644 --- a/doc/de/autogen/plugin_api/hdata.adoc +++ b/doc/de/autogen/plugin_api/hdata.adoc @@ -941,6 +941,7 @@ _charset_ (string) + _priority_ (integer) + _initialized_ (integer) + _debug_ (integer) + +_variables_ (hashtable) + _prev_plugin_ (pointer, hdata: "plugin") + _next_plugin_ (pointer, hdata: "plugin") + diff --git a/doc/en/autogen/plugin_api/hdata.adoc b/doc/en/autogen/plugin_api/hdata.adoc index e4fcdbc0f..ef728c994 100644 --- a/doc/en/autogen/plugin_api/hdata.adoc +++ b/doc/en/autogen/plugin_api/hdata.adoc @@ -941,6 +941,7 @@ _charset_ (string) + _priority_ (integer) + _initialized_ (integer) + _debug_ (integer) + +_variables_ (hashtable) + _prev_plugin_ (pointer, hdata: "plugin") + _next_plugin_ (pointer, hdata: "plugin") + diff --git a/doc/fr/autogen/plugin_api/hdata.adoc b/doc/fr/autogen/plugin_api/hdata.adoc index b23d4e8e1..ec3371047 100644 --- a/doc/fr/autogen/plugin_api/hdata.adoc +++ b/doc/fr/autogen/plugin_api/hdata.adoc @@ -941,6 +941,7 @@ _charset_ (string) + _priority_ (integer) + _initialized_ (integer) + _debug_ (integer) + +_variables_ (hashtable) + _prev_plugin_ (pointer, hdata: "plugin") + _next_plugin_ (pointer, hdata: "plugin") + diff --git a/doc/it/autogen/plugin_api/hdata.adoc b/doc/it/autogen/plugin_api/hdata.adoc index 61a433c5b..2d22b9fb8 100644 --- a/doc/it/autogen/plugin_api/hdata.adoc +++ b/doc/it/autogen/plugin_api/hdata.adoc @@ -941,6 +941,7 @@ _charset_ (string) + _priority_ (integer) + _initialized_ (integer) + _debug_ (integer) + +_variables_ (hashtable) + _prev_plugin_ (pointer, hdata: "plugin") + _next_plugin_ (pointer, hdata: "plugin") + diff --git a/doc/ja/autogen/plugin_api/hdata.adoc b/doc/ja/autogen/plugin_api/hdata.adoc index 5730a473e..13b09817b 100644 --- a/doc/ja/autogen/plugin_api/hdata.adoc +++ b/doc/ja/autogen/plugin_api/hdata.adoc @@ -941,6 +941,7 @@ _charset_ (string) + _priority_ (integer) + _initialized_ (integer) + _debug_ (integer) + +_variables_ (hashtable) + _prev_plugin_ (pointer, hdata: "plugin") + _next_plugin_ (pointer, hdata: "plugin") + diff --git a/doc/pl/autogen/plugin_api/hdata.adoc b/doc/pl/autogen/plugin_api/hdata.adoc index 97ac72c13..cc50029d6 100644 --- a/doc/pl/autogen/plugin_api/hdata.adoc +++ b/doc/pl/autogen/plugin_api/hdata.adoc @@ -941,6 +941,7 @@ _charset_ (string) + _priority_ (integer) + _initialized_ (integer) + _debug_ (integer) + +_variables_ (hashtable) + _prev_plugin_ (pointer, hdata: "plugin") + _next_plugin_ (pointer, hdata: "plugin") + 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 */ |