diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2008-03-23 11:41:09 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2008-03-23 11:41:09 +0100 |
commit | d9a4bdf6295196fbe1e02bf27a44a0acf21c6252 (patch) | |
tree | 72a96ea611c0401b3c9823ebf28d2aa74114ed87 /src | |
parent | 61ca92972886cd7a9bc301ae7e23d6dde74920bc (diff) | |
download | weechat-d9a4bdf6295196fbe1e02bf27a44a0acf21c6252.zip |
Check plugin version when loading it, to prevent crash when loading old plugins
Diffstat (limited to 'src')
32 files changed, 180 insertions, 102 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 466942a47..bf6584a10 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -100,6 +100,8 @@ IF(DL_LIBRARY) LIST(APPEND EXTRA_LIBS dl) ENDIF(DL_LIBRARY) +ADD_DEFINITIONS(-DWEECHAT_VERSION='"${VERSION}"') + ADD_SUBDIRECTORY( core ) LIST(APPEND STATIC_LIBS weechat_core) diff --git a/src/core/wee-util.c b/src/core/wee-util.c index e61a07eeb..cd81a94e2 100644 --- a/src/core/wee-util.c +++ b/src/core/wee-util.c @@ -30,6 +30,7 @@ #include <sys/stat.h> #include <dirent.h> #include <signal.h> +#include <ctype.h> #include "weechat.h" #include "wee-util.h" @@ -268,3 +269,99 @@ util_search_full_lib_name (char *filename, char *sys_directory) return name_with_ext; } + +/* + * util_weechat_version_cmp: compare 2 weechat versions + * return -1 if version1 < version2 + * +1 if version1 > version2 + * 0 if version1 = version2 + */ + +int +util_weechat_version_cmp (char *version1, char *version2) +{ + char *v1, *v2, *ptr_v1, *ptr_v2, *pos1, *pos2, *next1, *next2; + char *error1, *error2; + int rc; + long number1, number2; + + if (!version1 && !version2) + return 0; + if (!version1 && version2) + return -1; + if (version1 && !version2) + return 1; + + v1 = strdup (version1); + v2 = strdup (version2); + + rc = 0; + + if (v1 && v2) + { + ptr_v1 = v1; + ptr_v2 = v2; + while (ptr_v1 && ptr_v1[0] && ptr_v2 && ptr_v2[0]) + { + pos1 = ptr_v1; + while (pos1[0] && isdigit (pos1[0])) + { + pos1++; + } + pos2 = ptr_v2; + while (pos2[0] && isdigit (pos2[0])) + { + pos2++; + } + next1 = (pos1[0] == '\0') ? NULL : pos1 + 1; + next2 = (pos2[0] == '\0') ? NULL : pos2 + 1; + pos1[0] = '\0'; + pos2[0] = '\0'; + + error1 = NULL; + number1 = strtol (ptr_v1, &error1, 10); + error2 = NULL; + number2 = strtol (ptr_v2, &error2, 10); + if (error1 && !error1[0] && (!error2 || error2[0])) + { + rc = 1; + break; + } + if (error2 && !error2[0] && (!error1 || error1[0])) + { + rc = 1; + break; + } + if (error1 && !error1[0] && error2 && !error2[0]) + { + if (number1 > number2) + { + rc = 1; + break; + } + if (number1 < number2) + { + rc = -1; + break; + } + } + ptr_v1 = next1; + while (ptr_v1[0] && !isdigit (ptr_v1[0])) + { + ptr_v1++; + } + ptr_v2 = next2; + while (ptr_v2[0] && !isdigit (ptr_v2[0])) + { + ptr_v2++; + } + } + } + + if (v1) + free (v1); + if (v2) + free (v2); + + return rc; +} diff --git a/src/core/wee-util.h b/src/core/wee-util.h index d897ab9dc..1e6ceed4b 100644 --- a/src/core/wee-util.h +++ b/src/core/wee-util.h @@ -29,5 +29,6 @@ extern int util_create_dir (char *directory, int permissions); extern void util_exec_on_files (char *directory, void *data, int (*callback)(void *data, char *filename)); extern char *util_search_full_lib_name (char *filename, char *sys_directory); +extern int util_weechat_version_cmp (char *version1, char *version2); #endif /* wee-util.h */ diff --git a/src/plugins/alias/alias.c b/src/plugins/alias/alias.c index 24338acc6..461680f2b 100644 --- a/src/plugins/alias/alias.c +++ b/src/plugins/alias/alias.c @@ -19,10 +19,6 @@ /* alias.c: Alias plugin for WeeChat */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include <stdlib.h> #include <string.h> @@ -33,7 +29,8 @@ 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_VERSION(WEECHAT_VERSION); +WEECHAT_PLUGIN_WEECHAT_VERSION(WEECHAT_VERSION); WEECHAT_PLUGIN_LICENSE("GPL"); struct t_weechat_plugin *weechat_alias_plugin = NULL; diff --git a/src/plugins/aspell/aspell.c b/src/plugins/aspell/aspell.c index 2fa7ba0e6..4d0c22b79 100644 --- a/src/plugins/aspell/aspell.c +++ b/src/plugins/aspell/aspell.c @@ -18,6 +18,7 @@ /* aspell.c: Aspell plugin support for WeeChat */ + #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -31,7 +32,8 @@ WEECHAT_PLUGIN_NAME("aspell"); WEECHAT_PLUGIN_DESCRIPTION("Aspell plugin for WeeChat"); WEECHAT_PLUGIN_AUTHOR("FlashCode <flashcode@flashtux.org>"); -WEECHAT_PLUGIN_VERSION("0.1"); +WEECHAT_PLUGIN_VERSION(WEECHAT_VERSION); +WEECHAT_PLUGIN_WEECHAT_VERSION(WEECHAT_VERSION); WEECHAT_LICENSE("GPL"); struct t_weechat_plugin *weechat_aspell_plugin = NULL; diff --git a/src/plugins/charset/charset.c b/src/plugins/charset/charset.c index 2f2b1b381..78b1e8b08 100644 --- a/src/plugins/charset/charset.c +++ b/src/plugins/charset/charset.c @@ -21,7 +21,9 @@ #include <stdio.h> #include <stdlib.h> +#ifndef __USE_GNU #define __USE_GNU +#endif #include <string.h> #include <iconv.h> @@ -32,7 +34,8 @@ 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_VERSION(WEECHAT_VERSION); +WEECHAT_PLUGIN_WEECHAT_VERSION(WEECHAT_VERSION); WEECHAT_PLUGIN_LICENSE("GPL"); struct t_weechat_plugin *weechat_charset_plugin = NULL; diff --git a/src/plugins/debug/debug.c b/src/plugins/debug/debug.c index 608a6ae79..6a3a5c30e 100644 --- a/src/plugins/debug/debug.c +++ b/src/plugins/debug/debug.c @@ -19,10 +19,6 @@ /* debug.c: Debug plugin for WeeChat */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include <stdlib.h> #include <string.h> @@ -32,7 +28,8 @@ WEECHAT_PLUGIN_NAME("debug"); WEECHAT_PLUGIN_DESCRIPTION("Debug plugin for WeeChat"); WEECHAT_PLUGIN_AUTHOR("FlashCode <flashcode@flashtux.org>"); -WEECHAT_PLUGIN_VERSION("0.1"); +WEECHAT_PLUGIN_VERSION(WEECHAT_VERSION); +WEECHAT_PLUGIN_WEECHAT_VERSION(WEECHAT_VERSION); WEECHAT_PLUGIN_LICENSE("GPL"); struct t_weechat_plugin *weechat_debug_plugin = NULL; diff --git a/src/plugins/demo/demo.c b/src/plugins/demo/demo.c index 02529c49e..36c600868 100644 --- a/src/plugins/demo/demo.c +++ b/src/plugins/demo/demo.c @@ -19,10 +19,6 @@ /* demo.c: demo plugin for WeeChat */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include <stdlib.h> #include <unistd.h> #include <stdio.h> @@ -38,7 +34,8 @@ 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_VERSION(WEECHAT_VERSION); +WEECHAT_PLUGIN_WEECHAT_VERSION(WEECHAT_VERSION); WEECHAT_PLUGIN_LICENSE("GPL"); struct t_weechat_plugin *weechat_demo_plugin = NULL; diff --git a/src/plugins/fifo/fifo.c b/src/plugins/fifo/fifo.c index 5af2dfe6c..6bd2e40f0 100644 --- a/src/plugins/fifo/fifo.c +++ b/src/plugins/fifo/fifo.c @@ -19,10 +19,6 @@ /* fifo.c: FIFO pipe plugin for WeeChat remote control */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include <stdlib.h> #include <unistd.h> #include <stdio.h> @@ -37,7 +33,8 @@ 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_VERSION(WEECHAT_VERSION); +WEECHAT_PLUGIN_WEECHAT_VERSION(WEECHAT_VERSION); WEECHAT_PLUGIN_LICENSE("GPL"); struct t_weechat_plugin *weechat_fifo_plugin = NULL; diff --git a/src/plugins/irc/irc-buffer.c b/src/plugins/irc/irc-buffer.c index a2e7e7f68..a31850b9c 100644 --- a/src/plugins/irc/irc-buffer.c +++ b/src/plugins/irc/irc-buffer.c @@ -19,10 +19,6 @@ /* irc-buffer.c: manages buffers for IRC protocol */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include <stdlib.h> #include <string.h> diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c index 0da623d24..72f28b47d 100644 --- a/src/plugins/irc/irc-channel.c +++ b/src/plugins/irc/irc-channel.c @@ -19,10 +19,6 @@ /* irc-channel.c: manages a chat (channel or private chat) */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include <stdlib.h> #include <unistd.h> #include <string.h> diff --git a/src/plugins/irc/irc-color.c b/src/plugins/irc/irc-color.c index a3c1054e4..e64fff19f 100644 --- a/src/plugins/irc/irc-color.c +++ b/src/plugins/irc/irc-color.c @@ -19,10 +19,6 @@ /* irc-color.c: IRC color decoding/encidong in messages */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include <stdlib.h> #include <string.h> #include <ctype.h> diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c index 03a778590..d246d4dfe 100644 --- a/src/plugins/irc/irc-command.c +++ b/src/plugins/irc/irc-command.c @@ -19,10 +19,6 @@ /* irc-command.c: IRC commands managment */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include <stdlib.h> #include <stdio.h> #include <string.h> diff --git a/src/plugins/irc/irc-completion.c b/src/plugins/irc/irc-completion.c index d20f6375b..5d5d6929e 100644 --- a/src/plugins/irc/irc-completion.c +++ b/src/plugins/irc/irc-completion.c @@ -19,10 +19,6 @@ /* irc-command.c: IRC commands managment */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include <stdlib.h> #include <stdio.h> #include <string.h> diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index dcf4e302a..18f857e34 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -19,10 +19,6 @@ /* irc-config.c: IRC configuration options */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include <stdlib.h> #include <unistd.h> #include <string.h> diff --git a/src/plugins/irc/irc-dcc.c b/src/plugins/irc/irc-dcc.c index dd3a06077..3539326b0 100644 --- a/src/plugins/irc/irc-dcc.c +++ b/src/plugins/irc/irc-dcc.c @@ -19,10 +19,6 @@ /* irc-dcc.c: Direct Client-to-Client (DCC) communication (files & chat) */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include <stdlib.h> #include <unistd.h> #include <signal.h> diff --git a/src/plugins/irc/irc-debug.c b/src/plugins/irc/irc-debug.c index 8384f87ae..d947a6070 100644 --- a/src/plugins/irc/irc-debug.c +++ b/src/plugins/irc/irc-debug.c @@ -19,10 +19,6 @@ /* irc-debug.c: debug functions for IRC plugin */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include <stdlib.h> #include <string.h> diff --git a/src/plugins/irc/irc-display.c b/src/plugins/irc/irc-display.c index 839f9022a..03c2cbfca 100644 --- a/src/plugins/irc/irc-display.c +++ b/src/plugins/irc/irc-display.c @@ -19,10 +19,6 @@ /* irc-display.c: display functions for IRC */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include <stdlib.h> #include <unistd.h> #include <stdio.h> diff --git a/src/plugins/irc/irc-input.c b/src/plugins/irc/irc-input.c index 70eaf794c..537de4c69 100644 --- a/src/plugins/irc/irc-input.c +++ b/src/plugins/irc/irc-input.c @@ -19,10 +19,6 @@ /* irc-input.c: IRC input data (read from user) */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include <stdlib.h> #include <string.h> diff --git a/src/plugins/irc/irc-mode.c b/src/plugins/irc/irc-mode.c index 6d6278df9..6eb280d09 100644 --- a/src/plugins/irc/irc-mode.c +++ b/src/plugins/irc/irc-mode.c @@ -19,10 +19,6 @@ /* irc-mode.c: IRC channel/user modes management */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include <stdlib.h> #include <string.h> diff --git a/src/plugins/irc/irc-nick.c b/src/plugins/irc/irc-nick.c index 06c6913e6..5a5015f53 100644 --- a/src/plugins/irc/irc-nick.c +++ b/src/plugins/irc/irc-nick.c @@ -19,10 +19,6 @@ /* irc-nick.c: manages nick list for channels */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include <stdlib.h> #include <stdio.h> #include <string.h> diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 6dbda311e..04eb67f30 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -20,10 +20,6 @@ 2811 2812 */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #ifndef __USE_XOPEN #define __USE_XOPEN #endif diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index 224ab557d..c86139024 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -19,10 +19,6 @@ /* irc-server.c: connection and communication with IRC server */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include <stdlib.h> #include <unistd.h> #include <errno.h> diff --git a/src/plugins/irc/irc.c b/src/plugins/irc/irc.c index 5e0ec8379..d2df7d2ab 100644 --- a/src/plugins/irc/irc.c +++ b/src/plugins/irc/irc.c @@ -19,10 +19,6 @@ /* irc.c: IRC plugin for WeeChat */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include <stdlib.h> #include <string.h> @@ -45,7 +41,8 @@ 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_VERSION(WEECHAT_VERSION); +WEECHAT_PLUGIN_WEECHAT_VERSION(WEECHAT_VERSION); WEECHAT_PLUGIN_LICENSE("GPL"); struct t_weechat_plugin *weechat_irc_plugin = NULL; diff --git a/src/plugins/logger/logger.c b/src/plugins/logger/logger.c index 4d12cddce..7951df9aa 100644 --- a/src/plugins/logger/logger.c +++ b/src/plugins/logger/logger.c @@ -19,8 +19,8 @@ /* logger.c: Logger plugin for WeeChat */ -#ifdef HAVE_CONFIG_H -#include "config.h" +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 #endif #include <stdlib.h> @@ -42,7 +42,8 @@ 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_VERSION(WEECHAT_VERSION); +WEECHAT_PLUGIN_WEECHAT_VERSION(WEECHAT_VERSION); WEECHAT_PLUGIN_LICENSE("GPL"); struct t_weechat_plugin *weechat_logger_plugin = NULL; diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index 59cea632c..11864fb40 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -86,7 +86,8 @@ plugin_load (char *filename) { char *full_name; void *handle; - char *name, *author, *description, *version, *license, *charset; + char *name, *author, *description, *version, *weechat_version, *license; + char *charset; t_weechat_init_func *init_func; int rc; struct t_weechat_plugin *new_plugin; @@ -114,13 +115,13 @@ plugin_load (char *filename) name = dlsym (handle, "weechat_plugin_name"); if (!name) { - 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_name", full_name); + dlclose (handle); free (full_name); return NULL; } @@ -128,12 +129,12 @@ plugin_load (char *filename) /* check for plugin with same name */ if (plugin_search (name)) { - dlclose (handle); gui_chat_printf (NULL, _("%sError: unable to load plugin \"%s\": a plugin " "with same name already exists"), gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], full_name); + dlclose (handle); free (full_name); return NULL; } @@ -142,13 +143,13 @@ plugin_load (char *filename) description = dlsym (handle, "weechat_plugin_description"); if (!description) { - 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_description", full_name); + dlclose (handle); free (full_name); return NULL; } @@ -157,13 +158,13 @@ plugin_load (char *filename) 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); + dlclose (handle); free (full_name); return NULL; } @@ -172,28 +173,57 @@ plugin_load (char *filename) version = dlsym (handle, "weechat_plugin_version"); if (!version) { - 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_version", full_name); + dlclose (handle); + free (full_name); + return NULL; + } + + /* look for WeeChat version required for plugin */ + weechat_version = dlsym (handle, "weechat_plugin_weechat_version"); + if (!weechat_version) + { + gui_chat_printf (NULL, + _("%sError: symbol \"%s\" not found in " + "plugin \"%s\", failed to load"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + "weechat_plugin_weechat_version", + full_name); + dlclose (handle); free (full_name); return NULL; } + if (util_weechat_version_cmp (PACKAGE_VERSION, weechat_version) != 0) + { + gui_chat_printf (NULL, + _("%sError: plugin \"%s\" is compiled for WeeChat " + "%s and you are running version %s, failed to " + "load"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + full_name, + weechat_version, PACKAGE_VERSION); + dlclose (handle); + 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); + dlclose (handle); free (full_name); return NULL; } @@ -205,13 +235,13 @@ plugin_load (char *filename) init_func = dlsym (handle, "weechat_plugin_init"); if (!init_func) { - dlclose (handle); gui_chat_printf (NULL, _("%sError: function \"%s\" not " "found in plugin \"%s\", failed to load"), gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], "weechat_plugin_init", full_name); + dlclose (handle); free (full_name); return NULL; } @@ -227,6 +257,7 @@ plugin_load (char *filename) new_plugin->description = strdup (description); new_plugin->author = strdup (author); new_plugin->version = strdup (version); + new_plugin->weechat_version = strdup (weechat_version); new_plugin->license = strdup (license); new_plugin->charset = (charset) ? strdup (charset) : NULL; @@ -397,14 +428,15 @@ plugin_load (char *filename) "(not enough memory)"), gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], full_name); + dlclose (handle); free (full_name); return NULL; } gui_chat_printf (NULL, - _("%sPlugin \"%s\" %s loaded"), + _("%sPlugin \"%s\" loaded"), gui_chat_prefix[GUI_CHAT_PREFIX_INFO], - name, new_plugin->version); + name); free (full_name); @@ -570,6 +602,8 @@ plugin_remove (struct t_weechat_plugin *plugin) free (plugin->author); if (plugin->version) free (plugin->version); + if (plugin->weechat_version) + free (plugin->weechat_version); if (plugin->license) free (plugin->license); if (plugin->charset) diff --git a/src/plugins/scripts/lua/weechat-lua.c b/src/plugins/scripts/lua/weechat-lua.c index 7bd6ed20e..9a00906e4 100644 --- a/src/plugins/scripts/lua/weechat-lua.c +++ b/src/plugins/scripts/lua/weechat-lua.c @@ -35,7 +35,8 @@ 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_VERSION(WEECHAT_VERSION); +WEECHAT_PLUGIN_WEECHAT_VERSION(WEECHAT_VERSION); WEECHAT_PLUGIN_LICENSE("GPL"); struct t_weechat_plugin *weechat_lua_plugin; diff --git a/src/plugins/scripts/perl/weechat-perl.c b/src/plugins/scripts/perl/weechat-perl.c index 149e9a77d..1b2876c03 100644 --- a/src/plugins/scripts/perl/weechat-perl.c +++ b/src/plugins/scripts/perl/weechat-perl.c @@ -33,7 +33,8 @@ 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_VERSION(WEECHAT_VERSION); +WEECHAT_PLUGIN_WEECHAT_VERSION(WEECHAT_VERSION); WEECHAT_PLUGIN_LICENSE("GPL"); struct t_weechat_plugin *weechat_perl_plugin = NULL; diff --git a/src/plugins/scripts/python/weechat-python.c b/src/plugins/scripts/python/weechat-python.c index 2deb39302..0b7dd6c4f 100644 --- a/src/plugins/scripts/python/weechat-python.c +++ b/src/plugins/scripts/python/weechat-python.c @@ -31,7 +31,8 @@ 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_VERSION(WEECHAT_VERSION); +WEECHAT_PLUGIN_WEECHAT_VERSION(WEECHAT_VERSION); WEECHAT_PLUGIN_LICENSE("GPL"); struct t_weechat_plugin *weechat_python_plugin = NULL; diff --git a/src/plugins/scripts/ruby/weechat-ruby.c b/src/plugins/scripts/ruby/weechat-ruby.c index d351ebadc..1736ecda6 100644 --- a/src/plugins/scripts/ruby/weechat-ruby.c +++ b/src/plugins/scripts/ruby/weechat-ruby.c @@ -34,7 +34,8 @@ 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_VERSION(WEECHAT_VERSION); +WEECHAT_PLUGIN_WEECHAT_VERSION(WEECHAT_VERSION); WEECHAT_PLUGIN_LICENSE("GPL"); struct t_weechat_plugin *weechat_ruby_plugin = NULL; diff --git a/src/plugins/trigger/trigger.c b/src/plugins/trigger/trigger.c index caa8237e8..ae03d910d 100644 --- a/src/plugins/trigger/trigger.c +++ b/src/plugins/trigger/trigger.c @@ -18,6 +18,7 @@ /* weechat-trigger.c: Trigger plugin for WeeChat */ + #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -31,7 +32,8 @@ 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_VERSION(WEECHAT_VERSION); +WEECHAT_PLUGIN_WEECHAT_VERSION(WEECHAT_VERSION); WEECHAT_PLUGIN_LICENSE("GPL"); t_weechat_trigger *weechat_trigger_list = NULL; diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index b79d57f4c..df041462d 100644 --- a/src/plugins/weechat-plugin.h +++ b/src/plugins/weechat-plugin.h @@ -38,6 +38,8 @@ struct t_weelist; char weechat_plugin_description[] = __desc; #define WEECHAT_PLUGIN_VERSION(__version) \ char weechat_plugin_version[] = __version; +#define WEECHAT_PLUGIN_WEECHAT_VERSION(__version) \ + char weechat_plugin_weechat_version[] = __version; #define WEECHAT_PLUGIN_LICENSE(__license) \ char weechat_plugin_license[] = __license; @@ -69,7 +71,8 @@ struct t_weechat_plugin char *name; /* short name */ char *description; /* description */ char *author; /* author */ - char *version; /* version */ + char *version; /* plugin version */ + char *weechat_version; /* weechat version required */ char *license; /* license */ char *charset; /* charset used by plugin */ struct t_weechat_plugin *prev_plugin; /* link to previous plugin */ |