Add new hooks (info and infolist), IRC plugin now return infos and infolists

This commit is contained in:
Sebastien Helleu 2008-08-30 00:25:56 +02:00
parent eb57354984
commit 0839b359f9
45 changed files with 1990 additions and 402 deletions

View File

@ -163,7 +163,7 @@ sub docgen
setlocale(LC_MESSAGES, $locale.".UTF-8");
my $d = Locale::gettext->domain_raw("weechat");
$d->codeset("UTF-8");
$d->dir(weechat::info_get("weechat_localedir"));
$d->dir(weechat::info_get("weechat_localedir", ""));
my $dir = $path."/".substr($locale, 0, 2)."/autogen/";
if (-d $dir)

View File

@ -111,6 +111,8 @@
./src/plugins/irc/irc-display.c
./src/plugins/irc/irc-display.h
./src/plugins/irc/irc.h
./src/plugins/irc/irc-info.c
./src/plugins/irc/irc-info.h
./src/plugins/irc/irc-input.c
./src/plugins/irc/irc-input.h
./src/plugins/irc/irc-mode.c

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-08-24 19:12+0200\n"
"POT-Creation-Date: 2008-08-29 14:53+0200\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"
@ -2013,9 +2013,11 @@ msgid "colors: %s buffer %s nick1 %s nick2 %s nick3 %s nick4"
msgstr ""
"barvy: %s buffer %s přezdívka1 %s přezdívka2 %s přezdívka3 %s přezdívka4"
#, fuzzy, c-format
msgid "%s%s: missing argument for \"%s\" command (try /help %s)"
msgstr "%s chybí argumenty pro příkaz \"%s\"\n"
msgid "Available infos:"
msgstr ""
msgid "Available infolists:"
msgstr ""
#, c-format
msgid "demo_signal: signal: %s, type_data: %s, signal_data: '%s'"
@ -2060,32 +2062,34 @@ msgstr "hledání textu v historii bufferu"
msgid "property value"
msgstr "hodnota vlastnosti"
#, fuzzy
msgid "get and display an info"
msgstr "maximální počtet příkazů, který zobarzit"
#, fuzzy
msgid "[info [arguments]]"
msgstr "příjemce typ [argumenty]"
msgid ""
" info: info to display\n"
"arguments: optional arguments for info\n"
"\n"
"Without argument, this command displays list of available infos"
msgstr ""
#, fuzzy
msgid "get and display an infolist"
msgstr "maximální počtet příkazů, který zobarzit"
#, fuzzy
msgid "infolist"
msgid "[infolist]"
msgstr "seznam zakázaných"
msgid "infolist: infolist to display (values: buffer, buffer_lines)"
msgstr "infolist: infolist pro zobrazení (hodnoty: buffer, buffer_lines)"
#, fuzzy
msgid "get and display an info"
msgstr "maximální počtet příkazů, který zobarzit"
msgid "info"
msgstr "info"
msgid ""
"info: info to display (values: version, weechat_dir, weechat_libdir, "
"weechat_sharedir, charset_terminal, charset_internal, inactivity, input, "
"input_mask, input_pos)"
"infolist: infolist to display\n"
"\n"
"Without argument, this command displays list of available infolists"
msgstr ""
"info: info pro zobrazení (hodnoty: version, weechat_dir, weechat_libdir, "
"weechat_sharedir, charset_terminal, charset_internal, inactivity, input, "
"input_mask, input_pos)"
#, fuzzy, c-format
msgid "%s: pipe open"
@ -4699,6 +4703,27 @@ msgstr "%s DCC: nemohu nastavit 'neblokovaci' volbu na soket\n"
msgid "%s%s: timeout for \"%s\" with %s"
msgstr "%s chybí argument pro volbu \"%s\"\n"
#, fuzzy
#~ msgid "%s%s: missing argument for \"%s\" command (try /help %s)"
#~ msgstr "%s chybí argumenty pro příkaz \"%s\"\n"
#~ msgid "infolist: infolist to display (values: buffer, buffer_lines)"
#~ msgstr "infolist: infolist pro zobrazení (hodnoty: buffer, buffer_lines)"
#, fuzzy
#~ msgid ""
#~ " info: info to display (values: version, weechat_dir, weechat_libdir, "
#~ "weechat_sharedir, charset_terminal, charset_internal, inactivity, input, "
#~ "input_mask, input_pos)\n"
#~ "arguments: optional arguments for info"
#~ msgstr ""
#~ "info: info pro zobrazení (hodnoty: version, weechat_dir, weechat_libdir, "
#~ "weechat_sharedir, charset_terminal, charset_internal, inactivity, input, "
#~ "input_mask, input_pos)"
#~ msgid "info"
#~ msgstr "info"
#, fuzzy
#~ msgid "%s: server %s%s%s created (temporary server, NOT SAVED!)"
#~ msgstr "Server %s%s%s vytvořen (dočasný server, NEUKLÁDÁ SE!)\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-08-24 19:12+0200\n"
"POT-Creation-Date: 2008-08-29 14:53+0200\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"
@ -1956,9 +1956,11 @@ msgstr ""
msgid "colors: %s buffer %s nick1 %s nick2 %s nick3 %s nick4"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: missing argument for \"%s\" command (try /help %s)"
msgstr "%s fehlende Argumente für den \"%s\"-Befehl\n"
msgid "Available infos:"
msgstr ""
msgid "Available infolists:"
msgstr ""
#, c-format
msgid "demo_signal: signal: %s, type_data: %s, signal_data: '%s'"
@ -2002,28 +2004,33 @@ msgstr "suche Text im Pufferverlauf"
msgid "property value"
msgstr ""
#, fuzzy
msgid "get and display an info"
msgstr "Maximale Anzahl der angezeigten Befehle"
#, fuzzy
msgid "[info [arguments]]"
msgstr "Empfänger Typ [Argumente]"
msgid ""
" info: info to display\n"
"arguments: optional arguments for info\n"
"\n"
"Without argument, this command displays list of available infos"
msgstr ""
#, fuzzy
msgid "get and display an infolist"
msgstr "Maximale Anzahl der angezeigten Befehle"
#, fuzzy
msgid "infolist"
msgid "[infolist]"
msgstr "Bannliste"
msgid "infolist: infolist to display (values: buffer, buffer_lines)"
msgstr ""
#, fuzzy
msgid "get and display an info"
msgstr "Maximale Anzahl der angezeigten Befehle"
msgid "info"
msgstr ""
msgid ""
"info: info to display (values: version, weechat_dir, weechat_libdir, "
"weechat_sharedir, charset_terminal, charset_internal, inactivity, input, "
"input_mask, input_pos)"
"infolist: infolist to display\n"
"\n"
"Without argument, this command displays list of available infolists"
msgstr ""
#, fuzzy, c-format
@ -4595,6 +4602,10 @@ msgstr "%s DCC: kann die 'nonblock'-Option für den Socket nicht festlegen\n"
msgid "%s%s: timeout for \"%s\" with %s"
msgstr "%s fehlende Argumente für die \"--dir\"-Option\n"
#, fuzzy
#~ msgid "%s%s: missing argument for \"%s\" command (try /help %s)"
#~ msgstr "%s fehlende Argumente für den \"%s\"-Befehl\n"
#, fuzzy
#~ msgid "%s: server %s%s%s created (temporary server, NOT SAVED!)"
#~ msgstr "%s Server \"%s\" nicht gefunden\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-08-24 19:12+0200\n"
"POT-Creation-Date: 2008-08-29 14:53+0200\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"
@ -1127,8 +1127,8 @@ msgstr "la cadena mostrada tras la finalización de los nombres de usuario"
#, fuzzy
msgid "use a marker (line or char) on buffers to show first unread line"
msgstr ""
"usar un marcador en los servidores/canales para mostrar la primera línea "
"sin leer"
"usar un marcador en los servidores/canales para mostrar la primera línea sin "
"leer"
#, fuzzy
msgid "save configuration file on exit"
@ -1934,9 +1934,11 @@ msgstr ""
msgid "colors: %s buffer %s nick1 %s nick2 %s nick3 %s nick4"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: missing argument for \"%s\" command (try /help %s)"
msgstr "%s faltan argumentos para el comando \"%s\"\n"
msgid "Available infos:"
msgstr ""
msgid "Available infolists:"
msgstr ""
#, c-format
msgid "demo_signal: signal: %s, type_data: %s, signal_data: '%s'"
@ -1980,28 +1982,33 @@ msgstr "sesión: cargando historial del búfer\n"
msgid "property value"
msgstr ""
#, fuzzy
msgid "get and display an info"
msgstr "número máximo de comandos para mostrar"
#, fuzzy
msgid "[info [arguments]]"
msgstr "nombre_de_usuario tipo [argumentos]"
msgid ""
" info: info to display\n"
"arguments: optional arguments for info\n"
"\n"
"Without argument, this command displays list of available infos"
msgstr ""
#, fuzzy
msgid "get and display an infolist"
msgstr "número máximo de comandos para mostrar"
#, fuzzy
msgid "infolist"
msgid "[infolist]"
msgstr "lista de baneos"
msgid "infolist: infolist to display (values: buffer, buffer_lines)"
msgstr ""
#, fuzzy
msgid "get and display an info"
msgstr "número máximo de comandos para mostrar"
msgid "info"
msgstr ""
msgid ""
"info: info to display (values: version, weechat_dir, weechat_libdir, "
"weechat_sharedir, charset_terminal, charset_internal, inactivity, input, "
"input_mask, input_pos)"
"infolist: infolist to display\n"
"\n"
"Without argument, this command displays list of available infolists"
msgstr ""
#, fuzzy, c-format
@ -4604,6 +4611,10 @@ msgstr "%s no es posible crear el servidor\n"
msgid "%s%s: timeout for \"%s\" with %s"
msgstr "%s falta un argumento para la opción --dir\n"
#, fuzzy
#~ msgid "%s%s: missing argument for \"%s\" command (try /help %s)"
#~ msgstr "%s faltan argumentos para el comando \"%s\"\n"
#, fuzzy
#~ msgid "%s: server %s%s%s created (temporary server, NOT SAVED!)"
#~ msgstr "%s servidor \"%s\" no encontrado\n"
@ -5567,8 +5578,8 @@ msgstr "%s falta un argumento para la opción --dir\n"
#~ "maximum number of lines in history for one server/channel/private window "
#~ "(0 = unlimited)"
#~ msgstr ""
#~ "número máximo de líneas en el histórico para un servidor/canal/"
#~ "privado (0 = ilimitado)"
#~ "número máximo de líneas en el histórico para un servidor/canal/privado "
#~ "(0 = ilimitado)"
#, fuzzy
#~ msgid "log messages from plugins"
@ -5762,8 +5773,8 @@ msgstr "%s falta un argumento para la opción --dir\n"
#~ "max size for aligning nick and other messages (should be >= to "
#~ "look_align_size)"
#~ msgstr ""
#~ "tamaño máximo para la alineación de nick y otros mensajes (debería "
#~ "ser >= a look_align_size)"
#~ "tamaño máximo para la alineación de nick y otros mensajes (debería ser "
#~ ">= a look_align_size)"
#~ msgid "server name not found"
#~ msgstr "nombre de servidor no encontrado"
@ -6538,8 +6549,7 @@ msgstr "%s falta un argumento para la opción --dir\n"
#~ msgid "color for chan owner symbol (specific to unrealircd)"
#~ msgstr ""
#~ "color para el símbolo de propietario de canal (especificado en "
#~ "unrealircd)"
#~ "color para el símbolo de propietario de canal (especificado en unrealircd)"
#~ msgid "color for chan admin symbol"
#~ msgstr "color para el símbolo de administrador de canal"

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-08-24 19:12+0200\n"
"PO-Revision-Date: 2008-08-24 19:14+0200\n"
"POT-Creation-Date: 2008-08-29 14:53+0200\n"
"PO-Revision-Date: 2008-08-29 14:53+0200\n"
"Last-Translator: FlashCode <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"MIME-Version: 1.0\n"
@ -778,10 +778,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)\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)\n"
"\n"
"Exemples:\n"
" filtrer les messages IRC join/part/quit:\n"
@ -1944,9 +1948,11 @@ msgstr "%smessage de démonstration avec préfixe d'erreur"
msgid "colors: %s buffer %s nick1 %s nick2 %s nick3 %s nick4"
msgstr "couleurs: %s tampon %s pseudo1 %s pseudo2 %s pseudo3 %s pseudo4"
#, c-format
msgid "%s%s: missing argument for \"%s\" command (try /help %s)"
msgstr "%s%s: paramètre manquant pour la commande \"%s\" (essayez /help %s)"
msgid "Available infos:"
msgstr "Infos disponibles:"
msgid "Available infolists:"
msgstr "Infolists disponibles:"
#, c-format
msgid "demo_signal: signal: %s, type_data: %s, signal_data: '%s'"
@ -1987,29 +1993,37 @@ msgstr "définir une propriété de tampon"
msgid "property value"
msgstr "propriété valeur"
msgid "get and display an infolist"
msgstr "lit et affiche une infolist"
msgid "infolist"
msgstr "infolist"
msgid "infolist: infolist to display (values: buffer, buffer_lines)"
msgstr "infolist: infolist à afficher (valeurs: buffer, buffer_lines)"
msgid "get and display an info"
msgstr "lit et affiche une info"
msgid "info"
msgstr "info"
msgid "[info [arguments]]"
msgstr "[info [paramètres]]"
msgid ""
"info: info to display (values: version, weechat_dir, weechat_libdir, "
"weechat_sharedir, charset_terminal, charset_internal, inactivity, input, "
"input_mask, input_pos)"
" info: info to display\n"
"arguments: optional arguments for info\n"
"\n"
"Without argument, this command displays list of available infos"
msgstr ""
"info: info à afficher (valeurs: version, weechat_dir, weechat_libdir, "
"weechat_sharedir, charset_terminal, charset_internal, inactivity, input, "
"input_mask, input_pos)"
" info: info à afficher\n"
"paramètres: paramètres optionnels pour l'info\n"
"\n"
"Sans paramètre, cette commande affiche la liste des infos disponibles"
msgid "get and display an infolist"
msgstr "lit et affiche une infolist"
msgid "[infolist]"
msgstr "[infolist]"
msgid ""
"infolist: infolist to display\n"
"\n"
"Without argument, this command displays list of available infolists"
msgstr ""
"infolist: infolist à afficher\n"
"\n"
"Sans paramètre, cette commande affiche la liste des infolists disponibles"
#, c-format
msgid "%s: pipe open"
@ -4601,3 +4615,23 @@ msgstr "%s%s: impossible de positionner l'option \"nonblock\" pour la socket"
#, c-format
msgid "%s%s: timeout for \"%s\" with %s"
msgstr "%s%s: délai d'attente dépassé pour \"%s\" avec %s"
#~ msgid "%s%s: missing argument for \"%s\" command (try /help %s)"
#~ msgstr "%s%s: paramètre manquant pour la commande \"%s\" (essayez /help %s)"
#~ msgid "infolist: infolist to display (values: buffer, buffer_lines)"
#~ msgstr "infolist: infolist à afficher (valeurs: buffer, buffer_lines)"
#~ msgid ""
#~ " info: info to display (values: version, weechat_dir, weechat_libdir, "
#~ "weechat_sharedir, charset_terminal, charset_internal, inactivity, input, "
#~ "input_mask, input_pos)\n"
#~ "arguments: optional arguments for info"
#~ msgstr ""
#~ " info: info à afficher (valeurs: version, weechat_dir, "
#~ "weechat_libdir, weechat_sharedir, charset_terminal, charset_internal, "
#~ "inactivity, input, input_mask, input_pos)\n"
#~ "paramètres: paramètres optionnels pour l'info"
#~ msgid "info"
#~ msgstr "info"

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-08-24 19:12+0200\n"
"POT-Creation-Date: 2008-08-29 14:53+0200\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"
@ -1963,9 +1963,11 @@ msgstr ""
msgid "colors: %s buffer %s nick1 %s nick2 %s nick3 %s nick4"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: missing argument for \"%s\" command (try /help %s)"
msgstr "%s hiányzó argumentum a \"%s\" parancsnak\n"
msgid "Available infos:"
msgstr ""
msgid "Available infolists:"
msgstr ""
#, c-format
msgid "demo_signal: signal: %s, type_data: %s, signal_data: '%s'"
@ -2009,28 +2011,33 @@ msgstr "szöveg keresése a puffertörténetben"
msgid "property value"
msgstr ""
#, fuzzy
msgid "get and display an info"
msgstr "megjeleníthető parancsok maximális száma"
#, fuzzy
msgid "[info [arguments]]"
msgstr "fogadó típusa [paraméterek]"
msgid ""
" info: info to display\n"
"arguments: optional arguments for info\n"
"\n"
"Without argument, this command displays list of available infos"
msgstr ""
#, fuzzy
msgid "get and display an infolist"
msgstr "megjeleníthető parancsok maximális száma"
#, fuzzy
msgid "infolist"
msgid "[infolist]"
msgstr "tiltólista"
msgid "infolist: infolist to display (values: buffer, buffer_lines)"
msgstr ""
#, fuzzy
msgid "get and display an info"
msgstr "megjeleníthető parancsok maximális száma"
msgid "info"
msgstr ""
msgid ""
"info: info to display (values: version, weechat_dir, weechat_libdir, "
"weechat_sharedir, charset_terminal, charset_internal, inactivity, input, "
"input_mask, input_pos)"
"infolist: infolist to display\n"
"\n"
"Without argument, this command displays list of available infolists"
msgstr ""
#, fuzzy, c-format
@ -4615,6 +4622,10 @@ msgstr "%s DCC: nem sikerült 'nonblock' opciót beállítani a csatornán\n"
msgid "%s%s: timeout for \"%s\" with %s"
msgstr "%s hiányzó argumentum a(z) \"%s\" opciónak\n"
#, fuzzy
#~ msgid "%s%s: missing argument for \"%s\" command (try /help %s)"
#~ msgstr "%s hiányzó argumentum a \"%s\" parancsnak\n"
#, fuzzy
#~ msgid "%s: server %s%s%s created (temporary server, NOT SAVED!)"
#~ msgstr ""

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-08-24 19:12+0200\n"
"POT-Creation-Date: 2008-08-29 14:53+0200\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"
@ -1968,9 +1968,11 @@ msgstr ""
msgid "colors: %s buffer %s nick1 %s nick2 %s nick3 %s nick4"
msgstr ""
#, fuzzy, c-format
msgid "%s%s: missing argument for \"%s\" command (try /help %s)"
msgstr "%s нет аргументов для \"%s\" команды\n"
msgid "Available infos:"
msgstr ""
msgid "Available infolists:"
msgstr ""
#, c-format
msgid "demo_signal: signal: %s, type_data: %s, signal_data: '%s'"
@ -2014,28 +2016,33 @@ msgstr "поиск текста в истории буфера"
msgid "property value"
msgstr ""
#, fuzzy
msgid "get and display an info"
msgstr "количество отображаемых команд"
#, fuzzy
msgid "[info [arguments]]"
msgstr "адресат тип [аргументы]"
msgid ""
" info: info to display\n"
"arguments: optional arguments for info\n"
"\n"
"Without argument, this command displays list of available infos"
msgstr ""
#, fuzzy
msgid "get and display an infolist"
msgstr "количество отображаемых команд"
#, fuzzy
msgid "infolist"
msgid "[infolist]"
msgstr "баны"
msgid "infolist: infolist to display (values: buffer, buffer_lines)"
msgstr ""
#, fuzzy
msgid "get and display an info"
msgstr "количество отображаемых команд"
msgid "info"
msgstr ""
msgid ""
"info: info to display (values: version, weechat_dir, weechat_libdir, "
"weechat_sharedir, charset_terminal, charset_internal, inactivity, input, "
"input_mask, input_pos)"
"infolist: infolist to display\n"
"\n"
"Without argument, this command displays list of available infolists"
msgstr ""
#, fuzzy, c-format
@ -4598,6 +4605,10 @@ msgstr "%s DCC: не могу установить неблокирующий р
msgid "%s%s: timeout for \"%s\" with %s"
msgstr "%s нет аргумента для параметра \"%s\"\n"
#, fuzzy
#~ msgid "%s%s: missing argument for \"%s\" command (try /help %s)"
#~ msgstr "%s нет аргументов для \"%s\" команды\n"
#, fuzzy
#~ msgid "%s: server %s%s%s created (temporary server, NOT SAVED!)"
#~ msgstr "Сервер %s%s%s создан (временный сервер, НЕ СОХРАНЁН!\n"

