summaryrefslogtreecommitdiff
path: root/src/plugins/plugin.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2008-10-08 19:04:05 +0200
committerSebastien Helleu <flashcode@flashtux.org>2008-10-08 19:04:05 +0200
commit5d07aa14ed58bb7ba3a4566955d471861488f056 (patch)
tree59528af01029f965139a81bbf07bcd33007abbb6 /src/plugins/plugin.c
parent0e053e072b9eb8755e0bd9418d18a58e4ae8f96d (diff)
downloadweechat-5d07aa14ed58bb7ba3a4566955d471861488f056.zip
Add function to get plugin name (return "core" for WeeChat core)
Diffstat (limited to 'src/plugins/plugin.c')
-rw-r--r--src/plugins/plugin.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index c08de42ad..4b549ec3e 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -86,6 +86,18 @@ plugin_search (const char *name)
}
/*
+ * plugin_get_name: get name of plugin with a pointer
+ */
+
+char *
+plugin_get_name (struct t_weechat_plugin *plugin)
+{
+ static char *plugin_core = PLUGIN_CORE;
+
+ return (plugin) ? plugin->name : plugin_core;
+}
+
+/*
* plugin_load: load a WeeChat plugin (a dynamic library)
* return: pointer to new WeeChat plugin, NULL if error
*/
@@ -281,6 +293,8 @@ plugin_load (const char *filename)
new_plugin->charset = (charset) ? strdup (charset) : NULL;
/* functions */
+ new_plugin->plugin_get_name = &plugin_get_name;
+
new_plugin->charset_set = &plugin_api_charset_set;
new_plugin->iconv_to_internal = &string_iconv_to_internal;
new_plugin->iconv_from_internal = &string_iconv_from_internal;