Check plugin version when loading it, to prevent crash when loading old plugins

This commit is contained in:
Sebastien Helleu 2008-03-23 11:41:09 +01:00
parent 61ca929728
commit d9a4bdf629
40 changed files with 289 additions and 127 deletions

View File

@ -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
# ------------------------------------------------------------------------------

View File

@ -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"
@ -4245,6 +4245,14 @@ msgid ""
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 ""
@ -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"
@ -4489,6 +4497,10 @@ msgstr ""
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"

View File

@ -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"
@ -4237,6 +4237,14 @@ msgstr ""
"%s kann Plugin \"%s\" nicht laden: ein gleichnamiges Plugin existiert "
"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 ""
@ -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"
@ -4481,6 +4489,10 @@ msgstr ""
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"

View File

@ -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"
@ -4249,6 +4249,14 @@ msgstr ""
"%s no ha sido posible cargar el plugin \"%s\": un plugin con el mismo nombre "
"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 ""
@ -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"
@ -4493,6 +4501,10 @@ msgstr ""
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"

View File

@ -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"
@ -4188,6 +4192,14 @@ msgstr ""
"%sErreur: impossible de charger l'extension \"%s\": une extension avec le "
"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 ""
@ -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]"

View File

@ -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"
@ -4252,6 +4252,14 @@ msgid ""
"%sError: unable to load plugin \"%s\": a plugin with same name already exists"
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 ""
@ -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"
@ -4496,6 +4504,10 @@ msgstr ""
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"

View File

@ -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"
@ -4234,6 +4234,14 @@ msgid ""
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 ""
@ -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"
@ -4478,6 +4486,10 @@ msgstr ""
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"

View File

@ -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"
@ -3684,6 +3684,12 @@ msgid ""
"%sError: unable to load plugin \"%s\": a plugin with same name already exists"
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

View File

@ -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)

View File

@ -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;
}

View File

@ -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 */

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -20,10 +20,6 @@
2811 2812 */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifndef __USE_XOPEN
#define __USE_XOPEN
#endif

View File

@ -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>

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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 */