View File

@ -112,6 +112,8 @@ SET(WEECHAT_SOURCES
./src/plugins/irc/irc-display.c
./src/plugins/irc/irc-display.h
./src/plugins/irc/irc.h
./src/plugins/irc/irc-info.c
./src/plugins/irc/irc-info.h
./src/plugins/irc/irc-input.c
./src/plugins/irc/irc-input.h
./src/plugins/irc/irc-mode.c

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-08-24 19:12+0200\n"
"POT-Creation-Date: 2008-08-29 14:53+0200\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"
@ -1645,8 +1645,10 @@ msgstr ""
msgid "colors: %s buffer %s nick1 %s nick2 %s nick3 %s nick4"
msgstr ""
#, c-format
msgid "%s%s: missing argument for \"%s\" command (try /help %s)"
msgid "Available infos:"
msgstr ""
msgid "Available infolists:"
msgstr ""
#, c-format
@ -1687,25 +1689,29 @@ msgstr ""
msgid "property value"
msgstr ""
msgid "get and display an infolist"
msgstr ""
msgid "infolist"
msgstr ""
msgid "infolist: infolist to display (values: buffer, buffer_lines)"
msgstr ""
msgid "get and display an info"
msgstr ""
msgid "info"
msgid "[info [arguments]]"
msgstr ""
msgid ""
"info: info to display (values: version, weechat_dir, weechat_libdir, "
"weechat_sharedir, charset_terminal, charset_internal, inactivity, input, "
"input_mask, input_pos)"
" info: info to display\n"
"arguments: optional arguments for info\n"
"\n"
"Without argument, this command displays list of available infos"
msgstr ""
msgid "get and display an infolist"
msgstr ""
msgid "[infolist]"
msgstr ""
msgid ""
"infolist: infolist to display\n"
"\n"
"Without argument, this command displays list of available infolists"
msgstr ""
#, c-format

View File

@ -47,7 +47,7 @@
char *hook_type_string[HOOK_NUM_TYPES] =
{ "command", "timer", "fd", "connect", "print", "signal", "config",
"completion", "modifier" };
"completion", "modifier", "info", "infolist" };
struct t_hook *weechat_hooks[HOOK_NUM_TYPES];
struct t_hook *last_weechat_hook[HOOK_NUM_TYPES];
int hook_exec_recursion = 0;
@ -1275,6 +1275,9 @@ hook_modifier_exec (struct t_weechat_plugin *plugin, const char *modifier,
/* make C compiler happy */
(void) plugin;
if (!modifier || !modifier[0])
return NULL;
new_msg = NULL;
message_modified = strdup (string);
if (!message_modified)
@ -1322,6 +1325,170 @@ hook_modifier_exec (struct t_weechat_plugin *plugin, const char *modifier,
return message_modified;
}
/*
* hook_info: hook an info
*/
struct t_hook *
hook_info (struct t_weechat_plugin *plugin, const char *info_name,
t_hook_callback_info *callback, void *callback_data)
{
struct t_hook *new_hook;
struct t_hook_info *new_hook_info;
if (!info_name || !info_name[0])
return NULL;
new_hook = malloc (sizeof (*new_hook));
if (!new_hook)
return NULL;
new_hook_info = malloc (sizeof (*new_hook_info));
if (!new_hook_info)
{
free (new_hook);
return NULL;
}
hook_init_data (new_hook, plugin, HOOK_TYPE_INFO, callback_data);
new_hook->hook_data = new_hook_info;
new_hook_info->callback = callback;
new_hook_info->info_name = strdup (info_name);
hook_add_to_list (new_hook);
return new_hook;
}
/*
* hook_info_get: get info via info hook
*/
char *
hook_info_get (struct t_weechat_plugin *plugin, const char *info_name,
const char *arguments)
{
struct t_hook *ptr_hook, *next_hook;
char *value;
/* make C compiler happy */
(void) plugin;
if (!info_name || !info_name[0])
return NULL;
hook_exec_start ();
ptr_hook = weechat_hooks[HOOK_TYPE_INFO];
while (ptr_hook)
{
next_hook = ptr_hook->next_hook;
if (!ptr_hook->deleted
&& !ptr_hook->running
&& (string_strcasecmp (HOOK_INFO(ptr_hook, info_name),
info_name) == 0))
{
ptr_hook->running = 1;
value = (HOOK_INFO(ptr_hook, callback))
(ptr_hook->callback_data, info_name, arguments);
ptr_hook->running = 0;
hook_exec_end ();
return value;
}
ptr_hook = next_hook;
}
hook_exec_end ();
/* info not found */
return NULL;
}
/*
* hook_infolist: hook an infolist
*/
struct t_hook *
hook_infolist (struct t_weechat_plugin *plugin, const char *infolist_name,
t_hook_callback_infolist *callback, void *callback_data)
{
struct t_hook *new_hook;
struct t_hook_infolist *new_hook_infolist;
if (!infolist_name || !infolist_name[0])
return NULL;
new_hook = malloc (sizeof (*new_hook));
if (!new_hook)
return NULL;
new_hook_infolist = malloc (sizeof (*new_hook_infolist));
if (!new_hook_infolist)
{
free (new_hook);
return NULL;
}
hook_init_data (new_hook, plugin, HOOK_TYPE_INFOLIST, callback_data);
new_hook->hook_data = new_hook_infolist;
new_hook_infolist->callback = callback;
new_hook_infolist->infolist_name = strdup (infolist_name);
hook_add_to_list (new_hook);
return new_hook;
}
/*
* hook_infolist_get: get info via info hook
*/
struct t_infolist *
hook_infolist_get (struct t_weechat_plugin *plugin, const char *infolist_name,
void *pointer, const char *arguments)
{
struct t_hook *ptr_hook, *next_hook;
struct t_infolist *value;
/* make C compiler happy */
(void) plugin;
if (!infolist_name || !infolist_name[0])
return NULL;
hook_exec_start ();
ptr_hook = weechat_hooks[HOOK_TYPE_INFOLIST];
while (ptr_hook)
{
next_hook = ptr_hook->next_hook;
if (!ptr_hook->deleted
&& !ptr_hook->running
&& (string_strcasecmp (HOOK_INFOLIST(ptr_hook, infolist_name),
infolist_name) == 0))
{
ptr_hook->running = 1;
value = (HOOK_INFOLIST(ptr_hook, callback))
(ptr_hook->callback_data, infolist_name, pointer, arguments);
ptr_hook->running = 0;
hook_exec_end ();
return value;
}
ptr_hook = next_hook;
}
hook_exec_end ();
/* infolist not found */
return NULL;
}
/*
* unhook: unhook something
*/
@ -1418,6 +1585,16 @@ unhook (struct t_hook *hook)
free (HOOK_MODIFIER(hook, modifier));
free ((struct t_hook_modifier *)hook->hook_data);
break;
case HOOK_TYPE_INFO:
if (HOOK_INFO(hook, info_name))
free (HOOK_INFO(hook, info_name));
free ((struct t_hook_info *)hook->hook_data);
break;
case HOOK_TYPE_INFOLIST:
if (HOOK_INFOLIST(hook, infolist_name))
free (HOOK_INFOLIST(hook, infolist_name));
free ((struct t_hook_infolist *)hook->hook_data);
break;
case HOOK_NUM_TYPES:
/* this constant is used to count types only,
it is never used as type */
@ -1670,6 +1847,24 @@ hook_add_to_infolist_type (struct t_infolist *infolist,
return 0;
}
break;
case HOOK_TYPE_INFO:
if (!ptr_hook->deleted)
{
if (!infolist_new_var_pointer (ptr_item, "callback", HOOK_INFO(ptr_hook, callback)))
return 0;
if (!infolist_new_var_string (ptr_item, "info_name", HOOK_INFO(ptr_hook, info_name)))
return 0;
}
break;
case HOOK_TYPE_INFOLIST:
if (!ptr_hook->deleted)
{
if (!infolist_new_var_pointer (ptr_item, "callback", HOOK_INFOLIST(ptr_hook, callback)))
return 0;
if (!infolist_new_var_string (ptr_item, "infolist_name", HOOK_INFOLIST(ptr_hook, infolist_name)))
return 0;
}
break;
case HOOK_NUM_TYPES:
/* this constant is used to count types only,
it is never used as type */
@ -1842,6 +2037,22 @@ hook_print_log ()
log_printf (" modifier . . . . . . : '%s'", HOOK_MODIFIER(ptr_hook, modifier));
}
break;
case HOOK_TYPE_INFO:
if (!ptr_hook->deleted)
{
log_printf (" info data:");
log_printf (" callback . . . . . . : 0x%x", HOOK_INFO(ptr_hook, callback));
log_printf (" info_name. . . . . . : '%s'", HOOK_INFO(ptr_hook, info_name));
}
break;
case HOOK_TYPE_INFOLIST:
if (!ptr_hook->deleted)
{
log_printf (" infolist data:");
log_printf (" callback . . . . . . : 0x%x", HOOK_INFOLIST(ptr_hook, callback));
log_printf (" infolist_name. . . . : '%s'", HOOK_INFOLIST(ptr_hook, infolist_name));
}
break;
case HOOK_NUM_TYPES:
/* this constant is used to count types only,
it is never used as type */

