diff options
40 files changed, 289 insertions, 127 deletions
diff --git a/configure.in b/configure.in index 4407afc69..d8ba78be7 100644 --- a/configure.in +++ b/configure.in @@ -692,6 +692,7 @@ if test "x$enable_gnutls" = "xyes" ; then AC_SUBST(GNUTLS_CFLAGS) AC_SUBST(GNUTLS_LFLAGS) AC_DEFINE(HAVE_GNUTLS) + CFLAGS="$CFLAGS -DHAVE_GNUTLS" else enable_gnutls="no" not_found="$not_found gnutls" @@ -847,6 +848,8 @@ gnu*) ;; esac +CFLAGS="$CFLAGS -DWEECHAT_VERSION=\\\"$VERSION\\\"" + # ------------------------------------------------------------------------------ # output Makefiles # ------------------------------------------------------------------------------ @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-03-22 23:32+0100\n" +"POT-Creation-Date: 2008-03-23 11:39+0100\n" "PO-Revision-Date: 2007-09-06 12:44+0200\n" "Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -4246,6 +4246,14 @@ msgstr "" "%s nemohu načíst plugin \"%s\": plugin se stejným jménem již existuje\n" #, fuzzy, c-format +msgid "" +"%sError: plugin \"%s\" is compiled for WeeChat %s and you are running " +"version %s, failed to load" +msgstr "" +"%s funkce \"weechat_plugin_init\" nebyla v pluginu \"%s\" nalezena, načtení " +"selhalo\n" + +#, fuzzy, c-format msgid "%sError: function \"%s\" not found in plugin \"%s\", failed to load" msgstr "" "%s funkce \"weechat_plugin_init\" nebyla v pluginu \"%s\" nalezena, načtení " @@ -4260,8 +4268,8 @@ msgid "%sError: unable to load plugin \"%s\" (not enough memory)" msgstr "%s nemohu načíst plugin \"%s\" (nedostatek paměti)\n" #, fuzzy, c-format -msgid "%sPlugin \"%s\" %s loaded" -msgstr "Plugin \"%s\" (%s) načten.\n" +msgid "%sPlugin \"%s\" loaded" +msgstr "Plugin \"%s\" odebrán.\n" #, fuzzy, c-format msgid "%sPlugin \"%s\" unloaded" @@ -4490,6 +4498,10 @@ msgid "%s%s: wrong arguments for function \"%s\"" msgstr "%s špatné parametry pro příkaz \"%s\"\n" #, fuzzy +#~ msgid "%sPlugin \"%s\" %s loaded" +#~ msgstr "Plugin \"%s\" (%s) načten.\n" + +#, fuzzy #~ msgid "%sError: wrong number \"%s\" for filter" #~ msgstr "%s špatný počet parametrů pro příkaz \"%s\"\n" @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-03-22 23:32+0100\n" +"POT-Creation-Date: 2008-03-23 11:39+0100\n" "PO-Revision-Date: 2007-09-06 12:44+0200\n" "Last-Translator: Thomas Schuetz <i18n@internet-villa.de>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -4238,6 +4238,14 @@ msgstr "" "bereits\n" #, fuzzy, c-format +msgid "" +"%sError: plugin \"%s\" is compiled for WeeChat %s and you are running " +"version %s, failed to load" +msgstr "" +"%s Funktion \"weechat_plugin_init\" nicht in Plugin \"%s\" gefunden Laden " +"gescheitert\n" + +#, fuzzy, c-format msgid "%sError: function \"%s\" not found in plugin \"%s\", failed to load" msgstr "" "%s Funktion \"weechat_plugin_init\" nicht in Plugin \"%s\" gefunden Laden " @@ -4252,8 +4260,8 @@ msgid "%sError: unable to load plugin \"%s\" (not enough memory)" msgstr "%s kann das Plugin \"%s\" nicht laden (Speichermangel)\n" #, fuzzy, c-format -msgid "%sPlugin \"%s\" %s loaded" -msgstr "Plugin \"%s\" (%s) geladen.\n" +msgid "%sPlugin \"%s\" loaded" +msgstr "Plugin \"%s\" entladen.\n" #, fuzzy, c-format msgid "%sPlugin \"%s\" unloaded" @@ -4482,6 +4490,10 @@ msgid "%s%s: wrong arguments for function \"%s\"" msgstr "%s fehlerhafte Argumente für der \"%s\"-Befehl\n" #, fuzzy +#~ msgid "%sPlugin \"%s\" %s loaded" +#~ msgstr "Plugin \"%s\" (%s) geladen.\n" + +#, fuzzy #~ msgid "%sError: wrong number \"%s\" for filter" #~ msgstr "%s fehlerhafte Anzahl von Argumenten für der \"%s\"-Befehl\n" @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-03-22 23:32+0100\n" +"POT-Creation-Date: 2008-03-23 11:39+0100\n" "PO-Revision-Date: 2007-09-19 12:09+0200\n" "Last-Translator: Roberto González Cardenete <robert.glez@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -4250,6 +4250,14 @@ msgstr "" "ya existe\n" #, fuzzy, c-format +msgid "" +"%sError: plugin \"%s\" is compiled for WeeChat %s and you are running " +"version %s, failed to load" +msgstr "" +"%s función \"weechat_plugin_init\" no encontrada en el plugin \"%s\", " +"falló al cargar\n" + +#, fuzzy, c-format msgid "%sError: function \"%s\" not found in plugin \"%s\", failed to load" msgstr "" "%s función \"weechat_plugin_init\" no encontrada en el plugin \"%s\", " @@ -4265,8 +4273,8 @@ msgstr "" "%s no ha sido posible cargar el plugin \"%s\" (no hay suficiente memoria)\n" #, fuzzy, c-format -msgid "%sPlugin \"%s\" %s loaded" -msgstr "Plugin \"%s\" (%s) cargado.\n" +msgid "%sPlugin \"%s\" loaded" +msgstr "Plugin \"%s\" descargado.\n" #, fuzzy, c-format msgid "%sPlugin \"%s\" unloaded" @@ -4494,6 +4502,10 @@ msgid "%s%s: wrong arguments for function \"%s\"" msgstr "%s argumentos incorrectos para el comando \"%s\"\n" #, fuzzy +#~ msgid "%sPlugin \"%s\" %s loaded" +#~ msgstr "Plugin \"%s\" (%s) cargado.\n" + +#, fuzzy #~ msgid "%sError: wrong number \"%s\" for filter" #~ msgstr "%s número de argumentos incorrecto para el comando \"%s\"\n" @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-03-22 23:32+0100\n" -"PO-Revision-Date: 2008-03-22 23:33+0100\n" +"POT-Creation-Date: 2008-03-23 11:39+0100\n" +"PO-Revision-Date: 2008-03-23 11:39+0100\n" "Last-Translator: FlashCode <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "MIME-Version: 1.0\n" @@ -643,10 +643,14 @@ msgstr "" " toggle: active/désactive les filtres\n" " add: ajoute un filtre\n" " del: supprime un filtre\n" -" numéro: numéro du filtre à supprimer (voir la liste des filtres pour le trouver)\n" -" buffer: tampon où le filtre est actif: cela peut être un nom (catégorie.nom) ou \"*\" pour tous les tampons\n" -" tags: liste de tags, séparés par des virgules, par exemple: \"irc_join,irc_part,irc_quit\"\n" -" regex: expressoin régulière à rechercher dans la ligne (utiliser \\t pour séparer le préfixe du message)" +" numéro: numéro du filtre à supprimer (voir la liste des filtres pour le " +"trouver)\n" +" buffer: tampon où le filtre est actif: cela peut être un nom (catégorie." +"nom) ou \"*\" pour tous les tampons\n" +" tags: liste de tags, séparés par des virgules, par exemple: \"irc_join," +"irc_part,irc_quit\"\n" +" regex: expressoin régulière à rechercher dans la ligne (utiliser \\t pour " +"séparer le préfixe du message)" msgid "display help about commands" msgstr "afficher l'aide sur les commandes" @@ -4189,6 +4193,14 @@ msgstr "" "même nom existe déjà" #, c-format +msgid "" +"%sError: plugin \"%s\" is compiled for WeeChat %s and you are running " +"version %s, failed to load" +msgstr "" +"%sErreur: l'extension \"%s\" est compilée pour WeeChat %s et vous utilisez " +"la version %s, échec de chargement" + +#, c-format msgid "%sError: function \"%s\" not found in plugin \"%s\", failed to load" msgstr "" "%sErreur: la fonction \"%s\" n'existe pas dans l'extension \"%s\", échec de " @@ -4204,8 +4216,8 @@ msgstr "" "%sErreur: impossible de charger l'extension \"%s\" (mémoire insuffisante)" #, c-format -msgid "%sPlugin \"%s\" %s loaded" -msgstr "%sExtension \"%s\" %s chargée" +msgid "%sPlugin \"%s\" loaded" +msgstr "%sExtension \"%s\" chargée" #, c-format msgid "%sPlugin \"%s\" unloaded" @@ -4442,6 +4454,9 @@ msgstr "" msgid "%s%s: wrong arguments for function \"%s\"" msgstr "%s%s: paramètres invalides pour la fonction \"%s\"" +#~ msgid "%sPlugin \"%s\" %s loaded" +#~ msgstr "%sExtension \"%s\" %s chargée" + #~ msgid "%s[%sfiltered%s]" #~ msgstr "%s[%sfiltré%s]" @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-03-22 23:32+0100\n" +"POT-Creation-Date: 2008-03-23 11:39+0100\n" "PO-Revision-Date: 2007-10-10 18:07+0200\n" "Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -4253,6 +4253,14 @@ msgid "" msgstr "%s nem sikerült a \"%s\" modult betölteni: már van ilyen nevű modul\n" #, fuzzy, c-format +msgid "" +"%sError: plugin \"%s\" is compiled for WeeChat %s and you are running " +"version %s, failed to load" +msgstr "" +"%s a \"weechat_plugin_init\" függvény nem található a \"%s\" modulban, " +"betöltés sikertelen\n" + +#, fuzzy, c-format msgid "%sError: function \"%s\" not found in plugin \"%s\", failed to load" msgstr "" "%s a \"weechat_plugin_init\" függvény nem található a \"%s\" modulban, " @@ -4267,8 +4275,8 @@ msgid "%sError: unable to load plugin \"%s\" (not enough memory)" msgstr "%s nem sikerült a modult betölteni \"%s\" (nincs elég memória)\n" #, fuzzy, c-format -msgid "%sPlugin \"%s\" %s loaded" -msgstr "A \"%s\" (%s) modul betöltve.\n" +msgid "%sPlugin \"%s\" loaded" +msgstr "A \"%s\" modul eltávolítva.\n" #, fuzzy, c-format msgid "%sPlugin \"%s\" unloaded" @@ -4497,6 +4505,10 @@ msgid "%s%s: wrong arguments for function \"%s\"" msgstr "%s rossz argumentum a \"%s\" parancsnak\n" #, fuzzy +#~ msgid "%sPlugin \"%s\" %s loaded" +#~ msgstr "A \"%s\" (%s) modul betöltve.\n" + +#, fuzzy #~ msgid "%sError: wrong number \"%s\" for filter" #~ msgstr "%s rossz argumentum szám a \"%s\" parancsnak\n" @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-03-22 23:32+0100\n" +"POT-Creation-Date: 2008-03-23 11:39+0100\n" "PO-Revision-Date: 2007-09-06 12:44+0200\n" "Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -4235,6 +4235,14 @@ msgstr "" "%s не могу загрузить plugin \"%s\": одноимённый plugin уже существует\n" #, fuzzy, c-format +msgid "" +"%sError: plugin \"%s\" is compiled for WeeChat %s and you are running " +"version %s, failed to load" +msgstr "" +"%s функция \"weechat_plugin_init\" не найдена в plugin'е \"%s\", загрузка не " +"удалась\n" + +#, fuzzy, c-format msgid "%sError: function \"%s\" not found in plugin \"%s\", failed to load" msgstr "" "%s функция \"weechat_plugin_init\" не найдена в plugin'е \"%s\", загрузка не " @@ -4249,8 +4257,8 @@ msgid "%sError: unable to load plugin \"%s\" (not enough memory)" msgstr "%s не могу загрузить plugin \"%s\" (недостаточно памяти)\n" #, fuzzy, c-format -msgid "%sPlugin \"%s\" %s loaded" -msgstr "Plugin \"%s\" (%s) загружен.\n" +msgid "%sPlugin \"%s\" loaded" +msgstr "Plugin \"%s\" выгружен.\n" #, fuzzy, c-format msgid "%sPlugin \"%s\" unloaded" @@ -4479,6 +4487,10 @@ msgid "%s%s: wrong arguments for function \"%s\"" msgstr "%s некорректные аргументы команды \"%s\"\n" #, fuzzy +#~ msgid "%sPlugin \"%s\" %s loaded" +#~ msgstr "Plugin \"%s\" (%s) загружен.\n" + +#, fuzzy #~ msgid "%sError: wrong number \"%s\" for filter" #~ msgstr "%s некорректное количество аргументов команды \"%s\"\n" diff --git a/po/weechat.pot b/po/weechat.pot index bf2820ee5..7de8343f7 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-03-22 23:32+0100\n" +"POT-Creation-Date: 2008-03-23 11:39+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -3685,6 +3685,12 @@ msgid "" msgstr "" #, c-format +msgid "" +"%sError: plugin \"%s\" is compiled for WeeChat %s and you are running " +"version %s, failed to load" +msgstr "" + +#, c-format msgid "%sError: function \"%s\" not found in plugin \"%s\", failed to load" msgstr "" @@ -3697,7 +3703,7 @@ msgid "%sError: unable to load plugin \"%s\" (not enough memory)" msgstr "" #, c-format -msgid "%sPlugin \"%s\" %s loaded" +msgid "%sPlugin \"%s\" loaded" msgstr "" #, c-format 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 */ |