mirror of
https://github.com/weechat/weechat.git
synced 2026-07-06 01:33:12 +02:00
Added macros for name/description/author/version/license of plugins
This commit is contained in:
+22
-16
@@ -895,6 +895,12 @@ command_plugin_list (char *name, int full)
|
||||
|
||||
if (full)
|
||||
{
|
||||
/* second line of plugin info */
|
||||
gui_chat_printf (NULL,
|
||||
_(" written by \"%s\", license: s%"),
|
||||
ptr_plugin->author,
|
||||
ptr_plugin->license);
|
||||
|
||||
/* commands hooked */
|
||||
hook_found = 0;
|
||||
for (ptr_hook = weechat_hooks[HOOK_TYPE_COMMAND]; ptr_hook;
|
||||
@@ -903,10 +909,10 @@ command_plugin_list (char *name, int full)
|
||||
if (!ptr_hook->deleted && (ptr_hook->plugin == ptr_plugin))
|
||||
{
|
||||
if (!hook_found)
|
||||
gui_chat_printf (NULL, _(" commands hooked:"));
|
||||
gui_chat_printf (NULL, _(" commands hooked:"));
|
||||
hook_found = 1;
|
||||
gui_chat_printf (NULL,
|
||||
" /%s %s%s%s",
|
||||
" /%s %s%s%s",
|
||||
HOOK_COMMAND(ptr_hook, command),
|
||||
HOOK_COMMAND(ptr_hook, description) ? "(" : "",
|
||||
HOOK_COMMAND(ptr_hook, description) ?
|
||||
@@ -923,14 +929,14 @@ command_plugin_list (char *name, int full)
|
||||
if (!ptr_hook->deleted && (ptr_hook->plugin == ptr_plugin))
|
||||
{
|
||||
if (!hook_found)
|
||||
gui_chat_printf (NULL, _(" timers hooked:"));
|
||||
gui_chat_printf (NULL, _(" timers hooked:"));
|
||||
hook_found = 1;
|
||||
interval = (HOOK_TIMER(ptr_hook, interval) % 1000 == 0) ?
|
||||
HOOK_TIMER(ptr_hook, interval) / 1000 :
|
||||
HOOK_TIMER(ptr_hook, interval);
|
||||
if (HOOK_TIMER(ptr_hook, remaining_calls) > 0)
|
||||
gui_chat_printf (NULL,
|
||||
_(" %d %s "
|
||||
_(" %d %s "
|
||||
"(%d calls remaining)"),
|
||||
interval,
|
||||
(HOOK_TIMER(ptr_hook, interval) % 1000 == 0) ?
|
||||
@@ -939,7 +945,7 @@ command_plugin_list (char *name, int full)
|
||||
HOOK_TIMER(ptr_hook, remaining_calls));
|
||||
else
|
||||
gui_chat_printf (NULL,
|
||||
_(" %d %s "
|
||||
_(" %d %s "
|
||||
"(no call limit)"),
|
||||
interval,
|
||||
(HOOK_TIMER(ptr_hook, interval) % 1000 == 0) ?
|
||||
@@ -957,10 +963,10 @@ command_plugin_list (char *name, int full)
|
||||
{
|
||||
if (!hook_found)
|
||||
gui_chat_printf (NULL,
|
||||
_(" fd hooked:"));
|
||||
_(" fd hooked:"));
|
||||
hook_found = 1;
|
||||
gui_chat_printf (NULL,
|
||||
_(" %d (flags: %d)"),
|
||||
_(" %d (flags: %d)"),
|
||||
HOOK_FD(ptr_hook, fd),
|
||||
HOOK_FD(ptr_hook, flags));
|
||||
}
|
||||
@@ -974,18 +980,18 @@ command_plugin_list (char *name, int full)
|
||||
if (!ptr_hook->deleted && (ptr_hook->plugin == ptr_plugin))
|
||||
{
|
||||
if (!hook_found)
|
||||
gui_chat_printf (NULL, _(" prints hooked:"));
|
||||
gui_chat_printf (NULL, _(" prints hooked:"));
|
||||
hook_found = 1;
|
||||
if (HOOK_PRINT(ptr_hook, buffer))
|
||||
gui_chat_printf (NULL,
|
||||
_(" buffer: %s / %s, message: \"%s\""),
|
||||
_(" buffer: %s / %s, message: \"%s\""),
|
||||
HOOK_PRINT(ptr_hook, buffer)->category,
|
||||
HOOK_PRINT(ptr_hook, buffer)->name,
|
||||
HOOK_PRINT(ptr_hook, message) ?
|
||||
HOOK_PRINT(ptr_hook, message) : _("(none)"));
|
||||
else
|
||||
gui_chat_printf (NULL,
|
||||
_(" message: \"%s\""),
|
||||
_(" message: \"%s\""),
|
||||
HOOK_PRINT(ptr_hook, message) ?
|
||||
HOOK_PRINT(ptr_hook, message) : _("(none)"));
|
||||
}
|
||||
@@ -999,10 +1005,10 @@ command_plugin_list (char *name, int full)
|
||||
if (!ptr_hook->deleted && (ptr_hook->plugin == ptr_plugin))
|
||||
{
|
||||
if (!hook_found)
|
||||
gui_chat_printf (NULL, _(" signals hooked:"));
|
||||
gui_chat_printf (NULL, _(" signals hooked:"));
|
||||
hook_found = 1;
|
||||
gui_chat_printf (NULL,
|
||||
_(" signal: %s"),
|
||||
_(" signal: %s"),
|
||||
HOOK_SIGNAL(ptr_hook, signal) ?
|
||||
HOOK_SIGNAL(ptr_hook, signal) : _("(all)"));
|
||||
}
|
||||
@@ -1017,11 +1023,11 @@ command_plugin_list (char *name, int full)
|
||||
{
|
||||
if (!hook_found)
|
||||
gui_chat_printf (NULL,
|
||||
_(" configuration options "
|
||||
_(" configuration options "
|
||||
"hooked:"));
|
||||
hook_found = 1;
|
||||
gui_chat_printf (NULL,
|
||||
" (%s) %s",
|
||||
" (%s) %s",
|
||||
HOOK_CONFIG(ptr_hook, type) ?
|
||||
HOOK_CONFIG(ptr_hook, type) : "*",
|
||||
HOOK_CONFIG(ptr_hook, option) ?
|
||||
@@ -1038,10 +1044,10 @@ command_plugin_list (char *name, int full)
|
||||
{
|
||||
if (!hook_found)
|
||||
gui_chat_printf (NULL,
|
||||
_(" completion hooked:"));
|
||||
_(" completions hooked:"));
|
||||
hook_found = 1;
|
||||
gui_chat_printf (NULL,
|
||||
" %s",
|
||||
" %s",
|
||||
HOOK_COMPLETION(ptr_hook, completion));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,9 +30,11 @@
|
||||
#include "alias.h"
|
||||
|
||||
|
||||
char plugin_name[] = "alias";
|
||||
char plugin_version[] = "0.1";
|
||||
char plugin_description[] = "Alias plugin for WeeChat";
|
||||
WEECHAT_PLUGIN_NAME("alias");
|
||||
WEECHAT_PLUGIN_DESCRIPTION("Alias plugin for WeeChat");
|
||||
WEECHAT_PLUGIN_AUTHOR("FlashCode <flashcode@flashtux.org>");
|
||||
WEECHAT_PLUGIN_VERSION("0.1");
|
||||
WEECHAT_PLUGIN_LICENSE("GPL");
|
||||
|
||||
struct t_weechat_plugin *weechat_alias_plugin = NULL;
|
||||
#define weechat_plugin weechat_alias_plugin
|
||||
|
||||
@@ -27,9 +27,12 @@
|
||||
#include "../weechat-plugin.h"
|
||||
#include "aspell.h"
|
||||
|
||||
char plugin_name[] = "aspell";
|
||||
char plugin_version[] = "0.1";
|
||||
char plugin_description[] = "Aspell plugin for WeeChat";
|
||||
|
||||
WEECHAT_PLUGIN_NAME("aspell");
|
||||
WEECHAT_PLUGIN_DESCRIPTION("Aspell plugin for WeeChat");
|
||||
WEECHAT_PLUGIN_AUTHOR("FlashCode <flashcode@flashtux.org>");
|
||||
WEECHAT_PLUGIN_VERSION("0.1");
|
||||
WEECHAT_LICENSE("GPL");
|
||||
|
||||
struct t_weechat_plugin *weechat_aspell_plugin = NULL;
|
||||
#define weechat_plugin weechat_aspell_plugin
|
||||
|
||||
@@ -28,9 +28,11 @@
|
||||
#include "../weechat-plugin.h"
|
||||
|
||||
|
||||
char plugin_name[] = "charset";
|
||||
char plugin_version[] = "0.1";
|
||||
char plugin_description[] = "Charset plugin for WeeChat";
|
||||
WEECHAT_PLUGIN_NAME("charset");
|
||||
WEECHAT_PLUGIN_DESCRIPTION("Charset plugin for WeeChat");
|
||||
WEECHAT_PLUGIN_AUTHOR("FlashCode <flashcode@flashtux.org>");
|
||||
WEECHAT_PLUGIN_VERSION("0.1");
|
||||
WEECHAT_PLUGIN_LICENSE("GPL");
|
||||
|
||||
struct t_weechat_plugin *weechat_charset_plugin = NULL;
|
||||
#define weechat_plugin weechat_charset_plugin
|
||||
|
||||
@@ -35,9 +35,11 @@
|
||||
#include "../weechat-plugin.h"
|
||||
|
||||
|
||||
char plugin_name[] = "demo";
|
||||
char plugin_version[] = "0.1";
|
||||
char plugin_description[] = "Demo plugin for WeeChat";
|
||||
WEECHAT_PLUGIN_NAME("demo");
|
||||
WEECHAT_PLUGIN_DESCRIPTION("Demo plugin for WeeChat");
|
||||
WEECHAT_PLUGIN_AUTHOR("FlashCode <flashcode@flashtux.org>");
|
||||
WEECHAT_PLUGIN_VERSION("0.1");
|
||||
WEECHAT_PLUGIN_LICENSE("GPL");
|
||||
|
||||
struct t_weechat_plugin *weechat_demo_plugin = NULL;
|
||||
#define weechat_plugin weechat_demo_plugin
|
||||
|
||||
@@ -34,9 +34,11 @@
|
||||
#include "../weechat-plugin.h"
|
||||
|
||||
|
||||
char plugin_name[] = "fifo";
|
||||
char plugin_version[] = "0.1";
|
||||
char plugin_description[] = "Fifo plugin for WeeChat";
|
||||
WEECHAT_PLUGIN_NAME("fifo");
|
||||
WEECHAT_PLUGIN_DESCRIPTION("Fifo plugin for WeeChat");
|
||||
WEECHAT_PLUGIN_AUTHOR("FlashCode <flashcode@flashtux.org>");
|
||||
WEECHAT_PLUGIN_VERSION("0.1");
|
||||
WEECHAT_PLUGIN_LICENSE("GPL");
|
||||
|
||||
struct t_weechat_plugin *weechat_fifo_plugin = NULL;
|
||||
#define weechat_plugin weechat_fifo_plugin
|
||||
|
||||
@@ -39,13 +39,15 @@
|
||||
#include "irc-dcc.h"
|
||||
|
||||
|
||||
char plugin_name[] = "irc";
|
||||
char plugin_version[] = "0.1";
|
||||
char plugin_description[] = "IRC (Internet Relay Chat)";
|
||||
WEECHAT_PLUGIN_NAME("irc");
|
||||
WEECHAT_PLUGIN_DESCRIPTION("IRC (Internet Relay Chat) plugin for WeeChat");
|
||||
WEECHAT_PLUGIN_AUTHOR("FlashCode <flashcode@flashtux.org>");
|
||||
WEECHAT_PLUGIN_VERSION("0.1");
|
||||
WEECHAT_PLUGIN_LICENSE("GPL");
|
||||
|
||||
struct t_weechat_plugin *weechat_irc_plugin = NULL;
|
||||
|
||||
struct t_hook *irc_hook_timer = NULL;
|
||||
struct t_hook *irc_hook_timer = NULL;
|
||||
struct t_hook *irc_hook_timer_check_away = NULL;
|
||||
|
||||
int irc_debug = 0;
|
||||
|
||||
@@ -39,9 +39,11 @@
|
||||
#include "logger-tail.h"
|
||||
|
||||
|
||||
char plugin_name[] = "logger";
|
||||
char plugin_version[] = "0.1";
|
||||
char plugin_description[] = "Logger plugin for WeeChat";
|
||||
WEECHAT_PLUGIN_NAME("logger");
|
||||
WEECHAT_PLUGIN_DESCRIPTION("Logger plugin for WeeChat");
|
||||
WEECHAT_PLUGIN_AUTHOR("FlashCode <flashcode@flashtux.org>");
|
||||
WEECHAT_PLUGIN_VERSION("0.1");
|
||||
WEECHAT_PLUGIN_LICENSE("GPL");
|
||||
|
||||
struct t_weechat_plugin *weechat_logger_plugin = NULL;
|
||||
|
||||
|
||||
+41
-9
@@ -84,7 +84,7 @@ plugin_load (char *filename)
|
||||
{
|
||||
char *full_name;
|
||||
void *handle;
|
||||
char *name, *description, *version, *charset;
|
||||
char *name, *author, *description, *version, *license, *charset;
|
||||
t_weechat_init_func *init_func;
|
||||
struct t_weechat_plugin *new_plugin;
|
||||
|
||||
@@ -108,7 +108,7 @@ plugin_load (char *filename)
|
||||
}
|
||||
|
||||
/* look for plugin name */
|
||||
name = dlsym (handle, "plugin_name");
|
||||
name = dlsym (handle, "weechat_plugin_name");
|
||||
if (!name)
|
||||
{
|
||||
dlclose (handle);
|
||||
@@ -116,7 +116,7 @@ plugin_load (char *filename)
|
||||
_("%sError: symbol \"%s\" not found in "
|
||||
"plugin \"%s\", failed to load"),
|
||||
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
|
||||
"plugin_name",
|
||||
"weechat_plugin_name",
|
||||
full_name);
|
||||
free (full_name);
|
||||
return NULL;
|
||||
@@ -136,7 +136,7 @@ plugin_load (char *filename)
|
||||
}
|
||||
|
||||
/* look for plugin description */
|
||||
description = dlsym (handle, "plugin_description");
|
||||
description = dlsym (handle, "weechat_plugin_description");
|
||||
if (!description)
|
||||
{
|
||||
dlclose (handle);
|
||||
@@ -144,14 +144,29 @@ plugin_load (char *filename)
|
||||
_("%sError: symbol \"%s\" not found "
|
||||
"in plugin \"%s\", failed to load"),
|
||||
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
|
||||
"plugin_description",
|
||||
"weechat_plugin_description",
|
||||
full_name);
|
||||
free (full_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* look for plugin author */
|
||||
author = dlsym (handle, "weechat_plugin_author");
|
||||
if (!author)
|
||||
{
|
||||
dlclose (handle);
|
||||
gui_chat_printf (NULL,
|
||||
_("%sError: symbol \"%s\" not found "
|
||||
"in plugin \"%s\", failed to load"),
|
||||
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
|
||||
"weechat_plugin_author",
|
||||
full_name);
|
||||
free (full_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* look for plugin version */
|
||||
version = dlsym (handle, "plugin_version");
|
||||
version = dlsym (handle, "weechat_plugin_version");
|
||||
if (!version)
|
||||
{
|
||||
dlclose (handle);
|
||||
@@ -159,14 +174,29 @@ plugin_load (char *filename)
|
||||
_("%sError: symbol \"%s\" not found in "
|
||||
"plugin \"%s\", failed to load"),
|
||||
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
|
||||
"plugin_version",
|
||||
"weechat_plugin_version",
|
||||
full_name);
|
||||
free (full_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* look for plugin license */
|
||||
license = dlsym (handle, "weechat_plugin_license");
|
||||
if (!license)
|
||||
{
|
||||
dlclose (handle);
|
||||
gui_chat_printf (NULL,
|
||||
_("%sError: symbol \"%s\" not found in "
|
||||
"plugin \"%s\", failed to load"),
|
||||
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
|
||||
"weechat_plugin_license",
|
||||
full_name);
|
||||
free (full_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* look for plugin charset (optional) */
|
||||
charset = dlsym (handle, "plugin_charset");
|
||||
/* look for plugin charset (optional, default is UTF-8) */
|
||||
charset = dlsym (handle, "weechat_plugin_charset");
|
||||
|
||||
/* look for plugin init function */
|
||||
init_func = dlsym (handle, "weechat_plugin_init");
|
||||
@@ -192,7 +222,9 @@ plugin_load (char *filename)
|
||||
new_plugin->handle = handle;
|
||||
new_plugin->name = strdup (name);
|
||||
new_plugin->description = strdup (description);
|
||||
new_plugin->author = strdup (author);
|
||||
new_plugin->version = strdup (version);
|
||||
new_plugin->license = strdup (license);
|
||||
new_plugin->charset = (charset) ? strdup (charset) : NULL;
|
||||
|
||||
/* functions */
|
||||
|
||||
@@ -38,9 +38,11 @@
|
||||
#include "../weechat-script.h"
|
||||
|
||||
|
||||
char plugin_name[] = "Lua";
|
||||
char plugin_version[] = "0.1";
|
||||
char plugin_description[] = "Lua scripts support";
|
||||
WEECHAT_PLUGIN_NAME("lua");
|
||||
WEECHAT_PLUGIN_DESCRIPTION("Lua plugin for WeeChat");
|
||||
WEECHAT_PLUGIN_AUTHOR("FlashCode <flashcode@flashtux.org>");
|
||||
WEECHAT_PLUGIN_VERSION("0.1");
|
||||
WEECHAT_PLUGIN_LICENSE("GPL");
|
||||
|
||||
t_weechat_plugin *lua_plugin;
|
||||
|
||||
|
||||
@@ -39,9 +39,11 @@
|
||||
#include "../../weechat-plugin.h"
|
||||
#include "../weechat-script.h"
|
||||
|
||||
char plugin_name[] = "Perl";
|
||||
char plugin_version[] = "0.1";
|
||||
char plugin_description[] = "Perl scripts support";
|
||||
WEECHAT_PLUGIN_NAME("perl");
|
||||
WEECHAT_PLUGIN_DESCRIPTION("Perl plugin for WeeChat");
|
||||
WEECHAT_PLUGIN_AUTHOR("FlashCode <flashcode@flashtux.org>");
|
||||
WEECHAT_PLUGIN_VERSION("0.1");
|
||||
WEECHAT_PLUGIN_LICENSE("GPL");
|
||||
|
||||
t_weechat_plugin *perl_plugin;
|
||||
|
||||
|
||||
@@ -36,9 +36,11 @@
|
||||
#include "../weechat-script.h"
|
||||
|
||||
|
||||
char plugin_name[] = "Python";
|
||||
char plugin_version[] = "0.1";
|
||||
char plugin_description[] = "Python scripts support";
|
||||
WEECHAT_PLUGIN_NAME("python");
|
||||
WEECHAT_PLUGIN_DESCRIPTION("Python plugin for WeeChat");
|
||||
WEECHAT_PLUGIN_AUTHOR("FlashCode <flashcode@flashtux.org>");
|
||||
WEECHAT_PLUGIN_VERSION("0.1");
|
||||
WEECHAT_PLUGIN_LICENSE("GPL");
|
||||
|
||||
t_weechat_plugin *python_plugin;
|
||||
|
||||
|
||||
@@ -38,9 +38,11 @@
|
||||
#include "../weechat-script.h"
|
||||
|
||||
|
||||
char plugin_name[] = "Ruby";
|
||||
char plugin_version[] = "0.1";
|
||||
char plugin_description[] = "Ruby scripts support";
|
||||
WEECHAT_PLUGIN_NAME("ruby");
|
||||
WEECHAT_PLUGIN_DESCRIPTION("Ruby plugin for WeeChat");
|
||||
WEECHAT_PLUGIN_AUTHOR("FlashCode <flashcode@flashtux.org>");
|
||||
WEECHAT_PLUGIN_VERSION("0.1");
|
||||
WEECHAT_PLUGIN_LICENSE("GPL");
|
||||
|
||||
t_weechat_plugin *ruby_plugin;
|
||||
|
||||
|
||||
@@ -27,6 +27,13 @@
|
||||
#include "weechat-trigger-libirc.h"
|
||||
#include "weechat-trigger-libc.h"
|
||||
|
||||
|
||||
WEECHAT_PLUGIN_NAME("trigger");
|
||||
WEECHAT_PLUGIN_DESCRIPTION("Trigger plugin for WeeChat");
|
||||
WEECHAT_PLUGIN_AUTHOR("FlashCode <flashcode@flashtux.org>");
|
||||
WEECHAT_PLUGIN_VERSION("0.1");
|
||||
WEECHAT_PLUGIN_LICENSE("GPL");
|
||||
|
||||
t_weechat_trigger *weechat_trigger_list = NULL;
|
||||
t_weechat_trigger *weechat_trigger_last = NULL;
|
||||
|
||||
|
||||
@@ -21,14 +21,6 @@
|
||||
#ifndef __WEECHAT_TRIGGER_H
|
||||
#define __WEECHAT_TRIGGER_H 1
|
||||
|
||||
#define _PLUGIN_NAME "trigger"
|
||||
#define _PLUGIN_VERSION "0.1"
|
||||
#define _PLUGIN_DESC "Trigger plugin for WeeChat"
|
||||
|
||||
char plugin_name[] = _PLUGIN_NAME;
|
||||
char plugin_version[] = _PLUGIN_VERSION;
|
||||
char plugin_description[] = _PLUGIN_DESC;
|
||||
|
||||
typedef struct t_weechat_trigger
|
||||
{
|
||||
char *pattern;
|
||||
|
||||
@@ -26,6 +26,18 @@
|
||||
struct t_gui_buffer;
|
||||
struct t_weelist;
|
||||
|
||||
/* macros for defining plugin infos */
|
||||
#define WEECHAT_PLUGIN_NAME(__name) \
|
||||
char weechat_plugin_name[] = __name;
|
||||
#define WEECHAT_PLUGIN_AUTHOR(__author) \
|
||||
char weechat_plugin_author[] = __author;
|
||||
#define WEECHAT_PLUGIN_DESCRIPTION(__desc) \
|
||||
char weechat_plugin_description[] = __desc;
|
||||
#define WEECHAT_PLUGIN_VERSION(__version) \
|
||||
char weechat_plugin_version[] = __version;
|
||||
#define WEECHAT_PLUGIN_LICENSE(__license) \
|
||||
char weechat_plugin_license[] = __license;
|
||||
|
||||
/* return codes for plugin functions */
|
||||
#define WEECHAT_RC_ERROR -1 /* function failed with an error */
|
||||
#define WEECHAT_RC_OK 0 /* function ok */
|
||||
@@ -49,9 +61,11 @@ struct t_weechat_plugin
|
||||
/* plugin variables */
|
||||
char *filename; /* name of plugin on disk */
|
||||
void *handle; /* handle of plugin (given by dlopen)*/
|
||||
char *name; /* plugin name */
|
||||
char *description; /* plugin description */
|
||||
char *version; /* plugin version */
|
||||
char *name; /* short name */
|
||||
char *description; /* description */
|
||||
char *author; /* author */
|
||||
char *version; /* version */
|
||||
char *license; /* license */
|
||||
char *charset; /* charset used by plugin */
|
||||
struct t_weechat_plugin *prev_plugin; /* link to previous plugin */
|
||||
struct t_weechat_plugin *next_plugin; /* link to next plugin */
|
||||
|
||||
Reference in New Issue
Block a user