View File

@ -42,6 +42,8 @@ enum t_hook_type
HOOK_TYPE_CONFIG, /* config option */
HOOK_TYPE_COMPLETION, /* custom completions */
HOOK_TYPE_MODIFIER, /* string modifier */
HOOK_TYPE_INFO, /* get some info as string */
HOOK_TYPE_INFOLIST, /* get some info as infolist */
/* number of hook types */
HOOK_NUM_TYPES,
};
@ -64,6 +66,8 @@ enum t_hook_type
#define HOOK_CONFIG(hook, var) (((struct t_hook_config *)hook->hook_data)->var)
#define HOOK_COMPLETION(hook, var) (((struct t_hook_completion *)hook->hook_data)->var)
#define HOOK_MODIFIER(hook, var) (((struct t_hook_modifier *)hook->hook_data)->var)
#define HOOK_INFO(hook, var) (((struct t_hook_info *)hook->hook_data)->var)
#define HOOK_INFOLIST(hook, var) (((struct t_hook_infolist *)hook->hook_data)->var)
struct t_hook
{
@ -191,6 +195,26 @@ struct t_hook_modifier
char *modifier; /* name of modifier */
};
typedef char *(t_hook_callback_info)(void *data, const char *info_name,
const char *arguments);
struct t_hook_info
{
t_hook_callback_info *callback; /* info callback */
char *info_name; /* name of info returned */
};
typedef struct t_infolist *(t_hook_callback_infolist)(void *data,
const char *infolist_name,
void *pointer,
const char *arguments);
struct t_hook_infolist
{
t_hook_callback_infolist *callback; /* infolist callback */
char *infolist_name; /* name of infolist returned */
};
/* hook variables */
extern struct t_hook *weechat_hooks[];
@ -271,6 +295,21 @@ extern char *hook_modifier_exec (struct t_weechat_plugin *plugin,
const char *modifier,
const char *modifier_data,
const char *string);
extern struct t_hook *hook_info (struct t_weechat_plugin *plugin,
const char *info_name,
t_hook_callback_info *callback,
void *callback_data);
extern char *hook_info_get (struct t_weechat_plugin *plugin,
const char *info_name,
const char *arguments);
extern struct t_hook *hook_infolist (struct t_weechat_plugin *plugin,
const char *infolist_name,
t_hook_callback_infolist *callback,
void *callback_data);
extern struct t_infolist *hook_infolist_get (struct t_weechat_plugin *plugin,
const char *infolist_name,
void *pointer,
const char *arguments);
extern void unhook (struct t_hook *hook);
extern void unhook_all_plugin (struct t_weechat_plugin *plugin);
extern void unhook_all ();

View File

@ -523,6 +523,48 @@ gui_completion_list_add_command_hooks (struct t_gui_completion *completion)
}
}
/*
* gui_completion_list_add_info_hooks: add info hooks to completion list
*/
void
gui_completion_list_add_info_hooks (struct t_gui_completion *completion)
{
struct t_hook *ptr_hook;
for (ptr_hook = weechat_hooks[HOOK_TYPE_INFO]; ptr_hook;
ptr_hook = ptr_hook->next_hook)
{
if (!ptr_hook->deleted
&& (HOOK_INFO(ptr_hook, info_name))
&& (HOOK_INFO(ptr_hook, info_name)[0]))
gui_completion_list_add (completion,
HOOK_INFO(ptr_hook, info_name),
0, WEECHAT_LIST_POS_SORT);
}
}
/*
* gui_completion_list_add_infolist_hooks: add infolist hooks to completion list
*/
void
gui_completion_list_add_infolist_hooks (struct t_gui_completion *completion)
{
struct t_hook *ptr_hook;
for (ptr_hook = weechat_hooks[HOOK_TYPE_INFOLIST]; ptr_hook;
ptr_hook = ptr_hook->next_hook)
{
if (!ptr_hook->deleted
&& (HOOK_INFOLIST(ptr_hook, infolist_name))
&& (HOOK_INFOLIST(ptr_hook, infolist_name)[0]))
gui_completion_list_add (completion,
HOOK_INFOLIST(ptr_hook, infolist_name),
0, WEECHAT_LIST_POS_SORT);
}
}
/*
* gui_completion_list_add_self_nick: add self nick on server to completion list
*/
@ -952,6 +994,12 @@ gui_completion_build_list_template (struct t_gui_completion *completion,
case 'h': /* command hooks */
gui_completion_list_add_command_hooks (completion);
break;
case 'i': /* infos hooked */
gui_completion_list_add_info_hooks (completion);
break;
case 'I': /* infolists hooked */
gui_completion_list_add_infolist_hooks (completion);
break;
case 'm': /* self nickname */
gui_completion_list_add_self_nick (completion);
break;

View File

@ -526,8 +526,8 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
charset_debug = weechat_config_boolean (weechat_config_get ("weechat.plugin.debug"));
/* get terminal & internal charsets */
charset_terminal = weechat_info_get ("charset_terminal");
charset_internal = weechat_info_get ("charset_internal");
charset_terminal = weechat_info_get ("charset_terminal", "");
charset_internal = weechat_info_get ("charset_internal", "");
/* display message */
weechat_printf (NULL,

View File

@ -210,6 +210,9 @@ demo_infolist_print (struct t_infolist *infolist, const char *item_name)
int i, j, argc, size;
time_t time;
if (!infolist)
return;
i = 1;
while (weechat_infolist_next (infolist))
{
@ -267,6 +270,45 @@ demo_infolist_print (struct t_infolist *infolist, const char *item_name)
}
}
/*
* demo_info_command_cb: demo command for info_get
*/
int
demo_info_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
struct t_infolist *infolist;
/* make C compiler happy */
(void) data;
(void) buffer;
if (argc > 1)
weechat_printf (NULL, "info \"%s\" = \"%s\"",
argv[1],
weechat_info_get (argv[1],
(argc > 2) ? argv_eol[2] : NULL));
else
{
infolist = weechat_infolist_get ("hook", NULL, "info");
if (infolist)
{
weechat_printf (NULL, "");
weechat_printf (NULL, _("Available infos:"));
while (weechat_infolist_next (infolist))
{
weechat_printf (NULL,
" %s",
weechat_infolist_string (infolist, "info_name"));
}
weechat_infolist_free (infolist);
}
}
return WEECHAT_RC_OK;
}
/*
* demo_infolist_command_cb: demo command for list
*/
@ -280,64 +322,33 @@ demo_infolist_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
/* make C compiler happy */
(void) data;
(void) buffer;
(void) argv_eol;
if (argc > 1)
{
if (weechat_strcasecmp (argv[1], "buffer") == 0)
{
infolist = weechat_infolist_get ("buffer", NULL, NULL);
infolist = weechat_infolist_get (argv[1], NULL,
(argc > 2) ? argv_eol[2] : NULL);
if (infolist)
{
demo_infolist_print (infolist, "buffer");
demo_infolist_print (infolist, argv[1]);
weechat_infolist_free (infolist);
}
return WEECHAT_RC_OK;
}
if (weechat_strcasecmp (argv[1], "buffer_lines") == 0)
{
infolist = weechat_infolist_get ("buffer_lines", NULL, NULL);
if (infolist)
{
demo_infolist_print (infolist, "buffer_line");
weechat_infolist_free (infolist);
}
return WEECHAT_RC_OK;
}
}
weechat_printf (NULL,
_("%s%s: missing argument for \"%s\" command "
"(try /help %s)"),
weechat_prefix ("error"), "demo",
"demo_infolist", "demo_infolist");
return WEECHAT_RC_OK;
}
/*
* demo_info_command_cb: demo command for info_get
*/
int
demo_info_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
/* make C compiler happy */
(void) data;
(void) buffer;
(void) argv_eol;
if (argc > 1)
weechat_printf (NULL, "info \"%s\" = \"%s\"",
argv[1],
weechat_info_get (argv[1]));
else
{
infolist = weechat_infolist_get ("hook", NULL, "infolist");
if (infolist)
{
weechat_printf (NULL, "");
weechat_printf (NULL, _("Available infolists:"));
while (weechat_infolist_next (infolist))
{
weechat_printf (NULL,
_("%s%s: missing argument for \"%s\" command "
"(try /help %s)"),
weechat_prefix ("error"), "demo",
"demo_info", "demo_info");
" %s",
weechat_infolist_string (infolist, "infolist_name"));
}
weechat_infolist_free (infolist);
}
}
return WEECHAT_RC_OK;
}
@ -424,26 +435,25 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
"",
&demo_buffer_set_command_cb, NULL);
weechat_hook_command ("demo_infolist",
N_("get and display an infolist"),
N_("infolist"),
N_("infolist: infolist to display (values: buffer, "
"buffer_lines)"),
"buffer|buffer_lines",
&demo_infolist_command_cb, NULL);
weechat_hook_command ("demo_info",
N_("get and display an info"),
N_("info"),
N_("info: info to display (values: version, "
"weechat_dir, weechat_libdir, weechat_sharedir, "
"charset_terminal, charset_internal, inactivity, "
"input, input_mask, input_pos)"),
"version|weechat_dir|weechat_libdir|"
"weechat_sharedir|charset_terminal|charset_internal|"
"inactivity|input|input_mask|input_pos",
N_("[info [arguments]]"),
N_(" info: info to display\n"
"arguments: optional arguments for info\n\n"
"Without argument, this command displays list "
"of available infos"),
"%i",
&demo_info_command_cb, NULL);
weechat_hook_command ("demo_infolist",
N_("get and display an infolist"),
N_("[infolist]"),
N_("infolist: infolist to display\n\n"
"Without argument, this command displays list "
"of available infolists"),
"%i",
&demo_infolist_command_cb, NULL);
weechat_hook_signal ("debug", &demo_debug_signal_debug_cb, NULL);
weechat_hook_signal ("*", &demo_signal_cb, NULL);

View File

@ -67,7 +67,7 @@ fifo_create ()
fifo_option = weechat_config_get_plugin ("fifo");
}
weechat_home = weechat_info_get ("weechat_dir");
weechat_home = weechat_info_get ("weechat_dir", "");
if (fifo_option && weechat_home)
{

View File

@ -24,6 +24,7 @@ irc-completion.c irc-completion.h
irc-config.c irc-config.h
irc-debug.c irc-debug.h
irc-display.c irc-display.h
irc-info.c irc-info.h
irc-input.c irc-input.h
irc-mode.c irc-mode.h
irc-nick.c irc-nick.h

View File

@ -38,6 +38,8 @@ irc_la_SOURCES = irc.c \
irc-debug.h \
irc-display.c \
irc-display.h \
irc-info.c \
irc-info.h \
irc-input.c \
irc-input.h \
irc-mode.c \

View File

@ -33,6 +33,31 @@
#include "irc-input.h"
/*
* irc_channel_valid: check if a channel pointer exists for a server
* return 1 if channel exists
* 0 if channel is not found
*/
int
irc_channel_valid (struct t_irc_server *server, struct t_irc_channel *channel)
{
struct t_irc_channel *ptr_channel;
if (!server)
return 0;
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
if (ptr_channel == channel)
return 1;
}
/* channel not found */
return 0;
}
/*
* irc_channel_new: allocate a new channel for a server and add it to servers
* list
@ -114,6 +139,7 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
new_channel->last_nick = NULL;
new_channel->buffer = new_buffer;
new_channel->nicks_speaking = NULL;
new_channel->buffer_as_string = NULL;
/* add new channel to channels list */
new_channel->prev_channel = server->last_channel;
@ -185,6 +211,8 @@ irc_channel_free (struct t_irc_server *server, struct t_irc_channel *channel)
free (channel->away_message);
if (channel->nicks_speaking)
weechat_list_free (channel->nicks_speaking);
if (channel->buffer_as_string)
free (channel->buffer_as_string);
free (channel);

View File

@ -50,10 +50,13 @@ struct t_irc_channel
struct t_irc_nick *last_nick; /* last nick on the channel */
struct t_weelist *nicks_speaking; /* for smart completion */
struct t_gui_buffer *buffer; /* buffer allocated for channel */
char *buffer_as_string; /* used to return buffer info */
struct t_irc_channel *prev_channel; /* link to previous channel */
struct t_irc_channel *next_channel; /* link to next channel */
};
extern int irc_channel_valid (struct t_irc_server *server,
struct t_irc_channel *channel);
extern struct t_irc_channel *irc_channel_new (struct t_irc_server *server,
int channel_type,
const char *channel_name,

View File

@ -863,7 +863,7 @@ irc_command_cycle (void *data, struct t_gui_buffer *buffer, int argc,
if (ptr_arg)
{
version = weechat_info_get ("version");
version = weechat_info_get ("version", "");
buf = weechat_string_replace (ptr_arg, "%v", (version) ? version : "");
irc_server_sendf (ptr_server, "PART %s :%s", channel_name,
(buf) ? buf : ptr_arg);
@ -1141,7 +1141,7 @@ irc_command_quit_server (struct t_irc_server *server, const char *arguments)
if (ptr_arg)
{
version = weechat_info_get ("version");
version = weechat_info_get ("version", "");
buf = weechat_string_replace (ptr_arg, "%v",
(version) ? version : "");
irc_server_sendf (server, "QUIT :%s",
@ -2169,7 +2169,7 @@ irc_command_part_channel (struct t_irc_server *server, const char *channel_name,
if (ptr_arg)
{
version = weechat_info_get ("version");
version = weechat_info_get ("version", "");
buf = weechat_string_replace (ptr_arg, "%v", (version) ? version : "");
irc_server_sendf (server, "PART %s :%s",
channel_name,

339
src/plugins/irc/irc-info.c Normal file
View File

@ -0,0 +1,339 @@
/*
* Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org>
* See README for License detail, AUTHORS for developers list.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* irc-info.c: info and infolist hooks for IRC plugin */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "../weechat-plugin.h"
#include "irc.h"
#include "irc-info.h"
#include "irc-channel.h"
#include "irc-nick.h"
#include "irc-protocol.h"
#include "irc-server.h"
/*
* irc_info_create_string_with_pointer: create a string with a pointer inside
* an IRC structure
*/
void
irc_info_create_string_with_pointer (char **string, void *pointer)
{
if (*string)
{
free (*string);
*string = NULL;
}
if (pointer)
{
*string = malloc (64);
if (*string)
{
snprintf (*string, 64 - 1, "0x%x", (unsigned int)pointer);
}
}
}
/*
* irc_info_get_info_cb: callback called when IRC info is asked
*/
char *
irc_info_get_info_cb (void *data, const char *info_name,
const char *arguments)
{
char *pos_comma, *pos_comma2, *server, *channel, *host, *nick;
static char str_true[2] = "1";
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
/* make C compiler happy */
(void) data;
if (weechat_strcasecmp (info_name, "irc_is_channel") == 0)
{
if (irc_channel_is_channel (arguments))
return str_true;
return NULL;
}
else if (weechat_strcasecmp (info_name, "irc_nick_from_host") == 0)
{
return irc_protocol_get_nick_from_host (arguments);
}
else if (weechat_strcasecmp (info_name, "irc_buffer") == 0)
{
if (arguments && arguments[0])
{
server = NULL;
channel = NULL;
host = NULL;
ptr_server = NULL;
ptr_channel = NULL;
pos_comma = strchr (arguments, ',');
if (pos_comma)
{
server = weechat_strndup (arguments, pos_comma - arguments);
pos_comma2 = strchr (pos_comma + 1, ',');
if (pos_comma2)
{
channel = weechat_strndup (pos_comma + 1,
pos_comma2 - pos_comma - 1);
host = strdup (pos_comma2 + 1);
}
else
channel = strdup (pos_comma + 1);
}
else
{
if (irc_channel_is_channel (arguments))
channel = strdup (arguments);
else
server = strdup (arguments);
}
/* replace channel by nick in host if channel is not a channel
(private ?) */
if (channel && host)
{
if (!irc_channel_is_channel (channel))
{
free (channel);
channel = NULL;
nick = irc_protocol_get_nick_from_host (host);
if (nick)
channel = strdup (nick);
}
}
/* search for server or channel buffer */
if (server)
{
ptr_server = irc_server_search (server);
if (ptr_server && channel)
ptr_channel = irc_channel_search (ptr_server, channel);
}
if (server)
free (server);
if (channel)
free (channel);
if (host)
free (host);
if (ptr_channel)
{
irc_info_create_string_with_pointer (&ptr_channel->buffer_as_string,
ptr_channel->buffer);
return ptr_channel->buffer_as_string;
}
if (ptr_server)
{
irc_info_create_string_with_pointer (&ptr_server->buffer_as_string,
ptr_server->buffer);
return ptr_server->buffer_as_string;
}
}
}
return NULL;
}
/*
* irc_info_get_infolist_cb: callback called when IRC infolist is asked
*/
struct t_infolist *
irc_info_get_infolist_cb (void *data, const char *infolist_name,
void *pointer, const char *arguments)
{
struct t_infolist *ptr_infolist;
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
char *pos_comma, *server_name;
/* make C compiler happy */
(void) data;
(void) arguments;
if (!infolist_name || !infolist_name[0])
return NULL;
if (weechat_strcasecmp (infolist_name, "irc_server") == 0)
{
if (pointer && !irc_server_valid (pointer))
return NULL;
ptr_infolist = weechat_infolist_new ();
if (ptr_infolist)
{
if (pointer)
{
/* build list with only one server */
if (!irc_server_add_to_infolist (ptr_infolist, pointer))
{
weechat_infolist_free (ptr_infolist);
return NULL;
}
return ptr_infolist;
}
else
{
/* build list with all servers */
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
if (!irc_server_add_to_infolist (ptr_infolist, ptr_server))
{
weechat_infolist_free (ptr_infolist);
return NULL;
}
}
return ptr_infolist;
}
}
}
else if (weechat_strcasecmp (infolist_name, "irc_channel") == 0)
{
if (arguments && arguments[0])
{
ptr_server = irc_server_search (arguments);
if (ptr_server)
{
if (pointer && !irc_channel_valid (ptr_server, pointer))
return NULL;
ptr_infolist = weechat_infolist_new ();
if (ptr_infolist)
{
if (pointer)
{
/* build list with only one channel */
if (!irc_channel_add_to_infolist (ptr_infolist, pointer))
{
weechat_infolist_free (ptr_infolist);
return NULL;
}
return ptr_infolist;
}
else
{
/* build list with all channels of server */
for (ptr_channel = ptr_server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
if (!irc_channel_add_to_infolist (ptr_infolist,
ptr_channel))
{
weechat_infolist_free (ptr_infolist);
return NULL;
}
}
return ptr_infolist;
}
}
}
}
}
else if (weechat_strcasecmp (infolist_name, "irc_nick") == 0)
{
if (arguments && arguments[0])
{
ptr_server = NULL;
ptr_channel = NULL;
pos_comma = strchr (arguments, ',');
if (pos_comma)
{
server_name = weechat_strndup (arguments, pos_comma - arguments);
if (server_name)
{
ptr_server = irc_server_search (server_name);
if (ptr_server)
{
ptr_channel = irc_channel_search (ptr_server,
pos_comma + 1);
}
free (server_name);
}
}
if (ptr_server && ptr_channel)
{
if (pointer && !irc_nick_valid (ptr_channel, pointer))
return NULL;
ptr_infolist = weechat_infolist_new ();
if (ptr_infolist)
{
if (pointer)
{
/* build list with only one nick */
if (!irc_nick_add_to_infolist (ptr_infolist, pointer))
{
weechat_infolist_free (ptr_infolist);
return NULL;
}
return ptr_infolist;
}
else
{
/* build list with all nicks of channel */
for (ptr_nick = ptr_channel->nicks; ptr_nick;
ptr_nick = ptr_nick->next_nick)
{
if (!irc_nick_add_to_infolist (ptr_infolist,
ptr_nick))
{
weechat_infolist_free (ptr_infolist);
return NULL;
}
}
return ptr_infolist;
}
}
}
}
}
return NULL;
}
/*
* irc_info_init: initialize info and infolist hooks for IRC plugin
*/
void
irc_info_init ()
{
/* irc info hooks */
weechat_hook_info ("irc_is_channel", &irc_info_get_info_cb, NULL);
weechat_hook_info ("irc_nick_from_host", &irc_info_get_info_cb, NULL);
weechat_hook_info ("irc_buffer", &irc_info_get_info_cb, NULL);
/* irc infolist hooks */
weechat_hook_infolist ("irc_server", &irc_info_get_infolist_cb, NULL);
weechat_hook_infolist ("irc_channel", &irc_info_get_infolist_cb, NULL);
weechat_hook_infolist ("irc_nick", &irc_info_get_infolist_cb, NULL);
}

View File

@ -0,0 +1,25 @@
/*
* Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org>
* See README for License detail, AUTHORS for developers list.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __WEECHAT_IRC_INFO_H
#define __WEECHAT_IRC_INFO_H 1
extern void irc_info_init ();
#endif /* irc-info.h */

View File

@ -32,6 +32,30 @@
#include "irc-channel.h"
/*
* irc_nick_valid: check if a nick pointer exists for a channel
* return 1 if nick exists
* 0 if nick is not found
*/
int
irc_nick_valid (struct t_irc_channel *channel, struct t_irc_nick *nick)
{
struct t_irc_nick *ptr_nick;
if (!channel)
return 0;
for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
{
if (ptr_nick == nick)
return 1;
}
/* nick not found */
return 0;
}
/*
* irc_nick_find_color: find a color for a nick (according to nick letters)
*/

View File

@ -56,6 +56,8 @@ struct t_irc_nick
struct t_irc_nick *next_nick; /* link to next nick on channel */
};
extern int irc_nick_valid (struct t_irc_channel *channel,
struct t_irc_nick *nick);
extern struct t_irc_nick *irc_nick_new (struct t_irc_server *server,
struct t_irc_channel *channel,
const char *nick_name, int is_chanowner,

View File

@ -53,6 +53,9 @@ irc_protocol_get_nick_from_host (const char *host)
static char nick[128];
char *pos;
if (!host)
return NULL;
nick[0] = '\0';
if (host)
{
@ -1004,8 +1007,8 @@ irc_protocol_reply_version (struct t_irc_server *server,
pos = NULL;
}
version = weechat_info_get ("version");
date = weechat_info_get ("date");
version = weechat_info_get ("version", "");
date = weechat_info_get ("date", "");
if (version && date)
{
irc_server_sendf (server,
@ -4168,6 +4171,9 @@ irc_protocol_recv_command (struct t_irc_server *server, const char *entire_line,
weechat_prefix ("error"), entire_line);
}
/* send signal with received command */
irc_server_send_signal (server, "irc_in2", command, entire_line);
if (irc_message)
free (irc_message);
if (nick)

View File

@ -55,6 +55,7 @@ struct t_irc_protocol_msg
t_irc_recv_func *recv_function; /* function called when msg is received */
};
extern char *irc_protocol_get_nick_from_host (const char *host);
extern void irc_protocol_recv_command (struct t_irc_server *server,
const char *entire_line,
const char *host, const char *command,

View File

@ -48,6 +48,31 @@ struct t_irc_message *irc_recv_msgq = NULL;
struct t_irc_message *irc_msgq_last_msg = NULL;
/*
* irc_server_valid: check if a server pointer exists
* return 1 if server exists
* 0 if server is not found
*/
int
irc_server_valid (struct t_irc_server *server)
{
struct t_irc_server *ptr_server;
if (!server)
return 0;
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
{
if (ptr_server == server)
return 1;
}
/* server not found */
return 0;
}
/*
* irc_server_get_name_without_port: get name of server without port
* (ends before first '/' if found)
@ -351,6 +376,7 @@ irc_server_init (struct t_irc_server *server)
server->outqueue = NULL;
server->last_outqueue = NULL;
server->buffer = NULL;
server->buffer_as_string = NULL;
server->channels = NULL;
server->last_channel = NULL;
@ -727,6 +753,8 @@ irc_server_free_data (struct t_irc_server *server)
irc_server_outqueue_free_all (server);
if (server->channels)
irc_channel_free_all (server);
if (server->buffer_as_string)
free (server->buffer_as_string);
}
/*

View File

@ -112,6 +112,7 @@ struct t_irc_server
struct t_irc_outqueue *outqueue; /* queue for outgoing user msgs */
struct t_irc_outqueue *last_outqueue; /* last outgoing user message */
struct t_gui_buffer *buffer; /* GUI buffer allocated for server */
char *buffer_as_string; /* used to return buffer info */
struct t_irc_channel *channels; /* opened channels on server */
struct t_irc_channel *last_channel; /* last opened channal on server */
struct t_irc_server *prev_server; /* link to previous server */
@ -135,6 +136,7 @@ extern const int gnutls_prot_prio[];
extern struct t_irc_message *irc_recv_msgq, *irc_msgq_last_msg;
extern int irc_server_valid (struct t_irc_server *server);
extern char *irc_server_get_name_without_port (const char *name);
extern void irc_server_new_option (struct t_irc_server *server,
int index_option,

View File

@ -28,6 +28,7 @@
#include "irc-completion.h"
#include "irc-config.h"
#include "irc-debug.h"
#include "irc-info.h"
#include "irc-server.h"
#include "irc-channel.h"
#include "irc-nick.h"
@ -114,6 +115,8 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
irc_command_init ();
irc_info_init ();
/* hook some signals */
irc_debug_init ();
weechat_hook_signal ("quit", &irc_signal_quit_cb, NULL);

View File

@ -200,7 +200,7 @@ logger_create_directory ()
dir1 = weechat_string_replace (logger_option_path, "~", getenv ("HOME"));
if (dir1)
{
weechat_dir = weechat_info_get ("weechat_dir");
weechat_dir = weechat_info_get ("weechat_dir", "");
if (weechat_dir)
{
dir2 = weechat_string_replace (dir1, "%h", weechat_dir);
@ -243,8 +243,8 @@ logger_get_filename (struct t_gui_buffer *buffer)
res = NULL;
dir_separator = weechat_info_get ("dir_separator");
weechat_dir = weechat_info_get ("weechat_dir");
dir_separator = weechat_info_get ("dir_separator", "");
weechat_dir = weechat_info_get ("weechat_dir", "");
log_path = weechat_string_replace (logger_option_path, "~",
getenv ("HOME"));
log_path2 = weechat_string_replace (log_path, "%h", weechat_dir);
@ -340,7 +340,7 @@ logger_write_line (struct t_logger_buffer *logger_buffer,
if (logger_buffer->log_filename)
{
charset = weechat_info_get ("charset_terminal");
charset = weechat_info_get ("charset_terminal", "");
if (!logger_buffer->log_file)
{

View File

@ -258,55 +258,60 @@ plugin_api_command (struct t_weechat_plugin *plugin,
}
/*
* plugin_api_info_get: get info about WeeChat
* plugin_api_info_get_inernal: get info about WeeChat
*/
char *
plugin_api_info_get (struct t_weechat_plugin *plugin, const char *info)
plugin_api_info_get_internal (void *data, const char *info_name,
const char *arguments)
{
time_t inactivity;
static char value[32];
if (!plugin || !info)
/* make C compiler happy */
(void) data;
(void) arguments;
if (!info_name)
return NULL;
if (string_strcasecmp (info, "version") == 0)
if (string_strcasecmp (info_name, "version") == 0)
{
return PACKAGE_VERSION;
}
if (string_strcasecmp (info, "date") == 0)
if (string_strcasecmp (info_name, "date") == 0)
{
return __DATE__;
}
else if (string_strcasecmp (info, "dir_separator") == 0)
else if (string_strcasecmp (info_name, "dir_separator") == 0)
{
return DIR_SEPARATOR;
}
else if (string_strcasecmp (info, "weechat_dir") == 0)
else if (string_strcasecmp (info_name, "weechat_dir") == 0)
{
return weechat_home;
}
else if (string_strcasecmp (info, "weechat_libdir") == 0)
else if (string_strcasecmp (info_name, "weechat_libdir") == 0)
{
return WEECHAT_LIBDIR;
}
else if (string_strcasecmp (info, "weechat_sharedir") == 0)
else if (string_strcasecmp (info_name, "weechat_sharedir") == 0)
{
return WEECHAT_SHAREDIR;
}
else if (string_strcasecmp (info, "weechat_localedir") == 0)
else if (string_strcasecmp (info_name, "weechat_localedir") == 0)
{
return LOCALEDIR;
}
else if (string_strcasecmp (info, "charset_terminal") == 0)
else if (string_strcasecmp (info_name, "charset_terminal") == 0)
{
return weechat_local_charset;
}
else if (string_strcasecmp (info, "charset_internal") == 0)
else if (string_strcasecmp (info_name, "charset_internal") == 0)
{
return WEECHAT_INTERNAL_CHARSET;
}
else if (string_strcasecmp (info, "inactivity") == 0)
else if (string_strcasecmp (info_name, "inactivity") == 0)
{
if (gui_keyboard_last_activity_time == 0)
inactivity = 0;
@ -315,7 +320,7 @@ plugin_api_info_get (struct t_weechat_plugin *plugin, const char *info)
snprintf (value, sizeof (value), "%ld", (long int)inactivity);
return value;
}
else if (string_strcasecmp (info, "filters_enabled") == 0)
else if (string_strcasecmp (info_name, "filters_enabled") == 0)
{
snprintf (value, sizeof (value), "%d", gui_filters_enabled);
return value;
@ -326,23 +331,28 @@ plugin_api_info_get (struct t_weechat_plugin *plugin, const char *info)
}
/*
* plugin_api_infolist_get: get list with infos about WeeChat structures
* plugin_api_infolist_get_internal: get list with infos about WeeChat structures
* WARNING: caller has to free string returned
* by this function after use, with weechat_infolist_free()
* by this function after use, with
* weechat_infolist_free()
*/
struct t_infolist *
plugin_api_infolist_get (const char *name, void *pointer, const char *arguments)
plugin_api_infolist_get_internal (void *data, const char *infolist_name,
void *pointer, const char *arguments)
{
struct t_infolist *ptr_infolist;
struct t_gui_buffer *ptr_buffer;
struct t_gui_line *ptr_line;
struct t_gui_window *ptr_window;
if (!name || !name[0])
/* make C compiler happy */
(void) data;
if (!infolist_name || !infolist_name[0])
return NULL;
if (string_strcasecmp (name, "buffer") == 0)
if (string_strcasecmp (infolist_name, "buffer") == 0)
{
/* invalid buffer pointer ? */
if (pointer && (!gui_buffer_valid (pointer)))
@ -377,7 +387,7 @@ plugin_api_infolist_get (const char *name, void *pointer, const char *arguments)
}
}
}
else if (string_strcasecmp (name, "buffer_lines") == 0)
else if (string_strcasecmp (infolist_name, "buffer_lines") == 0)
{
if (!pointer)
pointer = gui_buffers;
@ -403,7 +413,7 @@ plugin_api_infolist_get (const char *name, void *pointer, const char *arguments)
return ptr_infolist;
}
}
else if (string_strcasecmp (name, "nicklist") == 0)
else if (string_strcasecmp (infolist_name, "nicklist") == 0)
{
/* invalid buffer pointer ? */
if (!pointer || (!gui_buffer_valid (pointer)))
@ -420,7 +430,7 @@ plugin_api_infolist_get (const char *name, void *pointer, const char *arguments)
return ptr_infolist;
}
}
else if (string_strcasecmp (name, "window") == 0)
else if (string_strcasecmp (infolist_name, "window") == 0)
{
/* invalid window pointer ? */
if (pointer && (!gui_window_valid (pointer)))
@ -474,7 +484,7 @@ plugin_api_infolist_get (const char *name, void *pointer, const char *arguments)
}
}
}
else if (string_strcasecmp (name, "option") == 0)
else if (string_strcasecmp (infolist_name, "option") == 0)
{
ptr_infolist = infolist_new ();
if (ptr_infolist)
@ -487,7 +497,7 @@ plugin_api_infolist_get (const char *name, void *pointer, const char *arguments)
return ptr_infolist;
}
}
else if (string_strcasecmp (name, "hook") == 0)
else if (string_strcasecmp (infolist_name, "hook") == 0)
{
ptr_infolist = infolist_new ();
if (ptr_infolist)
@ -637,3 +647,33 @@ plugin_api_infolist_free (struct t_infolist *infolist)
if (infolist && infolist_valid (infolist))
infolist_free (infolist);
}
/*
* plugin_api_init: init plugin API
*/
void
plugin_api_init ()
{
/* WeeChat core info hooks */
hook_info (NULL, "version", &plugin_api_info_get_internal, NULL);
hook_info (NULL, "date", &plugin_api_info_get_internal, NULL);
hook_info (NULL, "dir_separator", &plugin_api_info_get_internal, NULL);
hook_info (NULL, "weechat_dir", &plugin_api_info_get_internal, NULL);
hook_info (NULL, "weechat_libdir", &plugin_api_info_get_internal, NULL);
hook_info (NULL, "weechat_sharedir", &plugin_api_info_get_internal, NULL);
hook_info (NULL, "weechat_localedir", &plugin_api_info_get_internal, NULL);
hook_info (NULL, "charset_terminal", &plugin_api_info_get_internal, NULL);
hook_info (NULL, "charset_internal", &plugin_api_info_get_internal, NULL);
hook_info (NULL, "inactivity", &plugin_api_info_get_internal, NULL);
hook_info (NULL, "filters_enabled", &plugin_api_info_get_internal, NULL);
/* WeeChat core infolist hooks */
hook_infolist (NULL, "buffer", &plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "buffer_lines", &plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "buffer", &plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "nicklist", &plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "window", &plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "option", &plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "hook", &plugin_api_infolist_get_internal, NULL);
}

View File

@ -68,5 +68,6 @@ extern void *plugin_api_infolist_buffer (struct t_infolist *infolist,
extern time_t plugin_api_infolist_time (struct t_infolist *infolist,
const char *var);
extern void plugin_api_infolist_free (struct t_infolist *infolist);
extern void plugin_api_init ();
#endif /* plugin-api.h */

View File

@ -386,6 +386,8 @@ plugin_load (const char *filename)
new_plugin->hook_completion_list_add = &hook_completion_list_add;
new_plugin->hook_modifier = &hook_modifier;
new_plugin->hook_modifier_exec = &hook_modifier_exec;
new_plugin->hook_info = &hook_info;
new_plugin->hook_infolist = &hook_infolist;
new_plugin->unhook = &unhook;
new_plugin->unhook_all = &unhook_all_plugin;
@ -421,7 +423,7 @@ plugin_load (const char *filename)
new_plugin->network_pass_proxy = &network_pass_proxy;
new_plugin->network_connect_to = &network_connect_to;
new_plugin->info_get = &plugin_api_info_get;
new_plugin->info_get = &hook_info_get;
new_plugin->infolist_new = &infolist_new;
new_plugin->infolist_new_item = &infolist_new_item;
@ -430,7 +432,7 @@ plugin_load (const char *filename)
new_plugin->infolist_new_var_pointer = &infolist_new_var_pointer;
new_plugin->infolist_new_var_buffer = &infolist_new_var_buffer;
new_plugin->infolist_new_var_time = &infolist_new_var_time;
new_plugin->infolist_get = &plugin_api_infolist_get;
new_plugin->infolist_get = &hook_infolist_get;
new_plugin->infolist_next = &plugin_api_infolist_next;
new_plugin->infolist_prev = &plugin_api_infolist_prev;
new_plugin->infolist_reset_item_cursor = &plugin_api_infolist_reset_item_cursor;
@ -806,6 +808,9 @@ plugin_init (int auto_load, int argc, char *argv[])
plugin_argc = argc;
plugin_argv = argv;
/* init plugin API (create some hooks) */
plugin_api_init ();
/* read plugins options on disk */
plugin_config_init ();
plugin_config_read ();

View File

@ -3075,6 +3075,145 @@ weechat_lua_api_hook_modifier_exec (lua_State *L)
LUA_RETURN_STRING_FREE(result);
}
/*
* weechat_lua_api_hook_info_cb: callback for info hooked
*/
char *
weechat_lua_api_hook_info_cb (void *data, const char *info_name,
const char *arguments)
{
struct t_script_callback *script_callback;
char *lua_argv[3];
script_callback = (struct t_script_callback *)data;
lua_argv[0] = (char *)info_name;
lua_argv[1] = (char *)arguments;
lua_argv[2] = NULL;
return (char *)weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
lua_argv);
}
/*
* weechat_lua_api_hook_info: hook an info
*/
static int
weechat_lua_api_hook_info (lua_State *L)
{
const char *info_name, *function;
char *result;
int n;
/* make C compiler happy */
(void) L;
if (!lua_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("hook_info");
LUA_RETURN_EMPTY;
}
info_name = NULL;
function = NULL;
n = lua_gettop (lua_current_interpreter);
if (n < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("hook_info");
LUA_RETURN_EMPTY;
}
info_name = lua_tostring (lua_current_interpreter, -2);
function = lua_tostring (lua_current_interpreter, -1);
result = script_ptr2str (script_api_hook_info (weechat_lua_plugin,
lua_current_script,
info_name,
&weechat_lua_api_hook_info_cb,
function));
LUA_RETURN_STRING_FREE(result);
}
/*
* weechat_lua_api_hook_infolist_cb: callback for infolist hooked
*/
struct t_infolist *
weechat_lua_api_hook_infolist_cb (void *data, const char *info_name,
void *pointer, const char *arguments)
{
struct t_script_callback *script_callback;
char *lua_argv[4];
struct t_infolist *value;
script_callback = (struct t_script_callback *)data;
lua_argv[0] = (char *)info_name;
lua_argv[1] = script_ptr2str (pointer);
lua_argv[2] = (char *)arguments;
lua_argv[3] = NULL;
value = (struct t_infolist *)weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
lua_argv);
if (lua_argv[1])
free (lua_argv[1]);
return value;
}
/*
* weechat_lua_api_hook_infolist: hook an infolist
*/
static int
weechat_lua_api_hook_infolist (lua_State *L)
{
const char *infolist_name, *function;
char *result;
int n;
/* make C compiler happy */
(void) L;
if (!lua_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("hook_infolist");
LUA_RETURN_EMPTY;
}
infolist_name = NULL;
function = NULL;
n = lua_gettop (lua_current_interpreter);
if (n < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("hook_infolist");
LUA_RETURN_EMPTY;
}
infolist_name = lua_tostring (lua_current_interpreter, -2);
function = lua_tostring (lua_current_interpreter, -1);
result = script_ptr2str (script_api_hook_infolist (weechat_lua_plugin,
lua_current_script,
infolist_name,
&weechat_lua_api_hook_infolist_cb,
function));
LUA_RETURN_STRING_FREE(result);
}
/*
* weechat_lua_api_unhook: unhook something
*/
@ -4308,7 +4447,7 @@ weechat_lua_api_command (lua_State *L)
static int
weechat_lua_api_info_get (lua_State *L)
{
const char *info;
const char *info_name, *arguments;
char *value;
int n;
@ -4321,19 +4460,21 @@ weechat_lua_api_info_get (lua_State *L)
LUA_RETURN_EMPTY;
}
info = NULL;
info_name = NULL;
arguments = NULL;
n = lua_gettop (lua_current_interpreter);
if (n < 1)
if (n < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("info_get");
LUA_RETURN_EMPTY;
}
info = lua_tostring (lua_current_interpreter, -1);
info_name = lua_tostring (lua_current_interpreter, -2);
arguments = lua_tostring (lua_current_interpreter, -1);
value = weechat_info_get (info);
value = weechat_info_get (info_name, arguments);
LUA_RETURN_STRING(value);
}
@ -5017,6 +5158,8 @@ const struct luaL_reg weechat_lua_api_funcs[] = {
{ "hook_completion_list_add", &weechat_lua_api_hook_completion_list_add },
{ "hook_modifier", &weechat_lua_api_hook_modifier },
{ "hook_modifier_exec", &weechat_lua_api_hook_modifier_exec },
{ "hook_info", &weechat_lua_api_hook_info },
{ "hook_infolist", &weechat_lua_api_hook_infolist },
{ "unhook", &weechat_lua_api_unhook },
{ "unhook_all", &weechat_lua_api_unhook_all },
{ "buffer_new", &weechat_lua_api_buffer_new },

View File

@ -2568,6 +2568,129 @@ static XS (XS_weechat_hook_modifier_exec)
PERL_RETURN_STRING_FREE(result);
}
/*
* weechat_perl_api_hook_info_cb: callback for info hooked
*/
char *
weechat_perl_api_hook_info_cb (void *data, const char *info_name,
const char *arguments)
{
struct t_script_callback *script_callback;
char *perl_argv[3];
script_callback = (struct t_script_callback *)data;
perl_argv[0] = (char *)info_name;
perl_argv[1] = (char *)arguments;
perl_argv[2] = NULL;
return (char *)weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
perl_argv);
}
/*
* weechat::hook_info: hook an info
*/
static XS (XS_weechat_hook_info)
{
char *result, *info_name, *perl_fn;
dXSARGS;
/* make C compiler happy */
(void) cv;
if (!perl_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("hook_info");
PERL_RETURN_EMPTY;
}
if (items < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("hook_info");
PERL_RETURN_EMPTY;
}
info_name = SvPV (ST (0), PL_na);
perl_fn = SvPV (ST (1), PL_na);
result = script_ptr2str (script_api_hook_info (weechat_perl_plugin,
perl_current_script,
info_name,
&weechat_perl_api_hook_info_cb,
perl_fn));
PERL_RETURN_STRING_FREE(result);
}
/*
* weechat_perl_api_hook_infolist_cb: callback for infolist hooked
*/
struct t_infolist *
weechat_perl_api_hook_infolist_cb (void *data, const char *infolist_name,
void *pointer, const char *arguments)
{
struct t_script_callback *script_callback;
char *perl_argv[4];
struct t_infolist *value;
script_callback = (struct t_script_callback *)data;
perl_argv[0] = (char *)infolist_name;
perl_argv[1] = script_ptr2str (pointer);
perl_argv[2] = (char *)arguments;
perl_argv[3] = NULL;
value = (struct t_infolist *)weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
perl_argv);
if (perl_argv[1])
free (perl_argv[1]);
return value;
}
/*
* weechat::hook_infolist: hook an infolist
*/
static XS (XS_weechat_hook_infolist)
{
char *result, *infolist_name, *perl_fn;
dXSARGS;
/* make C compiler happy */
(void) cv;
if (!perl_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("hook_infolist");
PERL_RETURN_EMPTY;
}
if (items < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("hook_infolist");
PERL_RETURN_EMPTY;
}
infolist_name = SvPV (ST (0), PL_na);
perl_fn = SvPV (ST (1), PL_na);
result = script_ptr2str (script_api_hook_infolist (weechat_perl_plugin,
perl_current_script,
infolist_name,
&weechat_perl_api_hook_infolist_cb,
perl_fn));
PERL_RETURN_STRING_FREE(result);
}
/*
* weechat::unhook: unhook something
*/
@ -3578,13 +3701,14 @@ static XS (XS_weechat_info_get)
PERL_RETURN_EMPTY;
}
if (items < 1)
if (items < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("info_get");
PERL_RETURN_EMPTY;
}
value = weechat_info_get (SvPV (ST (0), PL_na));
value = weechat_info_get (SvPV (ST (0), PL_na),
SvPV (ST (1), PL_na));
PERL_RETURN_STRING(value);
}
@ -3940,6 +4064,8 @@ weechat_perl_api_init (pTHX)
newXS ("weechat::hook_completion_list_add", XS_weechat_hook_completion_list_add, "weechat");
newXS ("weechat::hook_modifier", XS_weechat_hook_modifier, "weechat");
newXS ("weechat::hook_modifier_exec", XS_weechat_hook_modifier_exec, "weechat");
newXS ("weechat::hook_info", XS_weechat_hook_info, "weechat");
newXS ("weechat::hook_infolist", XS_weechat_hook_infolist, "weechat");
newXS ("weechat::unhook", XS_weechat_unhook, "weechat");
newXS ("weechat::unhook_all", XS_weechat_unhook_all, "weechat");
newXS ("weechat::buffer_new", XS_weechat_buffer_new, "weechat");

View File

@ -2724,6 +2724,133 @@ weechat_python_api_hook_modifier_exec (PyObject *self, PyObject *args)
PYTHON_RETURN_STRING_FREE(result);
}
/*
* weechat_python_api_hook_info_cb: callback for info hooked
*/
char *
weechat_python_api_hook_info_cb (void *data, const char *info_name,
const char *arguments)
{
struct t_script_callback *script_callback;
char *python_argv[3];
script_callback = (struct t_script_callback *)data;
python_argv[0] = (char *)info_name;
python_argv[1] = (char *)arguments;
python_argv[2] = NULL;
return (char *)weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
python_argv);
}
/*
* weechat_python_api_hook_info: hook an info
*/
static PyObject *
weechat_python_api_hook_info (PyObject *self, PyObject *args)
{
char *info_name, *function, *result;
PyObject *object;
/* make C compiler happy */
(void) self;
if (!python_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("hook_info");
PYTHON_RETURN_EMPTY;
}
info_name = NULL;
function = NULL;
if (!PyArg_ParseTuple (args, "ss", &info_name, &function))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("hook_info");
PYTHON_RETURN_EMPTY;
}
result = script_ptr2str(script_api_hook_info (weechat_python_plugin,
python_current_script,
info_name,
&weechat_python_api_hook_info_cb,
function));
PYTHON_RETURN_STRING_FREE(result);
}
/*
* weechat_python_api_hook_infolist_cb: callback for infolist hooked
*/
struct t_infolist *
weechat_python_api_hook_infolist_cb (void *data, const char *infolist_name,
void *pointer, const char *arguments)
{
struct t_script_callback *script_callback;
char *python_argv[4];
struct t_infolist *value;
script_callback = (struct t_script_callback *)data;
python_argv[0] = (char *)infolist_name;
python_argv[1] = script_ptr2str (pointer);
python_argv[2] = (char *)arguments;
python_argv[3] = NULL;
value = (struct t_infolist *)weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
python_argv);
if (python_argv[1])
free (python_argv[1]);
return value;
}
/*
* weechat_python_api_hook_infolist: hook an infolist
*/
static PyObject *
weechat_python_api_hook_infolist (PyObject *self, PyObject *args)
{
char *infolist_name, *function, *result;
PyObject *object;
/* make C compiler happy */
(void) self;
if (!python_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("hook_infolist");
PYTHON_RETURN_EMPTY;
}
infolist_name = NULL;
function = NULL;
if (!PyArg_ParseTuple (args, "ss", &infolist_name, &function))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("hook_infolist");
PYTHON_RETURN_EMPTY;
}
result = script_ptr2str(script_api_hook_infolist (weechat_python_plugin,
python_current_script,
infolist_name,
&weechat_python_api_hook_infolist_cb,
function));
PYTHON_RETURN_STRING_FREE(result);
}
/*
* weechat_python_api_unhook: unhook something
*/
@ -3794,7 +3921,7 @@ weechat_python_api_command (PyObject *self, PyObject *args)
static PyObject *
weechat_python_api_info_get (PyObject *self, PyObject *args)
{
char *info, *value;
char *info_name, *arguments, *value;
/* make C compiler happy */
(void) self;
@ -3805,15 +3932,15 @@ weechat_python_api_info_get (PyObject *self, PyObject *args)
PYTHON_RETURN_EMPTY;
}
info = NULL;
info_name = NULL;
if (!PyArg_ParseTuple (args, "s", &info))
if (!PyArg_ParseTuple (args, "ss", &info_name, &arguments))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("info_get");
PYTHON_RETURN_EMPTY;
}
value = weechat_info_get (info);
value = weechat_info_get (info_name, arguments);
PYTHON_RETURN_STRING(value);
}
@ -4184,6 +4311,8 @@ PyMethodDef weechat_python_funcs[] =
{ "hook_completion_list_add", &weechat_python_api_hook_completion_list_add, METH_VARARGS, "" },
{ "hook_modifier", &weechat_python_api_hook_modifier, METH_VARARGS, "" },
{ "hook_modifier_exec", &weechat_python_api_hook_modifier_exec, METH_VARARGS, "" },
{ "hook_info", &weechat_python_api_hook_info, METH_VARARGS, "" },
{ "hook_infolist", &weechat_python_api_hook_infolist, METH_VARARGS, "" },
{ "unhook", &weechat_python_api_unhook, METH_VARARGS, "" },
{ "unhook_all", &weechat_python_api_unhook_all, METH_VARARGS, "" },
{ "buffer_new", &weechat_python_api_buffer_new, METH_VARARGS, "" },

View File

@ -314,7 +314,7 @@ weechat_python_load (const char *filename)
/* adding $weechat_dir/python in $PYTHONPATH */
python_path = PySys_GetObject ("path");
w_home = weechat_info_get ("weechat_dir");
w_home = weechat_info_get ("weechat_dir", "");
if (w_home)
{
len = strlen (w_home) + 1 + strlen("python") + 1;

View File

@ -3134,6 +3134,145 @@ weechat_ruby_api_hook_modifier_exec (VALUE class, VALUE modifier,
RUBY_RETURN_STRING_FREE(result);
}
/*
* weechat_ruby_api_hook_info_cb: callback for info hooked
*/
char *
weechat_ruby_api_hook_info_cb (void *data, const char *info_name,
const char *arguments)
{
struct t_script_callback *script_callback;
char *ruby_argv[3];
script_callback = (struct t_script_callback *)data;
ruby_argv[0] = (char *)info_name;
ruby_argv[1] = (char *)arguments;
ruby_argv[2] = NULL;
return (char *)weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
ruby_argv);
}
/*
* weechat_ruby_api_hook_info: hook an info
*/
static VALUE
weechat_ruby_api_hook_info (VALUE class, VALUE info_name, VALUE function)
{
char *c_info_name, *c_function, *result;
VALUE return_value;
/* make C compiler happy */
(void) class;
if (!ruby_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("hook_info");
RUBY_RETURN_EMPTY;
}
c_info_name = NULL;
c_function = NULL;
if (NIL_P (info_name) || NIL_P (function))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("hook_info");
RUBY_RETURN_EMPTY;
}
Check_Type (info_name, T_STRING);
Check_Type (function, T_STRING);
c_info_name = STR2CSTR (info_name);
c_function = STR2CSTR (function);
result = script_ptr2str (script_api_hook_info (weechat_ruby_plugin,
ruby_current_script,
c_info_name,
&weechat_ruby_api_hook_info_cb,
c_function));
RUBY_RETURN_STRING_FREE(result);
}
/*
* weechat_ruby_api_hook_infolist_cb: callback for infolist hooked
*/
struct t_infolist *
weechat_ruby_api_hook_infolist_cb (void *data, const char *infolist_name,
void *pointer, const char *arguments)
{
struct t_script_callback *script_callback;
char *ruby_argv[4];
struct t_infolist *value;
script_callback = (struct t_script_callback *)data;
ruby_argv[0] = (char *)infolist_name;
ruby_argv[1] = script_ptr2str (pointer);
ruby_argv[2] = (char *)arguments;
ruby_argv[3] = NULL;
value = (struct t_infolist *)weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_STRING,
script_callback->function,
ruby_argv);
if (ruby_argv[1])
free (ruby_argv[1]);
return value;
}
/*
* weechat_ruby_api_hook_infolist: hook an infolist
*/
static VALUE
weechat_ruby_api_hook_infolist (VALUE class, VALUE infolist_name, VALUE function)
{
char *c_infolist_name, *c_function, *result;
VALUE return_value;
/* make C compiler happy */
(void) class;
if (!ruby_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("hook_infolist");
RUBY_RETURN_EMPTY;
}
c_infolist_name = NULL;
c_function = NULL;
if (NIL_P (infolist_name) || NIL_P (function))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("hook_infolist");
RUBY_RETURN_EMPTY;
}
Check_Type (infolist_name, T_STRING);
Check_Type (function, T_STRING);
c_infolist_name = STR2CSTR (infolist_name);
c_function = STR2CSTR (function);
result = script_ptr2str (script_api_hook_infolist (weechat_ruby_plugin,
ruby_current_script,
c_infolist_name,
&weechat_ruby_api_hook_infolist_cb,
c_function));
RUBY_RETURN_STRING_FREE(result);
}
/*
* weechat_ruby_api_unhook: unhook something
*/
@ -4376,9 +4515,9 @@ weechat_ruby_api_command (VALUE class, VALUE buffer, VALUE command)
*/
static VALUE
weechat_ruby_api_info_get (VALUE class, VALUE info)
weechat_ruby_api_info_get (VALUE class, VALUE info_name, VALUE arguments)
{
char *c_info, *value;
char *c_info_name, *c_arguments, *value;
/* make C compiler happy */
(void) class;
@ -4389,17 +4528,19 @@ weechat_ruby_api_info_get (VALUE class, VALUE info)
RUBY_RETURN_EMPTY;
}
if (NIL_P (info))
if (NIL_P (info_name) || NIL_P (arguments))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("info_get");
RUBY_RETURN_EMPTY;
}
Check_Type (info, T_STRING);
Check_Type (info_name, T_STRING);
Check_Type (arguments, T_STRING);
c_info = STR2CSTR (info);
c_info_name = STR2CSTR (info_name);
c_arguments = STR2CSTR (arguments);
value = weechat_info_get (c_info);
value = weechat_info_get (c_info_name, c_arguments);
RUBY_RETURN_STRING(value);
}
@ -4823,6 +4964,8 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
rb_define_module_function (ruby_mWeechat, "hook_completion_list_add", &weechat_ruby_api_hook_completion_list_add, 4);
rb_define_module_function (ruby_mWeechat, "hook_modifier", &weechat_ruby_api_hook_modifier, 2);
rb_define_module_function (ruby_mWeechat, "hook_modifier_exec", &weechat_ruby_api_hook_modifier_exec, 3);
rb_define_module_function (ruby_mWeechat, "hook_info", &weechat_ruby_api_hook_info, 2);
rb_define_module_function (ruby_mWeechat, "hook_infolist", &weechat_ruby_api_hook_infolist, 2);
rb_define_module_function (ruby_mWeechat, "unhook", &weechat_ruby_api_unhook, 1);
rb_define_module_function (ruby_mWeechat, "unhook_all", &weechat_ruby_api_unhook_all, 0);
rb_define_module_function (ruby_mWeechat, "buffer_new", &weechat_ruby_api_buffer_new, 4);
@ -4850,7 +4993,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
rb_define_module_function (ruby_mWeechat, "bar_update", &weechat_ruby_api_bar_update, 1);
rb_define_module_function (ruby_mWeechat, "bar_remove", &weechat_ruby_api_bar_remove, 1);
rb_define_module_function (ruby_mWeechat, "command", &weechat_ruby_api_command, 2);
rb_define_module_function (ruby_mWeechat, "info_get", &weechat_ruby_api_info_get, 1);
rb_define_module_function (ruby_mWeechat, "info_get", &weechat_ruby_api_info_get, 2);
rb_define_module_function (ruby_mWeechat, "infolist_get", &weechat_ruby_api_infolist_get, 3);
rb_define_module_function (ruby_mWeechat, "infolist_next", &weechat_ruby_api_infolist_next, 1);
rb_define_module_function (ruby_mWeechat, "infolist_prev", &weechat_ruby_api_infolist_prev, 1);

View File

@ -875,6 +875,84 @@ script_api_hook_modifier (struct t_weechat_plugin *weechat_plugin,
return new_hook;
}
/*
* script_api_hook_info: hook an info
* return new hook, NULL if error
*/
struct t_hook *
script_api_hook_info (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *info_name,
char *(*callback)(void *data,
const char *info_name,
const char *arguments),
const char *function)
{
struct t_script_callback *new_script_callback;
struct t_hook *new_hook;
new_script_callback = script_callback_alloc ();
if (!new_script_callback)
return NULL;
new_hook = weechat_hook_info (info_name, callback, new_script_callback);
if (!new_hook)
{
script_callback_free_data (new_script_callback);
free (new_script_callback);
return NULL;
}
new_script_callback->script = script;
new_script_callback->function = strdup (function);
new_script_callback->hook = new_hook;
script_callback_add (script, new_script_callback);
return new_hook;
}
/*
* script_api_hook_infolist: hook an infolist
* return new hook, NULL if error
*/
struct t_hook *
script_api_hook_infolist (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *infolist_name,
struct t_infolist *(*callback)(void *data,
const char *infolist_name,
void *pointer,
const char *arguments),
const char *function)
{
struct t_script_callback *new_script_callback;
struct t_hook *new_hook;
new_script_callback = script_callback_alloc ();
if (!new_script_callback)
return NULL;
new_hook = weechat_hook_infolist (infolist_name,
callback, new_script_callback);
if (!new_hook)
{
script_callback_free_data (new_script_callback);
free (new_script_callback);
return NULL;
}
new_script_callback->script = script;
new_script_callback->function = strdup (function);
new_script_callback->hook = new_hook;
script_callback_add (script, new_script_callback);
return new_hook;
}
/*
* script_api_unhook: unhook something
*/

View File

@ -150,6 +150,21 @@ extern struct t_hook *script_api_hook_modifier (struct t_weechat_plugin *weechat
const char *modifier_data,
const char *string),
const char *function);
extern struct t_hook *script_api_hook_info (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *info_name,
char *(*callback)(void *data,
const char *info_name,
const char *arguments),
const char *function);
extern struct t_hook *script_api_hook_infolist (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *infolist_name,
struct t_infolist *(*callback)(void *data,
const char *infolist_name,
void *pointer,
const char *arguments),
const char *function);
extern void script_api_unhook (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_hook *hook);

View File

@ -214,7 +214,7 @@ script_auto_load (struct t_weechat_plugin *weechat_plugin,
int dir_length;
/* build directory, adding WeeChat home */
dir_home = weechat_info_get ("weechat_dir");
dir_home = weechat_info_get ("weechat_dir", "");
if (!dir_home)
return;
dir_length = strlen (dir_home) + strlen (weechat_plugin->name) + 16;
@ -277,7 +277,7 @@ script_search_full_name (struct t_weechat_plugin *weechat_plugin,
return NULL;
}
dir_home = weechat_info_get ("weechat_dir");
dir_home = weechat_info_get ("weechat_dir", "");
if (dir_home)
{
/* try WeeChat user's autoload dir */
@ -321,7 +321,7 @@ script_search_full_name (struct t_weechat_plugin *weechat_plugin,
}
/* try WeeChat system dir */
dir_system = weechat_info_get ("weechat_sharedir");
dir_system = weechat_info_get ("weechat_sharedir", "");
if (dir_system)
{
length = strlen (dir_system) + strlen (weechat_plugin->name) +

View File

@ -28,6 +28,7 @@ struct t_gui_buffer;
struct t_gui_bar;
struct t_gui_bar_item;
struct t_gui_completion;
struct t_infolist;
struct t_weelist;
/* macros for defining plugin infos */
@ -367,6 +368,19 @@ struct t_weechat_plugin
char *(*hook_modifier_exec) (struct t_weechat_plugin *plugin,
const char *modifier, const char *modifier_data,
const char *string);
struct t_hook *(*hook_info) (struct t_weechat_plugin *plugin,
const char *info_name,
char *(*callback)(void *data,
const char *info_name,
const char *arguments),
void *callback_data);
struct t_hook *(*hook_infolist) (struct t_weechat_plugin *plugin,
const char *infolist_name,
struct t_infolist *(*callback)(void *data,
const char *infolist_name,
void *pointer,
const char *arguments),
void *callback_data);
void (*unhook) (struct t_hook *hook);
void (*unhook_all) (struct t_weechat_plugin *plugin);
@ -453,7 +467,8 @@ struct t_weechat_plugin
int (*network_connect_to) (int sock, unsigned long address, int port);
/* infos */
char *(*info_get) (struct t_weechat_plugin *plugin, const char *info);
char *(*info_get) (struct t_weechat_plugin *plugin, const char *info_name,
const char *arguments);
/* infolists */
struct t_infolist *(*infolist_new) ();
@ -474,7 +489,9 @@ struct t_weechat_plugin
struct t_infolist_var *(*infolist_new_var_time) (struct t_infolist_item *item,
const char *name,
time_t time);
struct t_infolist *(*infolist_get) (const char *name, void *pointer,
struct t_infolist *(*infolist_get) (struct t_weechat_plugin *plugin,
const char *infolist_name,
void *pointer,
const char *arguments);
int (*infolist_next) (struct t_infolist *infolist);
int (*infolist_prev) (struct t_infolist *infolist);
@ -720,10 +737,8 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
weechat_plugin->config_string(__option)
#define weechat_config_color(__option) \
weechat_plugin->config_color(__option)
#define weechat_config_write_line(__config, __option, \
__value...) \
weechat_plugin->config_write_line(__config, __option, \
##__value)
#define weechat_config_write_line(__config, __option, __value...) \
weechat_plugin->config_write_line(__config, __option, ##__value)
#define weechat_config_write(__config) \
weechat_plugin->config_write(__config)
#define weechat_config_read(__config) \
@ -743,7 +758,8 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
#define weechat_config_get_plugin(__option) \
weechat_plugin->config_get_plugin(weechat_plugin, __option)
#define weechat_config_set_plugin(__option, __value) \
weechat_plugin->config_set_plugin(weechat_plugin, __option, __value)
weechat_plugin->config_set_plugin(weechat_plugin, __option, \
__value)
/* display */
#define weechat_prefix(__prefix) \
@ -772,9 +788,9 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
#define weechat_hook_command(__command, __description, __args, \
__args_desc, __completion, __callback, \
__data) \
weechat_plugin->hook_command(weechat_plugin, __command, __description, \
__args, __args_desc, __completion, \
__callback, __data)
weechat_plugin->hook_command(weechat_plugin, __command, \
__description, __args, __args_desc, \
__completion, __callback, __data)
#define weechat_hook_timer(__interval, __align_second, __max_calls, \
__callback, __data) \
weechat_plugin->hook_timer(weechat_plugin, __interval, \
@ -820,6 +836,12 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
__string) \
weechat_plugin->hook_modifier_exec(weechat_plugin, __modifier, \
__modifier_data, __string)
#define weechat_hook_info(__info_name, __callback, __data) \
weechat_plugin->hook_info(weechat_plugin, __info_name, \
__callback, __data)
#define weechat_hook_infolist(__infolist_name, __callback, __data) \
weechat_plugin->hook_infolist(weechat_plugin, __infolist_name, \
__callback, __data)
#define weechat_unhook(__hook) \
weechat_plugin->unhook( __hook)
#define weechat_unhook_all() \
@ -860,10 +882,11 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
#define weechat_nicklist_add_nick(__buffer, __group, __name, __color, \
__prefix, __prefix_color, __visible) \
weechat_plugin->nicklist_add_nick(__buffer, __group, __name, \
__color, __prefix, __prefix_color, \
__visible)
__color, __prefix, \
__prefix_color, __visible)
#define weechat_nicklist_search_nick(__buffer, __from_group, __name) \
weechat_plugin->nicklist_search_nick(__buffer, __from_group, __name)
weechat_plugin->nicklist_search_nick(__buffer, __from_group, \
__name)
#define weechat_nicklist_remove_group(__buffer, __group) \
weechat_plugin->nicklist_remove_group(__buffer, __group)
#define weechat_nicklist_remove_nick(__buffer, __nick) \
@ -912,8 +935,8 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
weechat_plugin->network_connect_to(__sock, __address, __port)
/* infos */
#define weechat_info_get(__name) \
weechat_plugin->info_get(weechat_plugin, __name)
#define weechat_info_get(__info_name, __arguments) \
weechat_plugin->info_get(weechat_plugin, __info_name, __arguments)
/* infolists */
#define weechat_infolist_new() \
@ -932,8 +955,9 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
__size)
#define weechat_infolist_new_var_time(__item, __name, __time) \
weechat_plugin->infolist_new_var_time(__item, __name, __time)
#define weechat_infolist_get(__name, __pointer, __arguments) \
weechat_plugin->infolist_get(__name, __pointer, __arguments)
#define weechat_infolist_get(__infolist_name, __pointer, __arguments) \
weechat_plugin->infolist_get(weechat_plugin, __infolist_name, \
__pointer, __arguments)
#define weechat_infolist_next(__list) \
weechat_plugin->infolist_next(__list)
#define weechat_infolist_prev(__list) \

View File

@ -87,7 +87,7 @@ xfer_file_find_filename (struct t_xfer *xfer)
if (!dir1)
return;
weechat_home = weechat_info_get ("weechat_dir");
weechat_home = weechat_info_get ("weechat_dir", "");
if (!weechat_home)
{
free (dir1);
@ -107,7 +107,7 @@ xfer_file_find_filename (struct t_xfer *xfer)
return;
strcpy (xfer->local_filename, dir2);
dir_separator = weechat_info_get("dir_separator");
dir_separator = weechat_info_get("dir_separator", "");
if (dir_separator
&& (xfer->local_filename[strlen (xfer->local_filename) - 1] != dir_separator[0]))
strcat (xfer->local_filename, dir_separator);

View File

@ -104,7 +104,7 @@ xfer_create_directories ()
char *weechat_dir, *dir1, *dir2;
/* create download directory */
weechat_dir = weechat_info_get ("weechat_dir");
weechat_dir = weechat_info_get ("weechat_dir", "");
if (weechat_dir)
{
dir1 = weechat_string_replace (weechat_config_string (xfer_config_file_download_path),
@ -754,7 +754,7 @@ xfer_add_cb (void *data, const char *signal, const char *type_data, void *signal
return WEECHAT_RC_ERROR;
}
weechat_dir = weechat_info_get ("weechat_dir");
weechat_dir = weechat_info_get ("weechat_dir", "");
dir2 = weechat_string_replace (dir1, "%h", weechat_dir);
if (!dir2)
{