Added tags for lines and custom filtering by tags or regex (task #7674), fixed many memory leaks

v2.8-utf8proc
Sebastien Helleu 2008-03-22 23:36:12 +01:00
parent 8c4dc57d8e
commit 61ca929728
73 changed files with 4824 additions and 2603 deletions

View File

@ -1,10 +1,11 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
ChangeLog - 2008-03-05
ChangeLog - 2008-03-22
Version 0.2.7 (under dev!):
* added tags for lines and custom filtering by tags or regex (task #7674)
* added custom bars, with custom items
* command /whois is now authorized in private without argument (task #7482)
* removed kernel info in CTCP VERSION reply (IRC plugin) (task #7494)

View File

@ -62,6 +62,8 @@
./src/gui/gui-color.h
./src/gui/gui-completion.c
./src/gui/gui-completion.h
./src/gui/gui-filter.c
./src/gui/gui-filter.h
./src/gui/gui-history.c
./src/gui/gui-history.h
./src/gui/gui-hotlist.c

148
po/cs.po
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-15 09:33+0100\n"
"POT-Creation-Date: 2008-03-22 23:32+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"
@ -206,6 +206,56 @@ msgstr "(hotlist: zvýraznění + zprávy)\n"
msgid "(hotlist: highlights + messages + join/part (all))"
msgstr "(hotlist: zvýrazění + zprávy + připojení/odpojení (vše))\n"
#, fuzzy
msgid "Filters are enabled"
msgstr "uživatel byl zablokován"
#, fuzzy
msgid "Filters are disabled"
msgstr "uživatel byl zablokován"
msgid "Message filters:"
msgstr ""
#, fuzzy, c-format
msgid " %s[%s%d%s]%s buffer: %s%s%s / tags: %s / regex: %s"
msgstr " (není obsluhovač zprávy)\n"
#, fuzzy
msgid "No message filter defined"
msgstr "Žádné aliasy nejsou definovány.\n"
msgid "Filters enabled"
msgstr ""
#, fuzzy
msgid "Filters disabled"
msgstr "uživatel byl zablokován"
#, fuzzy, c-format
msgid "%sError: filter already exists"
msgstr "%s ignorování již existuje\n"
#, c-format
msgid "%sError: you must specify at least tag(s) or regex for filter"
msgstr ""
#, fuzzy
msgid "Filter added"
msgstr "uživatel byl zablokován"
#, fuzzy
msgid "Filter deleted"
msgstr "uživatel byl zablokován"
#, fuzzy, c-format
msgid "%sError: filter not found"
msgstr "%s plugin \"%s\" nenalezen\n"
#, fuzzy, c-format
msgid "%sError: wrong filter number"
msgstr "%s nekorektní číslo bufferu\n"
#. TRANSLATORS: %s is "WeeChat"
#, fuzzy, c-format
msgid "%s internal commands:"
@ -595,6 +645,30 @@ msgstr ""
"příkaz: příkaz, který spustit ('/' je automaticky dodáno, pokud není "
"nalezeno na začátku příkazu)\n"
msgid ""
"filter messages in buffers, to hide/show them according to tags or regex"
msgstr ""
msgid ""
"[list] | [enable|disable|toggle] | [add buffer tags regex] | [del number]"
msgstr ""
msgid ""
" list: list all filters\n"
" enable: enable filters (filters are enabled by default)\n"
"disable: disable filters\n"
" toggle: toggle filters\n"
" add: add a filter\n"
" del: delete a filter\n"
" number: number of filter to delete (look at list to find it)\n"
" buffer: buffer where filter is active: it may be a name (category.name) or "
"\"*\" for all buffers\n"
" tags: comma separated list of tags, for example: \"irc_join,irc_part,"
"irc_quit\"\n"
" regex: regular expression to search in line (use \t to separate prefix "
"from message)"
msgstr ""
msgid "display help about commands"
msgstr "zobrazí nápovědu k příkazům"
@ -1482,10 +1556,6 @@ msgstr " . hodnoty: mezi %d a %d\n"
msgid " . description: %s\n"
msgstr " . popis: %s\n"
#, fuzzy, c-format
msgid "%sError: command \"%s\" failed"
msgstr "%s příkaz \"%s\" selhal\n"
#, fuzzy, c-format
msgid "%sError: unknown command \"%s\" (type /help for help)"
msgstr "%s alias nebo příkaz \"%s\" nenalezen\n"
@ -1562,6 +1632,14 @@ msgstr "-VÍCE-"
msgid "server"
msgstr "server"
#, fuzzy, c-format
msgid "%s[%sF%s%s%s]"
msgstr "%s[%s%s%s]%s nečinný: "
#, fuzzy
msgid "filtered"
msgstr "uživatel byl zablokován"
#, fuzzy
msgid "(MORE)"
msgstr "-VÍCE-"
@ -3546,7 +3624,7 @@ msgid "%sUser mode for %s%s%s is %s[%s%s%s]"
msgstr "Uživatelský mód pro %s%s%s je %s[%s%s%s]\n"
#, fuzzy, c-format
msgid "%s%s%s%s is away: %s"
msgid "%s%s[%s%s%s]%s is away: %s"
msgstr "%s%s%s je pryč: %s\n"
#, fuzzy, c-format
@ -3608,29 +3686,17 @@ msgstr "Téma nastevil %s%s%s, %s"
msgid "%s%s%s%s has invited %s%s%s on %s%s"
msgstr "%s%s%s pozval %s%s%s na %s%s\n"
#, fuzzy, c-format
msgid "%s%s: cannot identify channel for \"%s\" command"
msgstr "%s nemohu identifikovat kanál pro příkaz \"%s\"\n"
#, fuzzy, c-format
msgid "%s%s: cannot identify nickname for \"%s\" command"
msgstr "%s nemohu identifikovat přezdívku pro příkaz \"%s\"\n"
#, fuzzy, c-format
msgid "%sChannel reop %s%s%s: %s%s"
msgstr "Reop kanálu %s%s%s: %s%s\n"
#, fuzzy, c-format
msgid "%s%s[%s%s%s]%s exception %s%s%s"
msgid "%s%s[%s%s%s]%s exception %s%s%s by %s%s %s(%s%s%s)%s on %s"
msgstr "%s[%s%s%s] %s%s%s takázaný\n"
#, c-format
msgid " by %s%s %s(%s%s%s)"
msgstr " od %s%s %s(%s%s%s)"
#, c-format
msgid " by %s%s"
msgstr " od %s%s"
#, fuzzy, c-format
msgid "%s%s[%s%s%s]%s exception %s%s"
msgstr "%s[%s%s%s] %s%s%s takázaný\n"
#, fuzzy, c-format
msgid "%s%s: cannot create nick \"%s\" for channel \"%s\""
@ -3674,12 +3740,12 @@ msgid "normal"
msgstr "normální"
#, fuzzy, c-format
msgid "%s%s[%s%s%s] %s%s%s banned by "
msgid "%s%s[%s%s%s] %s%s%s banned by %s%s %s(%s%s%s)%s on %s"
msgstr "%s[%s%s%s] %s%s%s zakázal "
#, fuzzy, c-format
msgid "%s%s[%s%s%s] %s%s%s banned"
msgstr "%s[%s%s%s] %s%s%s takázaný\n"
msgid "%s%s[%s%s%s] %s%s%s banned by %s%s %s(%s%s%s)"
msgstr "%s[%s%s%s] %s%s%s zakázal "
#, fuzzy, c-format
msgid ""
@ -4423,6 +4489,32 @@ msgstr ""
msgid "%s%s: wrong arguments for function \"%s\""
msgstr "%s špatné parametry pro příkaz \"%s\"\n"
#, fuzzy
#~ msgid "%sError: wrong number \"%s\" for filter"
#~ msgstr "%s špatný počet parametrů pro příkaz \"%s\"\n"
#, fuzzy
#~ msgid "%sError: command \"%s\" failed"
#~ msgstr "%s příkaz \"%s\" selhal\n"
#, fuzzy
#~ msgid "%s%s: cannot identify channel for \"%s\" command"
#~ msgstr "%s nemohu identifikovat kanál pro příkaz \"%s\"\n"
#, fuzzy
#~ msgid "%s%s: cannot identify nickname for \"%s\" command"
#~ msgstr "%s nemohu identifikovat přezdívku pro příkaz \"%s\"\n"
#~ msgid " by %s%s %s(%s%s%s)"
#~ msgstr " od %s%s %s(%s%s%s)"
#~ msgid " by %s%s"
#~ msgstr " od %s%s"
#, fuzzy
#~ msgid "%s%s[%s%s%s] %s%s%s banned"
#~ msgstr "%s[%s%s%s] %s%s%s takázaný\n"
#~ msgid "/list end"
#~ msgstr "/list konec"
@ -4959,9 +5051,6 @@ msgstr "%s špatné parametry pro příkaz \"%s\"\n"
#~ msgid "%s cannot create new private window \"%s\"\n"
#~ msgstr "%s nemohu vytvořít nové soukromé okno\"%s\"\n"
#~ msgid "%s[%s%s%s]%s idle: "
#~ msgstr "%s[%s%s%s]%s nečinný: "
#~ msgid "%s: trying 2nd nickname \"%s\"\n"
#~ msgstr "%s: zkouším druhou přezdívku \"%s\"\n"
@ -5400,9 +5489,6 @@ msgstr "%s špatné parametry pro příkaz \"%s\"\n"
#~ msgstr ""
#~ "%s maska nebo typ/příkaz by neměla být obecná hodnota pro ignorování\n"
#~ msgid "%s ignore already exists\n"
#~ msgstr "%s ignorování již existuje\n"
#~ msgid "%s not enough memory to create ignore\n"
#~ msgstr "%s nedostatek paměti pro vytvoření ignorování\n"

148
po/de.po
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-15 09:33+0100\n"
"POT-Creation-Date: 2008-03-22 23:32+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"
@ -211,6 +211,56 @@ msgstr "(Hotlist: Hervorhebungen und Nachrichten)\n"
msgid "(hotlist: highlights + messages + join/part (all))"
msgstr "(Hotlist: Hervorhebungen, Nachrichten, Betreten und Verlassen)\n"
#, fuzzy
msgid "Filters are enabled"
msgstr "/users wurde deaktiviert"
#, fuzzy
msgid "Filters are disabled"
msgstr "/users wurde deaktiviert"
msgid "Message filters:"
msgstr ""
#, fuzzy, c-format
msgid " %s[%s%d%s]%s buffer: %s%s%s / tags: %s / regex: %s"
msgstr " (kein Message-Handler)\n"
#, fuzzy
msgid "No message filter defined"
msgstr "Keine Aliases definiert.\n"
msgid "Filters enabled"
msgstr ""
#, fuzzy
msgid "Filters disabled"
msgstr "/users wurde deaktiviert"
#, fuzzy, c-format
msgid "%sError: filter already exists"
msgstr "%s diese /ignore-Regel existiert bereits\n"
#, c-format
msgid "%sError: you must specify at least tag(s) or regex for filter"
msgstr ""
#, fuzzy
msgid "Filter added"
msgstr "/users wurde deaktiviert"
#, fuzzy
msgid "Filter deleted"
msgstr "/users wurde deaktiviert"
#, fuzzy, c-format
msgid "%sError: filter not found"
msgstr "%s Plugin \"%s\" nicht gefunden\n"
#, fuzzy, c-format
msgid "%sError: wrong filter number"
msgstr "%s falsche Puffernummer\n"
#. TRANSLATORS: %s is "WeeChat"
#, fuzzy, c-format
msgid "%s internal commands:"
@ -587,6 +637,30 @@ msgstr ""
"Befehl: auszuführender Befehl (falls nicht vorhanden wird automatisch ein "
"'/' vorangestellt)\n"
msgid ""
"filter messages in buffers, to hide/show them according to tags or regex"
msgstr ""
msgid ""
"[list] | [enable|disable|toggle] | [add buffer tags regex] | [del number]"
msgstr ""
msgid ""
" list: list all filters\n"
" enable: enable filters (filters are enabled by default)\n"
"disable: disable filters\n"
" toggle: toggle filters\n"
" add: add a filter\n"
" del: delete a filter\n"
" number: number of filter to delete (look at list to find it)\n"
" buffer: buffer where filter is active: it may be a name (category.name) or "
"\"*\" for all buffers\n"
" tags: comma separated list of tags, for example: \"irc_join,irc_part,"
"irc_quit\"\n"
" regex: regular expression to search in line (use \t to separate prefix "
"from message)"
msgstr ""
msgid "display help about commands"
msgstr "Hilfe zu Befehlen abfragen"
@ -1476,10 +1550,6 @@ msgstr " . Werte: zwischen %d und %d\n"
msgid " . description: %s\n"
msgstr " . Beschreibung: %s\n"
#, fuzzy, c-format
msgid "%sError: command \"%s\" failed"
msgstr "%s der Befehl \"%s\" schlug fehl\n"
#, fuzzy, c-format
msgid "%sError: unknown command \"%s\" (type /help for help)"
msgstr "%s Alias oder Befehl \"%s\" nicht gefunden\n"
@ -1562,6 +1632,14 @@ msgstr "-MEHR-"
msgid "server"
msgstr "Server"
#, fuzzy, c-format
msgid "%s[%sF%s%s%s]"
msgstr "%s[%s%s%s]%s idlet: "
#, fuzzy
msgid "filtered"
msgstr "/users wurde deaktiviert"
#, fuzzy
msgid "(MORE)"
msgstr "-MEHR-"
@ -3534,7 +3612,7 @@ msgid "%sUser mode for %s%s%s is %s[%s%s%s]"
msgstr "Usermodus für %s%s%s ist %s[%s%s%s]\n"
#, fuzzy, c-format
msgid "%s%s%s%s is away: %s"
msgid "%s%s[%s%s%s]%s is away: %s"
msgstr "%s%s%s ist abwesend: %s\n"
#, fuzzy, c-format
@ -3596,29 +3674,17 @@ msgstr "Topic gesetzt von %s%s%s, %s"
msgid "%s%s%s%s has invited %s%s%s on %s%s"
msgstr "%s%s%s hat %s%s%s in den Channel %s%s eingeladen\n"
#, fuzzy, c-format
msgid "%s%s: cannot identify channel for \"%s\" command"
msgstr "%s kann für den \"%s\"-Befehl keinen Channel identifizieren\n"
#, fuzzy, c-format
msgid "%s%s: cannot identify nickname for \"%s\" command"
msgstr "%s kann für den \"%s\"-Befehl keinen Nickname identifizieren\n"
#, fuzzy, c-format
msgid "%sChannel reop %s%s%s: %s%s"
msgstr "Channel-Reop %s%s%s: %s%s\n"
#, fuzzy, c-format
msgid "%s%s[%s%s%s]%s exception %s%s%s"
msgid "%s%s[%s%s%s]%s exception %s%s%s by %s%s %s(%s%s%s)%s on %s"
msgstr "%s[%s%s%s] %s%s%s gebannt\n"
#, c-format
msgid " by %s%s %s(%s%s%s)"
msgstr " durch %s%s %s(%s%s%s)"
#, c-format
msgid " by %s%s"
msgstr " durch %s%s"
#, fuzzy, c-format
msgid "%s%s[%s%s%s]%s exception %s%s"
msgstr "%s[%s%s%s] %s%s%s gebannt\n"
#, fuzzy, c-format
msgid "%s%s: cannot create nick \"%s\" for channel \"%s\""
@ -3662,12 +3728,12 @@ msgid "normal"
msgstr "normal"
#, fuzzy, c-format
msgid "%s%s[%s%s%s] %s%s%s banned by "
msgid "%s%s[%s%s%s] %s%s%s banned by %s%s %s(%s%s%s)%s on %s"
msgstr "%s[%s%s%s] %s%s%s wurde gebannt von "
#, fuzzy, c-format
msgid "%s%s[%s%s%s] %s%s%s banned"
msgstr "%s[%s%s%s] %s%s%s gebannt\n"
msgid "%s%s[%s%s%s] %s%s%s banned by %s%s %s(%s%s%s)"
msgstr "%s[%s%s%s] %s%s%s wurde gebannt von "
#, fuzzy, c-format
msgid ""
@ -4415,6 +4481,32 @@ msgstr ""
msgid "%s%s: wrong arguments for function \"%s\""
msgstr "%s fehlerhafte Argumente für der \"%s\"-Befehl\n"
#, fuzzy
#~ msgid "%sError: wrong number \"%s\" for filter"
#~ msgstr "%s fehlerhafte Anzahl von Argumenten für der \"%s\"-Befehl\n"
#, fuzzy
#~ msgid "%sError: command \"%s\" failed"
#~ msgstr "%s der Befehl \"%s\" schlug fehl\n"
#, fuzzy
#~ msgid "%s%s: cannot identify channel for \"%s\" command"
#~ msgstr "%s kann für den \"%s\"-Befehl keinen Channel identifizieren\n"
#, fuzzy
#~ msgid "%s%s: cannot identify nickname for \"%s\" command"
#~ msgstr "%s kann für den \"%s\"-Befehl keinen Nickname identifizieren\n"
#~ msgid " by %s%s %s(%s%s%s)"
#~ msgstr " durch %s%s %s(%s%s%s)"
#~ msgid " by %s%s"
#~ msgstr " durch %s%s"
#, fuzzy
#~ msgid "%s%s[%s%s%s] %s%s%s banned"
#~ msgstr "%s[%s%s%s] %s%s%s gebannt\n"
#~ msgid "/list end"
#~ msgstr "Ende von /list"
@ -4954,9 +5046,6 @@ msgstr "%s fehlerhafte Argumente für der \"%s\"-Befehl\n"
#~ msgid "%s cannot create new private window \"%s\"\n"
#~ msgstr "%s kann kein neues privates Fenster \"%s\" erzeugen\n"
#~ msgid "%s[%s%s%s]%s idle: "
#~ msgstr "%s[%s%s%s]%s idlet: "
#~ msgid "%s: trying 2nd nickname \"%s\"\n"
#~ msgstr "%s: versuche zweiten Nicknamen \"%s\"\n"
@ -5400,9 +5489,6 @@ msgstr "%s fehlerhafte Argumente für der \"%s\"-Befehl\n"
#~ msgid "%s mask or type/command should be non generic value for ignore\n"
#~ msgstr "%s Maske und Typ/Befehl dürfen nicht beide allgemein sein\n"
#~ msgid "%s ignore already exists\n"
#~ msgstr "%s diese /ignore-Regel existiert bereits\n"
#~ msgid "%s not enough memory to create ignore\n"
#~ msgstr "%s nicht genug Speicher für neue /ignore-Regel\n"

146
po/es.po
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-15 09:33+0100\n"
"POT-Creation-Date: 2008-03-22 23:32+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"
@ -207,6 +207,56 @@ msgstr "(hotlist: resaltados + mensajes)\n"
msgid "(hotlist: highlights + messages + join/part (all))"
msgstr "(hotlist: resaltados + mensajes + join/part (todos))\n"
#, fuzzy
msgid "Filters are enabled"
msgstr "los usuarios han sido desactivados"
#, fuzzy
msgid "Filters are disabled"
msgstr "los usuarios han sido desactivados"
msgid "Message filters:"
msgstr ""
#, fuzzy, c-format
msgid " %s[%s%d%s]%s buffer: %s%s%s / tags: %s / regex: %s"
msgstr " (sin manejador de mensaje)\n"
#, fuzzy
msgid "No message filter defined"
msgstr "Ningún alias definido.\n"
msgid "Filters enabled"
msgstr ""
#, fuzzy
msgid "Filters disabled"
msgstr "los usuarios han sido desactivados"
#, fuzzy, c-format
msgid "%sError: filter already exists"
msgstr "el ignore %s ya existe\n"
#, c-format
msgid "%sError: you must specify at least tag(s) or regex for filter"
msgstr ""
#, fuzzy
msgid "Filter added"
msgstr "los usuarios han sido desactivados"
#, fuzzy
msgid "Filter deleted"
msgstr "los usuarios han sido desactivados"
#, fuzzy, c-format
msgid "%sError: filter not found"
msgstr "%s plugin \"%s\" no encontrado\n"
#, fuzzy, c-format
msgid "%sError: wrong filter number"
msgstr "%s número de búfer incorrecto\n"
#. TRANSLATORS: %s is "WeeChat"
#, fuzzy, c-format
msgid "%s internal commands:"
@ -584,6 +634,30 @@ msgstr ""
"comando: comando a ejecutar (se añade un '/' automáticamente si no se "
"encuentra al principio del comando)\n"
msgid ""
"filter messages in buffers, to hide/show them according to tags or regex"
msgstr ""
msgid ""
"[list] | [enable|disable|toggle] | [add buffer tags regex] | [del number]"
msgstr ""
msgid ""
" list: list all filters\n"
" enable: enable filters (filters are enabled by default)\n"
"disable: disable filters\n"
" toggle: toggle filters\n"
" add: add a filter\n"
" del: delete a filter\n"
" number: number of filter to delete (look at list to find it)\n"
" buffer: buffer where filter is active: it may be a name (category.name) or "
"\"*\" for all buffers\n"
" tags: comma separated list of tags, for example: \"irc_join,irc_part,"
"irc_quit\"\n"
" regex: regular expression to search in line (use \t to separate prefix "
"from message)"
msgstr ""
msgid "display help about commands"
msgstr "mostrar ayuda sobre los comandos"
@ -1470,10 +1544,6 @@ msgstr " . valores: entre %d y %d\n"
msgid " . description: %s\n"
msgstr " . descripción: %s\n"
#, fuzzy, c-format
msgid "%sError: command \"%s\" failed"
msgstr "%s el comando \"%s\" ha fallado\n"
#, fuzzy, c-format
msgid "%sError: unknown command \"%s\" (type /help for help)"
msgstr "%s alias o comando \"%s\" no encontrado\n"
@ -1549,6 +1619,14 @@ msgstr "-MÁS-"
msgid "server"
msgstr "servidor"
#, fuzzy, c-format
msgid "%s[%sF%s%s%s]"
msgstr "%s[%s%s%s]%s inactividad: "
#, fuzzy
msgid "filtered"
msgstr "los usuarios han sido desactivados"
#, fuzzy
msgid "(MORE)"
msgstr "-MÁS-"
@ -3538,7 +3616,7 @@ msgid "%sUser mode for %s%s%s is %s[%s%s%s]"
msgstr "Modo de usuario %s[%s%s%s/%s%s%s]\n"
#, fuzzy, c-format
msgid "%s%s%s%s is away: %s"
msgid "%s%s[%s%s%s]%s is away: %s"
msgstr "%s%s%s está ausente: %s\n"
#, fuzzy, c-format
@ -3600,30 +3678,17 @@ msgstr "Tema establecido por %s%s%s, %s"
msgid "%s%s%s%s has invited %s%s%s on %s%s"
msgstr "%s%s%s ha invitado a %s%s%s en %s%s\n"
#, fuzzy, c-format
msgid "%s%s: cannot identify channel for \"%s\" command"
msgstr "%s no es posible identificar el canal para el comando \"%s\"\n"
#, fuzzy, c-format
msgid "%s%s: cannot identify nickname for \"%s\" command"
msgstr ""
"%s no es posible determinar el nombre de usuario para el comando \"%s\"\n"
#, fuzzy, c-format
msgid "%sChannel reop %s%s%s: %s%s"
msgstr "reop canal %s%s%s: %s%s\n"
#, fuzzy, c-format
msgid "%s%s[%s%s%s]%s exception %s%s%s"
msgid "%s%s[%s%s%s]%s exception %s%s%s by %s%s %s(%s%s%s)%s on %s"
msgstr "%s[%s%s%s] %s%s%s baneado\n"
#, fuzzy, c-format
msgid " by %s%s %s(%s%s%s)"
msgstr "%s%s %s(%s%s%s)%s ha salido"
#, c-format
msgid " by %s%s"
msgstr ""
msgid "%s%s[%s%s%s]%s exception %s%s"
msgstr "%s[%s%s%s] %s%s%s baneado\n"
#, fuzzy, c-format
msgid "%s%s: cannot create nick \"%s\" for channel \"%s\""
@ -3667,12 +3732,12 @@ msgid "normal"
msgstr "normal"
#, fuzzy, c-format
msgid "%s%s[%s%s%s] %s%s%s banned by "
msgid "%s%s[%s%s%s] %s%s%s banned by %s%s %s(%s%s%s)%s on %s"
msgstr "%s[%s%s%s] %s%s%s baneado por "
#, fuzzy, c-format
msgid "%s%s[%s%s%s] %s%s%s banned"
msgstr "%s[%s%s%s] %s%s%s baneado\n"
msgid "%s%s[%s%s%s] %s%s%s banned by %s%s %s(%s%s%s)"
msgstr "%s[%s%s%s] %s%s%s baneado por "
#, fuzzy, c-format
msgid ""
@ -4428,6 +4493,31 @@ msgstr ""
msgid "%s%s: wrong arguments for function \"%s\""
msgstr "%s argumentos incorrectos para el comando \"%s\"\n"
#, fuzzy
#~ msgid "%sError: wrong number \"%s\" for filter"
#~ msgstr "%s número de argumentos incorrecto para el comando \"%s\"\n"
#, fuzzy
#~ msgid "%sError: command \"%s\" failed"
#~ msgstr "%s el comando \"%s\" ha fallado\n"
#, fuzzy
#~ msgid "%s%s: cannot identify channel for \"%s\" command"
#~ msgstr "%s no es posible identificar el canal para el comando \"%s\"\n"
#, fuzzy
#~ msgid "%s%s: cannot identify nickname for \"%s\" command"
#~ msgstr ""
#~ "%s no es posible determinar el nombre de usuario para el comando \"%s\"\n"
#, fuzzy
#~ msgid " by %s%s %s(%s%s%s)"
#~ msgstr "%s%s %s(%s%s%s)%s ha salido"
#, fuzzy
#~ msgid "%s%s[%s%s%s] %s%s%s banned"
#~ msgstr "%s[%s%s%s] %s%s%s baneado\n"
#~ msgid "/list end"
#~ msgstr "/list fin"
@ -4963,9 +5053,6 @@ msgstr "%s argumentos incorrectos para el comando \"%s\"\n"
#~ msgid "%s cannot create new private window \"%s\"\n"
#~ msgstr "%s no es posible crear una nueva ventana privada \"%s\"\n"
#~ msgid "%s[%s%s%s]%s idle: "
#~ msgstr "%s[%s%s%s]%s inactividad: "
#, fuzzy
#~ msgid "%s: trying 2nd nickname \"%s\"\n"
#~ msgstr ""
@ -5436,9 +5523,6 @@ msgstr "%s argumentos incorrectos para el comando \"%s\"\n"
#~ "%s máscara o tipo/comando debería ser un valor no genérico para el "
#~ "ignore\n"
#~ msgid "%s ignore already exists\n"
#~ msgstr "el ignore %s ya existe\n"
#~ msgid "%s not enough memory to create ignore\n"
#~ msgstr "%s no hay suficiente memoria para crear el ignore\n"

152
po/fr.po
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-15 09:33+0100\n"
"PO-Revision-Date: 2008-03-15 09:34+0100\n"
"POT-Creation-Date: 2008-03-22 23:32+0100\n"
"PO-Revision-Date: 2008-03-22 23:33+0100\n"
"Last-Translator: FlashCode <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"MIME-Version: 1.0\n"
@ -194,6 +194,52 @@ msgstr "(hotlist: highlights + messages)"
msgid "(hotlist: highlights + messages + join/part (all))"
msgstr "(hotlist: highlights + messages + join/part (tous))"
msgid "Filters are enabled"
msgstr "Les filtres sont activés"
msgid "Filters are disabled"
msgstr "Les filtres sont désactivés"
msgid "Message filters:"
msgstr "Filtres de messages:"
#, c-format
msgid " %s[%s%d%s]%s buffer: %s%s%s / tags: %s / regex: %s"
msgstr " %s[%s%d%s]%s tampon: %s%s%s / tags: %s / regex: %s"
msgid "No message filter defined"
msgstr "Pas de filtre de message défini"
msgid "Filters enabled"
msgstr "Filtres activés"
msgid "Filters disabled"
msgstr "Filtres désactivés"
#, c-format
msgid "%sError: filter already exists"
msgstr "%sErreur: le filtre existe déjà"
#, c-format
msgid "%sError: you must specify at least tag(s) or regex for filter"
msgstr ""
"%sErreur: vous devez spécifier au moins un/plusieurs tags(s) ou une "
"expression régulière pour filtrer"
msgid "Filter added"
msgstr "Filtre ajouté"
msgid "Filter deleted"
msgstr "Filtre supprimé"
#, c-format
msgid "%sError: filter not found"
msgstr "%sErreur: filtre non trouvé"
#, c-format
msgid "%sError: wrong filter number"
msgstr "%sErreur: numéro de filtre incorrect"
#. TRANSLATORS: %s is "WeeChat"
#, c-format
msgid "%s internal commands:"
@ -565,6 +611,43 @@ msgstr ""
"commande: commande à exécuter (un '/' est automatiquement ajouté s'il n'est "
"pas trouvé au début de la commande)"
msgid ""
"filter messages in buffers, to hide/show them according to tags or regex"
msgstr ""
"filtre les messages dans les tampons, pour les cacher/afficher selon des "
"tags ou expressions régulières"
msgid ""
"[list] | [enable|disable|toggle] | [add buffer tags regex] | [del number]"
msgstr ""
"[list] | [enable|disable|toggle] | [add buffer tags regex] | [del numéro]"
msgid ""
" list: list all filters\n"
" enable: enable filters (filters are enabled by default)\n"
"disable: disable filters\n"
" toggle: toggle filters\n"
" add: add a filter\n"
" del: delete a filter\n"
" number: number of filter to delete (look at list to find it)\n"
" buffer: buffer where filter is active: it may be a name (category.name) or "
"\"*\" for all buffers\n"
" tags: comma separated list of tags, for example: \"irc_join,irc_part,"
"irc_quit\"\n"
" regex: regular expression to search in line (use \t to separate prefix "
"from message)"
msgstr ""
" list: liste tous les filtres\n"
" enable: active les filtres (par défaut les filtres sont activés)\n"
"disable: désactive les filtres\n"
" 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)"
msgid "display help about commands"
msgstr "afficher l'aide sur les commandes"
@ -1391,10 +1474,6 @@ msgstr " . valeurs: couleur (dépend de l'interface utilisée)\n"
msgid " . description: %s\n"
msgstr " . description: %s\n"
#, c-format
msgid "%sError: command \"%s\" failed"
msgstr "%sErreur: la commande \"%s\" a échoué"
#, c-format
msgid "%sError: unknown command \"%s\" (type /help for help)"
msgstr "%sErreur: commande \"%s\" inconnue (tapez /help pour l'aide)"
@ -1475,6 +1554,13 @@ msgstr "-PLUS-"
msgid "server"
msgstr "serveur"
#, c-format
msgid "%s[%sF%s%s%s]"
msgstr "%s[%sF%s%s%s]"
msgid "filtered"
msgstr "filtré"
msgid "(MORE)"
msgstr "(PLUS)"
@ -3468,8 +3554,8 @@ msgid "%sUser mode for %s%s%s is %s[%s%s%s]"
msgstr "%sMode utilisateur pour %s%s%s est %s[%s%s%s]"
#, c-format
msgid "%s%s%s%s is away: %s"
msgstr "%s%s%s%s est absent: %s"
msgid "%s%s[%s%s%s]%s is away: %s"
msgstr "%s%s[%s%s%s]%s est absent: %s"
#, c-format
msgid "%sUsers online: %s%s"
@ -3532,29 +3618,17 @@ msgstr "%sTitre pour %s%s%s défini par %s%s%s le %s"
msgid "%s%s%s%s has invited %s%s%s on %s%s"
msgstr "%s%s%s%s a invité %s%s%s sur %s%s"
#, c-format
msgid "%s%s: cannot identify channel for \"%s\" command"
msgstr "%s%s: impossible de déterminer le canal pour la commande \"%s\""
#, c-format
msgid "%s%s: cannot identify nickname for \"%s\" command"
msgstr "%s%s: impossible de déterminer le pseudo pour la commande \"%s\""
#, c-format
msgid "%sChannel reop %s%s%s: %s%s"
msgstr "%sReop canal %s%s%s: %s%s"
#, c-format
msgid "%s%s[%s%s%s]%s exception %s%s%s"
msgstr "%s%s[%s%s%s]%s exception %s%s%s"
msgid "%s%s[%s%s%s]%s exception %s%s%s by %s%s %s(%s%s%s)%s on %s"
msgstr "%s%s[%s%s%s]%s exception %s%s%s par %s%s %s(%s%s%s)%s le %s"
#, c-format
msgid " by %s%s %s(%s%s%s)"
msgstr " par %s%s %s(%s%s%s)"
#, c-format
msgid " by %s%s"
msgstr " par %s%s"
msgid "%s%s[%s%s%s]%s exception %s%s"
msgstr "%s%s[%s%s%s]%s exception %s%s"
#, c-format
msgid "%s%s: cannot create nick \"%s\" for channel \"%s\""
@ -3598,12 +3672,12 @@ msgid "normal"
msgstr "normal"
#, c-format
msgid "%s%s[%s%s%s] %s%s%s banned by "
msgstr "%s%s[%s%s%s] %s%s%s banni par "
msgid "%s%s[%s%s%s] %s%s%s banned by %s%s %s(%s%s%s)%s on %s"
msgstr "%s%s[%s%s%s] %s%s%s banni par %s%s %s(%s%s%s)%s le %s"
#, c-format
msgid "%s%s[%s%s%s] %s%s%s banned"
msgstr "%s%s[%s%s%s] %s%s%s banni"
msgid "%s%s[%s%s%s] %s%s%s banned by %s%s %s(%s%s%s)"
msgstr "%s%s[%s%s%s] %s%s%s banni par %s%s %s(%s%s%s)"
#, c-format
msgid ""
@ -3698,7 +3772,6 @@ msgstr "/list début"
msgid "channel (for /list)"
msgstr "canal (pour /list)"
#, fuzzy
msgid "end of /list"
msgstr "fin de /list"
@ -4369,6 +4442,27 @@ msgstr ""
msgid "%s%s: wrong arguments for function \"%s\""
msgstr "%s%s: paramètres invalides pour la fonction \"%s\""
#~ msgid "%s[%sfiltered%s]"
#~ msgstr "%s[%sfiltré%s]"
#~ msgid "%sError: wrong number \"%s\" for filter"
#~ msgstr "%sErreur: numéro de filtre erroné"
#~ msgid "%sError: command \"%s\" failed"
#~ msgstr "%sErreur: la commande \"%s\" a échoué"
#~ msgid "%s%s: cannot identify channel for \"%s\" command"
#~ msgstr "%s%s: impossible de déterminer le canal pour la commande \"%s\""
#~ msgid "%s%s: cannot identify nickname for \"%s\" command"
#~ msgstr "%s%s: impossible de déterminer le pseudo pour la commande \"%s\""
#~ msgid " by %s%s"
#~ msgstr " par %s%s"
#~ msgid "%s%s[%s%s%s] %s%s%s banned"
#~ msgstr "%s%s[%s%s%s] %s%s%s banni"
#~ msgid "/list end"
#~ msgstr "/list fin"

148
po/hu.po
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-15 09:33+0100\n"
"POT-Creation-Date: 2008-03-22 23:32+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"
@ -210,6 +210,56 @@ msgstr ""
msgid "(hotlist: highlights + messages + join/part (all))"
msgstr ""
#, fuzzy
msgid "Filters are enabled"
msgstr "a felhasználók le lettek tiltva"
#, fuzzy
msgid "Filters are disabled"
msgstr "a felhasználók le lettek tiltva"
msgid "Message filters:"
msgstr ""
#, fuzzy, c-format
msgid " %s[%s%d%s]%s buffer: %s%s%s / tags: %s / regex: %s"
msgstr " (nincs üzenetkezelő)\n"
#, fuzzy
msgid "No message filter defined"
msgstr "Nincs aliasz definiálva.\n"
msgid "Filters enabled"
msgstr ""
#, fuzzy
msgid "Filters disabled"
msgstr "a felhasználók le lettek tiltva"
#, fuzzy, c-format
msgid "%sError: filter already exists"
msgstr "%s az ignore már létezik\n"
#, c-format
msgid "%sError: you must specify at least tag(s) or regex for filter"
msgstr ""
#, fuzzy
msgid "Filter added"
msgstr "a felhasználók le lettek tiltva"
#, fuzzy
msgid "Filter deleted"
msgstr "a felhasználók le lettek tiltva"
#, fuzzy, c-format
msgid "%sError: filter not found"
msgstr "%s a \"%s\" modul nem található\n"
#, fuzzy, c-format
msgid "%sError: wrong filter number"
msgstr "%s helytelen pufferszám\n"
#. TRANSLATORS: %s is "WeeChat"
#, fuzzy, c-format
msgid "%s internal commands:"
@ -601,6 +651,30 @@ msgstr ""
"parancs: futtatandó parancs (egy '/' autómatikusan hozzáadódik, ha nincs "
"megadva a parancs elején)\n"
msgid ""
"filter messages in buffers, to hide/show them according to tags or regex"
msgstr ""
msgid ""
"[list] | [enable|disable|toggle] | [add buffer tags regex] | [del number]"
msgstr ""
msgid ""
" list: list all filters\n"
" enable: enable filters (filters are enabled by default)\n"
"disable: disable filters\n"
" toggle: toggle filters\n"
" add: add a filter\n"
" del: delete a filter\n"
" number: number of filter to delete (look at list to find it)\n"
" buffer: buffer where filter is active: it may be a name (category.name) or "
"\"*\" for all buffers\n"
" tags: comma separated list of tags, for example: \"irc_join,irc_part,"
"irc_quit\"\n"
" regex: regular expression to search in line (use \t to separate prefix "
"from message)"
msgstr ""
msgid "display help about commands"
msgstr "segítség megjelenítése a parancsokhoz"
@ -1486,10 +1560,6 @@ msgstr " . értékek: %d és %d között\n"
msgid " . description: %s\n"
msgstr " . leírás : %s\n"
#, fuzzy, c-format
msgid "%sError: command \"%s\" failed"
msgstr "%s a \"%s\" parancs végrehajtása sikertelen\n"
#, fuzzy, c-format
msgid "%sError: unknown command \"%s\" (type /help for help)"
msgstr "%s a \"%s\" aliasz vagy parancs nem található\n"
@ -1567,6 +1637,14 @@ msgstr "-TOVÁBB-"
msgid "server"
msgstr "szerver"
#, fuzzy, c-format
msgid "%s[%sF%s%s%s]"
msgstr "%s[%s%s%s]%s tétlen: "
#, fuzzy
msgid "filtered"
msgstr "a felhasználók le lettek tiltva"
#, fuzzy
msgid "(MORE)"
msgstr "-TOVÁBB-"
@ -3552,7 +3630,7 @@ msgid "%sUser mode for %s%s%s is %s[%s%s%s]"
msgstr "%s%s%s felhasználói módja: %s[%s%s%s]\n"
#, fuzzy, c-format
msgid "%s%s%s%s is away: %s"
msgid "%s%s[%s%s%s]%s is away: %s"
msgstr "%s%s%s távol: %s\n"
#, fuzzy, c-format
@ -3614,29 +3692,17 @@ msgstr "A témát beállította: %s%s%s, %s"
msgid "%s%s%s%s has invited %s%s%s on %s%s"
msgstr "%s%s%s meghívta %s%s%s-t %s%s-kor\n"
#, fuzzy, c-format
msgid "%s%s: cannot identify channel for \"%s\" command"
msgstr "%s nem sikerült azonosítani a szobát a \"%s\" parancshoz\n"
#, fuzzy, c-format
msgid "%s%s: cannot identify nickname for \"%s\" command"
msgstr "%s nem sikerült a felhasználót meghatározni a \"%s\" parancshoz\n"
#, fuzzy, c-format
msgid "%sChannel reop %s%s%s: %s%s"
msgstr "%s szoba: %s> %s"
#, fuzzy, c-format
msgid "%s%s[%s%s%s]%s exception %s%s%s"
msgid "%s%s[%s%s%s]%s exception %s%s%s by %s%s %s(%s%s%s)%s on %s"
msgstr "%s[%s%s%s] %s%s%s kitiltva\n"
#, c-format
msgid " by %s%s %s(%s%s%s)"
msgstr " a következőtől: %s%s %s(%s%s%s)"
#, c-format
msgid " by %s%s"
msgstr " a következőtől: %s%s"
#, fuzzy, c-format
msgid "%s%s[%s%s%s]%s exception %s%s"
msgstr "%s[%s%s%s] %s%s%s kitiltva\n"
#, fuzzy, c-format
msgid "%s%s: cannot create nick \"%s\" for channel \"%s\""
@ -3680,12 +3746,12 @@ msgid "normal"
msgstr "normál"
#, fuzzy, c-format
msgid "%s%s[%s%s%s] %s%s%s banned by "
msgid "%s%s[%s%s%s] %s%s%s banned by %s%s %s(%s%s%s)%s on %s"
msgstr "%s[%s%s%s] %s%s%s-t kitiltotta "
#, fuzzy, c-format
msgid "%s%s[%s%s%s] %s%s%s banned"
msgstr "%s[%s%s%s] %s%s%s kitiltva\n"
msgid "%s%s[%s%s%s] %s%s%s banned by %s%s %s(%s%s%s)"
msgstr "%s[%s%s%s] %s%s%s-t kitiltotta "
#, fuzzy, c-format
msgid ""
@ -4430,6 +4496,32 @@ msgstr ""
msgid "%s%s: wrong arguments for function \"%s\""
msgstr "%s rossz argumentum a \"%s\" parancsnak\n"
#, fuzzy
#~ msgid "%sError: wrong number \"%s\" for filter"
#~ msgstr "%s rossz argumentum szám a \"%s\" parancsnak\n"
#, fuzzy
#~ msgid "%sError: command \"%s\" failed"
#~ msgstr "%s a \"%s\" parancs végrehajtása sikertelen\n"
#, fuzzy
#~ msgid "%s%s: cannot identify channel for \"%s\" command"
#~ msgstr "%s nem sikerült azonosítani a szobát a \"%s\" parancshoz\n"
#, fuzzy
#~ msgid "%s%s: cannot identify nickname for \"%s\" command"
#~ msgstr "%s nem sikerült a felhasználót meghatározni a \"%s\" parancshoz\n"
#~ msgid " by %s%s %s(%s%s%s)"
#~ msgstr " a következőtől: %s%s %s(%s%s%s)"
#~ msgid " by %s%s"
#~ msgstr " a következőtől: %s%s"
#, fuzzy
#~ msgid "%s%s[%s%s%s] %s%s%s banned"
#~ msgstr "%s[%s%s%s] %s%s%s kitiltva\n"
#~ msgid "/list end"
#~ msgstr "/list vége"
@ -4957,9 +5049,6 @@ msgstr "%s rossz argumentum a \"%s\" parancsnak\n"
#~ msgid "%s cannot create new private window \"%s\"\n"
#~ msgstr "%s nem sikerült új privát ablakot nyitni \"%s\"\n"
#~ msgid "%s[%s%s%s]%s idle: "
#~ msgstr "%s[%s%s%s]%s tétlen: "
#~ msgid "%s: trying 2nd nickname \"%s\"\n"
#~ msgstr "%s: próbálom a második nevet: \"%s\"\n"
@ -5400,9 +5489,6 @@ msgstr "%s rossz argumentum a \"%s\" parancsnak\n"
#~ msgid "%s mask or type/command should be non generic value for ignore\n"
#~ msgstr "%s maszk vagy típus/parancs nem általános érték az ignore-hoz\n"
#~ msgid "%s ignore already exists\n"
#~ msgstr "%s az ignore már létezik\n"
#~ msgid "Removing ignore:"
#~ msgstr "Ignore eltávolítása:"

148
po/ru.po
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-15 09:33+0100\n"
"POT-Creation-Date: 2008-03-22 23:32+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"
@ -208,6 +208,56 @@ msgstr "(hotlist: подсвечивание + сообщения)\n"
msgid "(hotlist: highlights + messages + join/part (all))"
msgstr "(хотлист: подсвечивание + сообщения + входы/выходы (всё))\n"
#, fuzzy
msgid "Filters are enabled"
msgstr "команда users отключена"
#, fuzzy
msgid "Filters are disabled"
msgstr "команда users отключена"
msgid "Message filters:"
msgstr ""
#, fuzzy, c-format
msgid " %s[%s%d%s]%s buffer: %s%s%s / tags: %s / regex: %s"
msgstr " (нет обработчика сообщений)\n"
#, fuzzy
msgid "No message filter defined"
msgstr "Сокращения не заданы.\n"
msgid "Filters enabled"
msgstr ""
#, fuzzy
msgid "Filters disabled"
msgstr "команда users отключена"
#, fuzzy, c-format
msgid "%sError: filter already exists"
msgstr "%s игнорирование уже существует\n"
#, c-format
msgid "%sError: you must specify at least tag(s) or regex for filter"
msgstr ""
#, fuzzy
msgid "Filter added"
msgstr "команда users отключена"
#, fuzzy
msgid "Filter deleted"
msgstr "команда users отключена"
#, fuzzy, c-format
msgid "%sError: filter not found"
msgstr "%s plugin \"%s\" не найден\n"
#, fuzzy, c-format
msgid "%sError: wrong filter number"
msgstr "%s неправильный номер буфера\n"
#. TRANSLATORS: %s is "WeeChat"
#, fuzzy, c-format
msgid "%s internal commands:"
@ -596,6 +646,30 @@ msgstr ""
"команда: исполняемая команда ('/' автоматически добавляется в начало "
"команды)\n"
msgid ""
"filter messages in buffers, to hide/show them according to tags or regex"
msgstr ""
msgid ""
"[list] | [enable|disable|toggle] | [add buffer tags regex] | [del number]"
msgstr ""
msgid ""
" list: list all filters\n"
" enable: enable filters (filters are enabled by default)\n"
"disable: disable filters\n"
" toggle: toggle filters\n"
" add: add a filter\n"
" del: delete a filter\n"
" number: number of filter to delete (look at list to find it)\n"
" buffer: buffer where filter is active: it may be a name (category.name) or "
"\"*\" for all buffers\n"
" tags: comma separated list of tags, for example: \"irc_join,irc_part,"
"irc_quit\"\n"
" regex: regular expression to search in line (use \t to separate prefix "
"from message)"
msgstr ""
msgid "display help about commands"
msgstr "отобразить помощь по командам"
@ -1486,10 +1560,6 @@ msgstr " . значения: от %d до %d\n"
msgid " . description: %s\n"
msgstr " . описание: %s\n"
#, fuzzy, c-format
msgid "%sError: command \"%s\" failed"
msgstr "%s команда \"%s\" не удалась\n"
#, fuzzy, c-format
msgid "%sError: unknown command \"%s\" (type /help for help)"
msgstr "%s сокращение или команда \"%s\" не найдены\n"
@ -1568,6 +1638,14 @@ msgstr "-ДАЛЬШЕ-"
msgid "server"
msgstr "сервер"
#, fuzzy, c-format
msgid "%s[%sF%s%s%s]"
msgstr "%s[%s%s%s]%s бездействует: "
#, fuzzy
msgid "filtered"
msgstr "команда users отключена"
#, fuzzy
msgid "(MORE)"
msgstr "-ДАЛЬШЕ-"
@ -3540,7 +3618,7 @@ msgid "%sUser mode for %s%s%s is %s[%s%s%s]"
msgstr "Режим пользователя %s%s%s - %s[%s%s%s]\n"
#, fuzzy, c-format
msgid "%s%s%s%s is away: %s"
msgid "%s%s[%s%s%s]%s is away: %s"
msgstr "%s%s%s отсутствует: %s\n"
#, fuzzy, c-format
@ -3602,29 +3680,17 @@ msgstr "Тема установлена пользователем %s%s%s, %s"
msgid "%s%s%s%s has invited %s%s%s on %s%s"
msgstr "%s%s%s пригласил %s%s%s на канал %s%s\n"
#, fuzzy, c-format
msgid "%s%s: cannot identify channel for \"%s\" command"
msgstr "%s не могу опознать канал для команды \"%s\"\n"
#, fuzzy, c-format
msgid "%s%s: cannot identify nickname for \"%s\" command"
msgstr "%s не могу опознать ник для команды \"%s\"\n"
#, fuzzy, c-format
msgid "%sChannel reop %s%s%s: %s%s"
msgstr "Реоп канала %s%s%s: %s%s\n"
#, fuzzy, c-format
msgid "%s%s[%s%s%s]%s exception %s%s%s"
msgid "%s%s[%s%s%s]%s exception %s%s%s by %s%s %s(%s%s%s)%s on %s"
msgstr "%s[%s%s%s] %s%s%s забанен\n"
#, c-format
msgid " by %s%s %s(%s%s%s)"
msgstr " пользователем %s%s %s(%s%s%s)"
#, c-format
msgid " by %s%s"
msgstr " пользователем %s%s"
#, fuzzy, c-format
msgid "%s%s[%s%s%s]%s exception %s%s"
msgstr "%s[%s%s%s] %s%s%s забанен\n"
#, fuzzy, c-format
msgid "%s%s: cannot create nick \"%s\" for channel \"%s\""
@ -3668,12 +3734,12 @@ msgid "normal"
msgstr "обычные"
#, fuzzy, c-format
msgid "%s%s[%s%s%s] %s%s%s banned by "
msgid "%s%s[%s%s%s] %s%s%s banned by %s%s %s(%s%s%s)%s on %s"
msgstr "%s[%s%s%s] %s%s%s забанен пользователем "
#, fuzzy, c-format
msgid "%s%s[%s%s%s] %s%s%s banned"
msgstr "%s[%s%s%s] %s%s%s забанен\n"
msgid "%s%s[%s%s%s] %s%s%s banned by %s%s %s(%s%s%s)"
msgstr "%s[%s%s%s] %s%s%s забанен пользователем "
#, fuzzy, c-format
msgid ""
@ -4412,6 +4478,32 @@ msgstr ""
msgid "%s%s: wrong arguments for function \"%s\""
msgstr "%s некорректные аргументы команды \"%s\"\n"
#, fuzzy
#~ msgid "%sError: wrong number \"%s\" for filter"
#~ msgstr "%s некорректное количество аргументов команды \"%s\"\n"
#, fuzzy
#~ msgid "%sError: command \"%s\" failed"
#~ msgstr "%s команда \"%s\" не удалась\n"
#, fuzzy
#~ msgid "%s%s: cannot identify channel for \"%s\" command"
#~ msgstr "%s не могу опознать канал для команды \"%s\"\n"
#, fuzzy
#~ msgid "%s%s: cannot identify nickname for \"%s\" command"
#~ msgstr "%s не могу опознать ник для команды \"%s\"\n"
#~ msgid " by %s%s %s(%s%s%s)"
#~ msgstr " пользователем %s%s %s(%s%s%s)"
#~ msgid " by %s%s"
#~ msgstr " пользователем %s%s"
#, fuzzy
#~ msgid "%s%s[%s%s%s] %s%s%s banned"
#~ msgstr "%s[%s%s%s] %s%s%s забанен\n"
#~ msgid "/list end"
#~ msgstr "конец /list"
@ -4945,9 +5037,6 @@ msgstr "%s некорректные аргументы команды \"%s\"\n"
#~ msgid "%s cannot create new private window \"%s\"\n"
#~ msgstr "%s не могу создать новое окно привата \"%s\"\n"
#~ msgid "%s[%s%s%s]%s idle: "
#~ msgstr "%s[%s%s%s]%s бездействует: "
#~ msgid "%s: trying 2nd nickname \"%s\"\n"
#~ msgstr "%s: пробую второй ник \"%s\"\n"
@ -5400,9 +5489,6 @@ msgstr "%s некорректные аргументы команды \"%s\"\n"
#~ "%s маска или тип/команда должны быть необычного значения для "
#~ "игнорирования\n"
#~ msgid "%s ignore already exists\n"
#~ msgstr "%s игнорирование уже существует\n"
#~ msgid "%s not enough memory to create ignore\n"
#~ msgstr "%s недостаточно памяти для создания игнорирования\n"

View File

@ -63,6 +63,8 @@ SET(WEECHAT_SOURCES
./src/gui/gui-color.h
./src/gui/gui-completion.c
./src/gui/gui-completion.h
./src/gui/gui-filter.c
./src/gui/gui-filter.h
./src/gui/gui-history.c
./src/gui/gui-history.h
./src/gui/gui-hotlist.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-03-15 09:33+0100\n"
"POT-Creation-Date: 2008-03-22 23:32+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"
@ -177,6 +177,50 @@ msgstr ""
msgid "(hotlist: highlights + messages + join/part (all))"
msgstr ""
msgid "Filters are enabled"
msgstr ""
msgid "Filters are disabled"
msgstr ""
msgid "Message filters:"
msgstr ""
#, c-format
msgid " %s[%s%d%s]%s buffer: %s%s%s / tags: %s / regex: %s"
msgstr ""
msgid "No message filter defined"
msgstr ""
msgid "Filters enabled"
msgstr ""
msgid "Filters disabled"
msgstr ""
#, c-format
msgid "%sError: filter already exists"
msgstr ""
#, c-format
msgid "%sError: you must specify at least tag(s) or regex for filter"
msgstr ""
msgid "Filter added"
msgstr ""
msgid "Filter deleted"
msgstr ""
#, c-format
msgid "%sError: filter not found"
msgstr ""
#, c-format
msgid "%sError: wrong filter number"
msgstr ""
#. TRANSLATORS: %s is "WeeChat"
#, c-format
msgid "%s internal commands:"
@ -501,6 +545,30 @@ msgid ""
"beginning of command)"
msgstr ""
msgid ""
"filter messages in buffers, to hide/show them according to tags or regex"
msgstr ""
msgid ""
"[list] | [enable|disable|toggle] | [add buffer tags regex] | [del number]"
msgstr ""
msgid ""
" list: list all filters\n"
" enable: enable filters (filters are enabled by default)\n"
"disable: disable filters\n"
" toggle: toggle filters\n"
" add: add a filter\n"
" del: delete a filter\n"
" number: number of filter to delete (look at list to find it)\n"
" buffer: buffer where filter is active: it may be a name (category.name) or "
"\"*\" for all buffers\n"
" tags: comma separated list of tags, for example: \"irc_join,irc_part,"
"irc_quit\"\n"
" regex: regular expression to search in line (use \t to separate prefix "
"from message)"
msgstr ""
msgid "display help about commands"
msgstr ""
@ -1197,10 +1265,6 @@ msgstr ""
msgid " . description: %s\n"
msgstr ""
#, c-format
msgid "%sError: command \"%s\" failed"
msgstr ""
#, c-format
msgid "%sError: unknown command \"%s\" (type /help for help)"
msgstr ""
@ -1271,6 +1335,13 @@ msgstr ""
msgid "server"
msgstr ""
#, c-format
msgid "%s[%sF%s%s%s]"
msgstr ""
msgid "filtered"
msgstr ""
msgid "(MORE)"
msgstr ""
@ -3008,7 +3079,7 @@ msgid "%sUser mode for %s%s%s is %s[%s%s%s]"
msgstr ""
#, c-format
msgid "%s%s%s%s is away: %s"
msgid "%s%s[%s%s%s]%s is away: %s"
msgstr ""
#, c-format
@ -3068,28 +3139,16 @@ msgstr ""
msgid "%s%s%s%s has invited %s%s%s on %s%s"
msgstr ""
#, c-format
msgid "%s%s: cannot identify channel for \"%s\" command"
msgstr ""
#, c-format
msgid "%s%s: cannot identify nickname for \"%s\" command"
msgstr ""
#, c-format
msgid "%sChannel reop %s%s%s: %s%s"
msgstr ""
#, c-format
msgid "%s%s[%s%s%s]%s exception %s%s%s"
msgid "%s%s[%s%s%s]%s exception %s%s%s by %s%s %s(%s%s%s)%s on %s"
msgstr ""
#, c-format
msgid " by %s%s %s(%s%s%s)"
msgstr ""
#, c-format
msgid " by %s%s"
msgid "%s%s[%s%s%s]%s exception %s%s"
msgstr ""
#, c-format
@ -3133,11 +3192,11 @@ msgid "normal"
msgstr ""
#, c-format
msgid "%s%s[%s%s%s] %s%s%s banned by "
msgid "%s%s[%s%s%s] %s%s%s banned by %s%s %s(%s%s%s)%s on %s"
msgstr ""
#, c-format
msgid "%s%s[%s%s%s] %s%s%s banned"
msgid "%s%s[%s%s%s] %s%s%s banned by %s%s %s(%s%s%s)"
msgstr ""
#, c-format

View File

@ -45,6 +45,7 @@
#include "../gui/gui-buffer.h"
#include "../gui/gui-chat.h"
#include "../gui/gui-color.h"
#include "../gui/gui-filter.h"
#include "../gui/gui-history.h"
#include "../gui/gui-input.h"
#include "../gui/gui-keyboard.h"
@ -172,7 +173,7 @@ command_bar (void *data, struct t_gui_buffer *buffer,
}
error = NULL;
number = strtol (argv[5], &error, 10);
if (error && (error[0] == '\0'))
if (error && !error[0])
{
size = number;
separator = 0;
@ -241,7 +242,7 @@ command_buffer (void *data, struct t_gui_buffer *buffer,
ptr_buffer = ptr_buffer->next_buffer)
{
gui_chat_printf (NULL,
"%s[%s%d%s]%s (%s) %s / %s",
" %s[%s%d%s]%s (%s) %s / %s",
GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
GUI_COLOR(GUI_COLOR_CHAT),
ptr_buffer->number,
@ -268,7 +269,7 @@ command_buffer (void *data, struct t_gui_buffer *buffer,
{
error = NULL;
number = strtol (argv[i], &error, 10);
if (error && (error[0] == '\0'))
if (error && !error[0])
{
ptr_buffer = gui_buffer_search_by_number (number);
if (ptr_buffer)
@ -297,7 +298,7 @@ command_buffer (void *data, struct t_gui_buffer *buffer,
number = strtol (((argv[2][0] == '+') || (argv[2][0] == '-')) ?
argv[2] + 1 : argv[2],
&error, 10);
if (error && (error[0] == '\0'))
if (error && !error[0])
{
if (argv[2][0] == '+')
gui_buffer_move_to_number (buffer,
@ -354,7 +355,7 @@ command_buffer (void *data, struct t_gui_buffer *buffer,
/* set notify level for buffer */
error = NULL;
number = strtol (argv[2], &error, 10);
if (error && (error[0] == '\0'))
if (error && !error[0])
{
if ((number < GUI_BUFFER_NOTIFY_LEVEL_MIN)
|| (number > GUI_BUFFER_NOTIFY_LEVEL_MAX))
@ -441,7 +442,7 @@ command_buffer (void *data, struct t_gui_buffer *buffer,
/* relative jump '-' */
error = NULL;
number = strtol (argv[1] + 1, &error, 10);
if (error && (error[0] == '\0'))
if (error && !error[0])
{
target_buffer = buffer->number - (int) number;
if (target_buffer < 1)
@ -456,7 +457,7 @@ command_buffer (void *data, struct t_gui_buffer *buffer,
/* relative jump '+' */
error = NULL;
number = strtol (argv[1] + 1, &error, 10);
if (error && (error[0] == '\0'))
if (error && !error[0])
{
target_buffer = buffer->number + (int) number;
if (last_gui_buffer && target_buffer > last_gui_buffer->number)
@ -470,7 +471,7 @@ command_buffer (void *data, struct t_gui_buffer *buffer,
/* absolute jump by number, or by category/name */
error = NULL;
number = strtol (argv[1], &error, 10);
if (error && (error[0] == '\0'))
if (error && !error[0])
gui_buffer_switch_by_number (gui_current_window,
(int) number);
else
@ -538,6 +539,169 @@ command_builtin (void *data, struct t_gui_buffer *buffer,
return WEECHAT_RC_OK;
}
/*
* command_filter: manage message filters
*/
int
command_filter (void *data, struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
struct t_gui_filter *ptr_filter;
int i;
long number;
char *error;
/* make C compiler happy */
(void) data;
(void) buffer;
if ((argc == 1)
|| ((argc == 2) && (string_strcasecmp (argv[1], "list") == 0)))
{
/* display all key bindings */
gui_chat_printf (NULL, "");
gui_chat_printf (NULL, "%s",
(gui_filters_enabled) ?
_("Filters are enabled") : _("Filters are disabled"));
if (gui_filters)
{
gui_chat_printf (NULL, _("Message filters:"));
i = 0;
for (ptr_filter = gui_filters; ptr_filter;
ptr_filter = ptr_filter->next_filter)
{
i++;
gui_chat_printf (NULL,
_(" %s[%s%d%s]%s buffer: %s%s%s / tags: %s / "
"regex: %s"),
GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
GUI_COLOR(GUI_COLOR_CHAT),
i,
GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS),
GUI_COLOR(GUI_COLOR_CHAT),
GUI_COLOR(GUI_COLOR_CHAT_BUFFER),
ptr_filter->buffer,
GUI_COLOR(GUI_COLOR_CHAT),
ptr_filter->tags,
ptr_filter->regex);
}
}
else
gui_chat_printf (NULL, _("No message filter defined"));
return WEECHAT_RC_OK;
}
/* enable filters */
if (string_strcasecmp (argv[1], "enable") == 0)
{
if (!gui_filters_enabled)
{
gui_filter_enable ();
gui_chat_printf (NULL, _("Filters enabled"));
}
return WEECHAT_RC_OK;
}
/* disable filters */
if (string_strcasecmp (argv[1], "disable") == 0)
{
if (gui_filters_enabled)
{
gui_filter_disable ();
gui_chat_printf (NULL, _("Filters disabled"));
}
return WEECHAT_RC_OK;
}
/* toggle filters on/off */
if (string_strcasecmp (argv[1], "toggle") == 0)
{
if (gui_filters_enabled)
gui_filter_disable ();
else
gui_filter_enable ();
return WEECHAT_RC_OK;
}
/* add filter */
if (string_strcasecmp (argv[1], "add") == 0)
{
if (argc < 5)
{
gui_chat_printf (NULL,
_("%sError: missing arguments for \"%s\" "
"command"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
"filter add");
return WEECHAT_RC_ERROR;
}
if (gui_filter_search (argv[2], argv[3], argv_eol[4]))
{
gui_chat_printf (NULL,
_("%sError: filter already exists"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
return WEECHAT_RC_ERROR;
}
if ((strcmp (argv[3], "*") == 0) && (strcmp (argv_eol[4], "*") == 0))
{
gui_chat_printf (NULL,
_("%sError: you must specify at least tag(s) or "
"regex for filter"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
return WEECHAT_RC_ERROR;
}
gui_filter_new (argv[2], argv[3], argv_eol[4]);
gui_chat_printf (NULL, _("Filter added"));
return WEECHAT_RC_OK;
}
/* delete filter */
if (string_strcasecmp (argv[1], "del") == 0)
{
if (argc < 3)
{
gui_chat_printf (NULL,
_("%sError: missing arguments for \"%s\" "
"command"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
"filter del");
return WEECHAT_RC_ERROR;
}
error = NULL;
number = strtol (argv[2], &error, 10);
if (error && !error[0])
{
ptr_filter = gui_filter_search_by_number (number);
if (ptr_filter)
{
gui_filter_free (ptr_filter);
gui_chat_printf (NULL, _("Filter deleted"));
}
else
{
gui_chat_printf (NULL,
_("%sError: filter not found"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
return WEECHAT_RC_ERROR;
}
}
else
{
gui_chat_printf (NULL,
_("%sError: wrong filter number"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
return WEECHAT_RC_ERROR;
}
}
return WEECHAT_RC_OK;
}
/*
* command_help: display help about commands
*/
@ -1948,7 +2112,7 @@ command_window (void *data, struct t_gui_buffer *buffer,
{
error = NULL;
number = strtol (argv[2], &error, 10);
if (error && (error[0] == '\0')
if (error && !error[0]
&& (number > 0) && (number < 100))
gui_window_split_horiz (gui_current_window, number);
}
@ -1962,7 +2126,7 @@ command_window (void *data, struct t_gui_buffer *buffer,
{
error = NULL;
number = strtol (argv[2], &error, 10);
if (error && (error[0] == '\0')
if (error && !error[0]
&& (number > 0) && (number < 100))
gui_window_split_vertic (gui_current_window, number);
}
@ -1976,7 +2140,7 @@ command_window (void *data, struct t_gui_buffer *buffer,
{
error = NULL;
number = strtol (argv[2], &error, 10);
if (error && (error[0] == '\0')
if (error && !error[0]
&& (number > 0) && (number < 100))
gui_window_resize (gui_current_window, number);
}
@ -2016,7 +2180,7 @@ command_window (void *data, struct t_gui_buffer *buffer,
/* jump to window by buffer number */
error = NULL;
number = strtol (argv[1] + 1, &error, 10);
if (error && (error[0] == '\0'))
if (error && !error[0])
gui_window_switch_by_buffer (gui_current_window, number);
}
else if (string_strcasecmp (argv[1], "-1") == 0)
@ -2117,6 +2281,29 @@ command_init ()
"added if not found at beginning of command)"),
"%w",
&command_builtin, NULL);
hook_command (NULL, "filter",
N_("filter messages in buffers, to hide/show them according "
"to tags or regex"),
N_("[list] | [enable|disable|toggle] | "
"[add buffer tags regex] | "
"[del number]"),
N_(" list: list all filters\n"
" enable: enable filters (filters are enabled by "
"default)\n"
"disable: disable filters\n"
" toggle: toggle filters\n"
" add: add a filter\n"
" del: delete a filter\n"
" number: number of filter to delete (look at list to "
"find it)\n"
" buffer: buffer where filter is active: it may be "
"a name (category.name) or \"*\" for all buffers\n"
" tags: comma separated list of tags, for "
"example: \"irc_join,irc_part,irc_quit\"\n"
" regex: regular expression to search in "
"line (use \t to separate prefix from message)"),
"list|enable|disable|toggle|add|del",
&command_filter, NULL);
hook_command (NULL, "help",
N_("display help about commands"),
N_("[command]"),

View File

@ -323,7 +323,7 @@ config_file_new_option (struct t_config_file *config_file,
new_option->max = max;
error = NULL;
number = strtol (default_value, &error, 10);
if (!error || (error[0] != '\0'))
if (!error || error[0])
number = 0;
new_option->default_value = malloc (sizeof (int));
*((int *)new_option->default_value) = number;
@ -337,7 +337,7 @@ config_file_new_option (struct t_config_file *config_file,
new_option->max = max;
new_option->default_value = (default_value) ?
strdup (default_value) : NULL;
new_option->value = strdup (default_value) ?
new_option->value = (default_value) ?
strdup (default_value) : NULL;
break;
case CONFIG_OPTION_COLOR:
@ -558,7 +558,7 @@ config_file_option_set (struct t_config_option *option, char *new_value,
{
error = NULL;
number = strtol (new_value, &error, 10);
if (error && (error[0] == '\0'))
if (error && !error[0])
{
if (number == *((int *)option->value))
return 1;
@ -867,7 +867,8 @@ config_file_write_internal (struct t_config_file *config_file,
snprintf (filename2, filename_length + 32, "%s.weechattmp", filename);
/* open temp file in write mode */
if ((config_file->file = fopen (filename2, "w")) == NULL)
config_file->file = fopen (filename2, "w");
if (!config_file->file)
{
gui_chat_printf (NULL,
_("%sError: cannot create file \"%s\""),
@ -976,10 +977,12 @@ config_file_read (struct t_config_file *config_file)
return -2;
snprintf (filename, filename_length, "%s%s%s",
weechat_home, DIR_SEPARATOR, config_file->filename);
if ((config_file->file = fopen (filename, "r")) == NULL)
config_file->file = fopen (filename, "r");
if (!config_file->file)
{
config_file_write_internal (config_file, 1);
if ((config_file->file = fopen (filename, "r")) == NULL)
config_file->file = fopen (filename, "r");
if (!config_file->file)
{
gui_chat_printf (NULL,
_("%sWarning: config file \"%s\" not found"),
@ -1018,7 +1021,7 @@ config_file_read (struct t_config_file *config_file)
if (ptr_line[0] == '[')
{
pos = strchr (line, ']');
if (pos == NULL)
if (!pos)
{
gui_chat_printf (NULL,
_("%sWarning: %s, line %d: invalid "
@ -1054,8 +1057,8 @@ config_file_read (struct t_config_file *config_file)
}
else
{
pos = strchr (line, '=');
if (pos == NULL)
pos = strstr (line, " = ");
if (!pos)
{
gui_chat_printf (NULL,
_("%sWarning: %s, line %d: invalid "
@ -1066,10 +1069,10 @@ config_file_read (struct t_config_file *config_file)
else
{
pos[0] = '\0';
pos++;
pos += 3;
/* remove spaces before '=' */
pos2 = pos - 2;
pos2 = pos - 4;
while ((pos2 > line) && (pos2[0] == ' '))
{
pos2[0] = '\0';
@ -1236,6 +1239,25 @@ config_file_reload (struct t_config_file *config_file)
return rc;
}
/*
* config_file_option_free: free data in an option
*/
void
config_file_option_free_data (struct t_config_option *option)
{
if (option->name)
free (option->name);
if (option->description)
free (option->description);
if (option->string_values)
string_free_exploded (option->string_values);
if (option->default_value)
free (option->default_value);
if (option->value)
free (option->value);
}
/*
* config_file_option_free: free an option
*/
@ -1264,16 +1286,9 @@ config_file_option_free (struct t_config_section *section,
(option->next_option)->prev_option = option->prev_option;
/* free data */
if (option->name)
free (option->name);
if (option->description)
free (option->description);
if (option->string_values)
string_free_exploded (option->string_values);
if (option->default_value)
free (option->default_value);
if (option->value)
free (option->value);
config_file_option_free_data (option);
free (option);
section->options = new_options;
}
@ -1313,6 +1328,8 @@ config_file_section_free (struct t_config_file *config_file,
if (section->name)
free (section->name);
free (section);
config_file->sections = new_sections;
}
@ -1350,6 +1367,8 @@ config_file_free (struct t_config_file *config_file)
if (config_file->filename)
free (config_file->filename);
free (config_file);
config_files = new_config_files;
}

View File

@ -156,6 +156,7 @@ extern void config_file_write_line (struct t_config_file *config_file,
extern int config_file_write (struct t_config_file *config_files);
extern int config_file_read (struct t_config_file *config_file);
extern int config_file_reload (struct t_config_file *config_file);
extern void config_file_option_free_data (struct t_config_option *option);
extern void config_file_option_free (struct t_config_section *section,
struct t_config_option *option);
extern void config_file_section_free (struct t_config_file *config_file,

View File

@ -45,6 +45,7 @@
#include "../gui/gui-buffer.h"
#include "../gui/gui-chat.h"
#include "../gui/gui-color.h"
#include "../gui/gui-filter.h"
#include "../gui/gui-hotlist.h"
#include "../gui/gui-infobar.h"
#include "../gui/gui-keyboard.h"
@ -434,6 +435,12 @@ config_weechat_reload (void *data, struct t_config_file *config_file)
/* remove all keys */
gui_keyboard_free_all ();
/* remove all bars */
gui_bar_free_all ();
/* remove all filters */
gui_filter_free_all ();
return config_file_reload (weechat_config_file);
}
@ -458,17 +465,21 @@ config_weechat_read_bar (void *data, struct t_config_file *config_file,
if (value && value[0])
{
argv = string_explode (value, ";", 0, 0, &argc);
if (argc == 5)
if (argv)
{
error = NULL;
number = strtol (argv[2], &error, 10);
if (error && (error[0] == '\0'))
if (argc == 5)
{
size = number;
gui_bar_new (NULL, option_name, argv[0], argv[1], size,
(argv[3][0] == '0') ? 0 : 1,
argv[4]);
error = NULL;
number = strtol (argv[2], &error, 10);
if (error && !error[0])
{
size = number;
gui_bar_new (NULL, option_name, argv[0], argv[1], size,
(argv[3][0] == '0') ? 0 : 1,
argv[4]);
}
}
string_free_exploded (argv);
}
}
}
@ -504,6 +515,68 @@ config_weechat_write_bars (void *data, struct t_config_file *config_file,
}
}
/*
* config_weechat_read_filter: read a filter in configuration file
*/
void
config_weechat_read_filter (void *data, struct t_config_file *config_file,
char *option_name, char *value)
{
char **argv, **argv_eol;
int argc;
/* make C compiler happy */
(void) data;
(void) config_file;
if (option_name)
{
if (value && value[0])
{
argv = string_explode (value, ";", 0, 0, &argc);
argv_eol = string_explode (value, ";", 1, 0, NULL);
if (argv && argv_eol && (argc >= 3))
{
gui_filter_new (argv[0], argv[1], argv_eol[2]);
}
if (argv)
string_free_exploded (argv);
if (argv_eol)
string_free_exploded (argv_eol);
}
}
}
/*
* config_weechat_write_filters: write filters section in configuration file
* Return: 0 = successful
* -1 = write error
*/
void
config_weechat_write_filters (void *data, struct t_config_file *config_file,
char *section_name)
{
struct t_gui_filter *ptr_filter;
/* make C compiler happy */
(void) data;
config_file_write_line (config_file, section_name, NULL);
for (ptr_filter = gui_filters; ptr_filter;
ptr_filter = ptr_filter->next_filter)
{
config_file_write_line (config_file,
"filter",
"%s;%s;%s",
ptr_filter->buffer,
ptr_filter->tags,
ptr_filter->regex);
}
}
/*
* config_weechat_read_key: read a key in configuration file
*/
@ -1398,6 +1471,20 @@ config_weechat_init ()
return 0;
}
/* filters */
ptr_section = config_file_new_section (weechat_config_file, "filters",
&config_weechat_read_filter,
NULL,
&config_weechat_write_filters,
NULL,
&config_weechat_write_filters,
NULL);
if (!ptr_section)
{
config_file_free (weechat_config_file);
return 0;
}
/* keys */
ptr_section = config_file_new_section (weechat_config_file, "keys",
&config_weechat_read_key,

View File

@ -35,6 +35,7 @@
#include "../gui/gui-bar-item.h"
#include "../gui/gui-buffer.h"
#include "../gui/gui-chat.h"
#include "../gui/gui-filter.h"
#include "../gui/gui-hotlist.h"
#include "../gui/gui-main.h"
#include "../gui/gui-window.h"
@ -75,6 +76,7 @@ debug_dump (int crash)
gui_window_print_log ();
gui_buffer_print_log ();
gui_filter_print_log ();
gui_bar_print_log ();
gui_bar_item_print_log ();
gui_hotlist_print_log ();

View File

@ -718,7 +718,7 @@ hook_fd_exec (fd_set *read_fds, fd_set *write_fds, fd_set *exception_fds)
&& (FD_ISSET(HOOK_FD(ptr_hook, fd), exception_fds)))))
{
ptr_hook->running = 1;
(HOOK_FD(ptr_hook, callback)) (ptr_hook->callback_data);
(void) (HOOK_FD(ptr_hook, callback)) (ptr_hook->callback_data);
ptr_hook->running = 0;
}
@ -734,8 +734,8 @@ hook_fd_exec (fd_set *read_fds, fd_set *write_fds, fd_set *exception_fds)
struct t_hook *
hook_print (struct t_weechat_plugin *plugin, struct t_gui_buffer *buffer,
char *message, int strip_colors, t_hook_callback_print *callback,
void *callback_data)
char *tags, char *message, int strip_colors,
t_hook_callback_print *callback, void *callback_data)
{
struct t_hook *new_hook;
struct t_hook_print *new_hook_print;
@ -755,6 +755,16 @@ hook_print (struct t_weechat_plugin *plugin, struct t_gui_buffer *buffer,
new_hook->hook_data = new_hook_print;
new_hook_print->callback = callback;
new_hook_print->buffer = buffer;
if (tags)
{
new_hook_print->tags_array = string_explode (tags, ",", 0, 0,
&new_hook_print->tags_count);
}
else
{
new_hook_print->tags_count = 0;
new_hook_print->tags_array = NULL;
}
new_hook_print->message = (message) ? strdup (message) : NULL;
new_hook_print->strip_colors = strip_colors;
@ -768,11 +778,12 @@ hook_print (struct t_weechat_plugin *plugin, struct t_gui_buffer *buffer,
*/
void
hook_print_exec (struct t_gui_buffer *buffer, time_t date, char *prefix,
char *message)
hook_print_exec (struct t_gui_buffer *buffer, time_t date, int tags_count,
char **tags_array, char *prefix, char *message)
{
struct t_hook *ptr_hook, *next_hook;
char *prefix_no_color, *message_no_color;
int tags_match, tag_found, i, j;
if (!message || !message[0])
return;
@ -802,17 +813,59 @@ hook_print_exec (struct t_gui_buffer *buffer, time_t date, char *prefix,
|| string_strcasestr (prefix_no_color, HOOK_PRINT(ptr_hook, message))
|| string_strcasestr (message_no_color, HOOK_PRINT(ptr_hook, message))))
{
ptr_hook->running = 1;
(void) (HOOK_PRINT(ptr_hook, callback))
(ptr_hook->callback_data, buffer, date,
(HOOK_PRINT(ptr_hook, strip_colors)) ? prefix_no_color : prefix,
(HOOK_PRINT(ptr_hook, strip_colors)) ? message_no_color : message);
ptr_hook->running = 0;
/* check if tags match */
if (HOOK_PRINT(ptr_hook, tags_array))
{
/* if there are tags in message printed */
if (tags_array)
{
tags_match = 1;
for (i = 0; i < HOOK_PRINT(ptr_hook, tags_count); i++)
{
/* search for tag in message */
tag_found = 0;
for (j = 0; j < tags_count; j++)
{
if (string_strcasecmp (HOOK_PRINT(ptr_hook, tags_array)[i],
tags_array[j]) != 0)
{
tag_found = 1;
break;
}
}
/* tag was asked by hook but not found in message? */
if (!tag_found)
{
tags_match = 0;
break;
}
}
}
else
tags_match = 0;
}
else
tags_match = 1;
/* run callback */
if (tags_match)
{
ptr_hook->running = 1;
(void) (HOOK_PRINT(ptr_hook, callback))
(ptr_hook->callback_data, buffer, date,
tags_count, tags_array,
(HOOK_PRINT(ptr_hook, strip_colors)) ? prefix_no_color : prefix,
(HOOK_PRINT(ptr_hook, strip_colors)) ? message_no_color : message);
ptr_hook->running = 0;
}
}
ptr_hook = next_hook;
}
free (prefix_no_color);
free (message_no_color);
hook_exec_end ();
}
@ -869,8 +922,7 @@ hook_signal_send (char *signal, char *type_data, void *signal_data)
if (!ptr_hook->deleted
&& !ptr_hook->running
&& ((string_strcasecmp (HOOK_SIGNAL(ptr_hook, signal), "*") == 0)
|| (string_strcasecmp (HOOK_SIGNAL(ptr_hook, signal), signal) == 0)))
&& (string_match (signal, HOOK_SIGNAL(ptr_hook, signal), 0)))
{
ptr_hook->running = 1;
(void) (HOOK_SIGNAL(ptr_hook, callback))

View File

@ -104,12 +104,16 @@ struct t_hook_fd
};
typedef int (t_hook_callback_print)(void *data, struct t_gui_buffer *buffer,
time_t date, char *prefix, char *message);
time_t date, int tags_count,
char **tags, char *prefix,
char *message);
struct t_hook_print
{
t_hook_callback_print *callback; /* print callback */
struct t_gui_buffer *buffer; /* buffer selected (NULL = all) */
int tags_count; /* number of tags selected */
char **tags_array; /* tags selected (NULL = any) */
char *message; /* part of message (NULL/empty = all)*/
int strip_colors; /* strip colors in msg for callback? */
};
@ -120,7 +124,8 @@ typedef int (t_hook_callback_signal)(void *data, char *signal,
struct t_hook_signal
{
t_hook_callback_signal *callback; /* signal callback */
char *signal; /* signal selected ("*" = any signal)*/
char *signal; /* signal selected (may begin or end */
/* with "*", "*" == any signal) */
};
typedef int (t_hook_callback_config)(void *data, char *type, char *option,
@ -190,11 +195,14 @@ extern void hook_fd_exec (fd_set *read_fds, fd_set *write_fds,
fd_set *exception_fds);
extern struct t_hook *hook_print (struct t_weechat_plugin *plugin,
struct t_gui_buffer *buffer,
char *message, int strip_colors,
char *tags, char *message,
int strip_colors,
t_hook_callback_print *callback,
void *callback_data);
extern void hook_print_exec (struct t_gui_buffer *buffer,
time_t date, char *prefix, char *message);
time_t date, int tags_count,
char **tags_array, char *prefix,
char *message);
extern struct t_hook *hook_signal (struct t_weechat_plugin *plugin,
char *signal,
t_hook_callback_signal *callback,

View File

@ -111,10 +111,6 @@ input_exec_command (struct t_gui_buffer *buffer, char *string,
switch (rc)
{
case 0: /* command hooked, KO */
gui_chat_printf (NULL,
_("%sError: command \"%s\" failed"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
command + 1);
break;
case 1: /* command hooked, OK (executed) */
break;

View File

@ -243,6 +243,90 @@ string_strcasestr (char *string, char *search)
return NULL;
}
/*
* string_match: return 1 if string matches a mask
* mask can begin or end with "*", no other "*" are allowed
* inside mask
*/
int
string_match (char *string, char *mask, int case_sensitive)
{
char last, *mask2;
int len_string, len_mask, rc;
if (!mask || !mask[0])
return 0;
/* if mask is "*", then any string matches */
if (strcmp (mask, "*") == 0)
return 1;
len_string = strlen (string);
len_mask = strlen (mask);
last = mask[len_mask - 1];
/* mask begins with "*" */
if ((mask[0] == '*') && (last != '*'))
{
/* not enough chars in string to match */
if (len_string < len_mask - 1)
return 0;
/* check if end of string matches */
if ((case_sensitive && (strcmp (string + len_string - (len_mask - 1),
mask + 1) == 0))
|| (!case_sensitive && (string_strcasecmp (string + len_string - (len_mask - 1),
mask + 1) == 0)))
return 1;
/* no match */
return 0;
}
/* mask ends with "*" */
if ((mask[0] != '*') && (last == '*'))
{
/* not enough chars in string to match */
if (len_string < len_mask - 1)
return 0;
/* check if beginning of string matches */
if ((case_sensitive && (strncmp (string, mask, len_mask - 1) == 0))
|| (!case_sensitive && (string_strncasecmp (string,
mask,
len_mask - 1) == 0)))
return 1;
/* no match */
return 0;
}
/* mask begins and ends with "*" */
if ((mask[0] == '*') && (last == '*'))
{
/* not enough chars in string to match */
if (len_string < len_mask - 1)
return 0;
/* keep only relevant chars in mask for searching string */
mask2 = string_strndup (mask + 1, len_mask - 2);
if (!mask2)
return 0;
/* search string */
rc = ((case_sensitive && strstr (string, mask2))
|| (!case_sensitive && string_strcasestr (string, mask2))) ?
1 : 0;
/* free and return */
free (mask2);
return rc;
}
/* no "*" at all, compare strings */
if ((case_sensitive && (strcmp (string, mask) == 0))
|| (!case_sensitive && (string_strcasecmp (string, mask) == 0)))
return 1;
/* no match */
return 0;
}
/*
* string_replace: replace a string by new one in a string
* note: returned value has to be free() after use
@ -417,7 +501,7 @@ string_convert_hex_chars (char *string)
snprintf (hex_str, sizeof (hex_str),
"0x%c%c", string[1], string[2]);
number = strtol (hex_str, &error, 16);
if (error && (error[0] == '\0'))
if (error && !error[0])
{
output[pos_output++] = number;
string += 3;
@ -550,7 +634,7 @@ string_explode (char *string, char *separators, int keep_eol,
{
array[i] =
(char *)malloc ((ptr2 - ptr1 + 1) * sizeof (char));
array[i] = strncpy (array[i], ptr1, ptr2 - ptr1);
strncpy (array[i], ptr1, ptr2 - ptr1);
array[i][ptr2 - ptr1] = '\0';
}
ptr1 = ++ptr2;
@ -566,6 +650,8 @@ string_explode (char *string, char *separators, int keep_eol,
if (num_items != NULL)
*num_items = i;
free (string2);
return array;
}
@ -586,6 +672,41 @@ string_free_exploded (char **exploded_string)
}
}
/*
* string_build_with_exploded: build a string with exploded string
* note: returned value has to be free() after use
*/
char *
string_build_with_exploded (char **exploded_string, char *separator)
{
int i, length, length_separator;
char *result;
if (!exploded_string || !separator)
return NULL;
length = 0;
length_separator = strlen (separator);
for (i = 0; exploded_string[i]; i++)
{
length += strlen (exploded_string[i]) + length_separator;
}
result = (char *)malloc ((length + 1) * sizeof (char));
result[0] = '\0';
for (i = 0; exploded_string[i]; i++)
{
strcat (result, exploded_string[i]);
if (exploded_string[i + 1])
strcat (result, separator);
}
return result;
}
/*
* string_split_command: split a list of commands separated by 'sep'
* and ecscaped with '\'

View File

@ -28,6 +28,7 @@ extern int string_strncasecmp (char *string1, char *string2, int max);
extern int string_strcmp_ignore_chars (char *string1, char *string2,
char *chars_ignored, int case_sensitive);
extern char *string_strcasestr (char *string, char *search);
extern int string_match (char *string, char *mask, int case_sensitive);
extern char *string_replace (char *string, char *search, char *replace);
extern char *string_remove_quotes (char *string, char *quotes);
extern char *string_strip (char *string, int left, int right, char *chars);
@ -35,6 +36,8 @@ extern char *string_convert_hex_chars (char *string);
extern char **string_explode (char *string, char *separators, int keep_eol,
int num_items_max, int *num_items);
extern void string_free_exploded (char **exploded_string);
extern char *string_build_with_exploded (char **exploded_string,
char *separator);
extern char **string_split_command (char *command, char separator);
extern void string_free_splitted_command (char **splitted_command);
extern char *string_iconv (int from_utf8, char *from_code, char *to_code,

View File

@ -174,6 +174,7 @@ util_exec_on_files (char *directory, void *data,
DIR *dir;
struct dirent *entry;
struct stat statbuf;
int rc;
if (!directory || !callback)
return;
@ -188,7 +189,7 @@ util_exec_on_files (char *directory, void *data,
lstat (complete_filename, &statbuf);
if (!S_ISDIR(statbuf.st_mode))
{
(int) (*callback) (data, complete_filename);
rc = (*callback) (data, complete_filename);
}
}
closedir (dir);

View File

@ -524,11 +524,15 @@ main (int argc, char *argv[])
command_startup (0); /* command executed before plugins */
plugin_init (auto_load_plugins); /* init plugin interface(s) */
command_startup (1); /* command executed after plugins */
gui_main_loop (); /* WeeChat main loop */
plugin_end (); /* end plugin interface(s) */
if (CONFIG_BOOLEAN(config_look_save_on_exit))
(void) config_weechat_write (NULL); /* save WeeChat config file */
gui_main_end (); /* shut down WeeChat GUI */
config_file_free_all (); /* free all configuration files */
gui_keyboard_end (); /* end keyboard */
unhook_all (); /* remove all hooks */
weechat_shutdown (EXIT_SUCCESS, 0); /* quit WeeChat (oh no, why?) */

View File

@ -20,11 +20,11 @@ ENDIF(NOT DISABLE_NCURSES)
SET(LIB_GUI_COMMON_SRC gui-action.c gui-action.h gui-bar.c gui-bar.h
gui-bar-item.c gui-bar-item.h gui-buffer.c gui-buffer.h gui-chat.c gui-chat.h
gui-color.c gui-color.h gui-completion.c gui-completion.h gui-history.c
gui-history.h gui-hotlist.c gui-hotlist.h gui-infobar.c gui-infobar.h
gui-input.c gui-input.h gui-keyboard.c gui-keyboard.h gui-main.h
gui-nicklist.c gui-nicklist.h gui-status.c gui-status.h gui-window.c
gui-window.h)
gui-color.c gui-color.h gui-filter.c gui-filter.h gui-completion.c
gui-completion.h gui-history.c gui-history.h gui-hotlist.c gui-hotlist.h
gui-infobar.c gui-infobar.h gui-input.c gui-input.h gui-keyboard.c
gui-keyboard.h gui-main.h gui-nicklist.c gui-nicklist.h gui-status.c
gui-status.h gui-window.c gui-window.h)
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
ADD_LIBRARY(weechat_gui_common STATIC ${LIB_GUI_COMMON_SRC})

View File

@ -32,6 +32,8 @@ lib_weechat_gui_common_a_SOURCES = gui-action.c \
gui-color.h \
gui-completion.c \
gui-completion.h \
gui-filter.c \
gui-filter.h \
gui-history.c \
gui-history.h \
gui-hotlist.c \

View File

@ -352,6 +352,8 @@ gui_bar_window_draw (struct t_gui_window *window,
}
if (item_value2)
free (item_value2);
if (items)
string_free_exploded (items);
}
free (item_value);
}

View File

@ -837,7 +837,7 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line,
{
/* display read marker if needed */
if (window->buffer->last_read_line &&
(window->buffer->last_read_line == line->prev_line))
(window->buffer->last_read_line == gui_chat_get_prev_line_displayed (line)))
{
gui_chat_set_weechat_color (window,
GUI_COLOR_CHAT_READ_MARKER);
@ -874,7 +874,7 @@ gui_chat_calculate_line_diff (struct t_gui_window *window,
/* if looking backward, start at last line of buffer */
if (backward)
{
*line = window->buffer->last_line;
*line = gui_chat_get_last_line_displayed (window->buffer);
if (!(*line))
return;
current_size = gui_chat_display_line (window, *line, 0, 1);
@ -885,7 +885,7 @@ gui_chat_calculate_line_diff (struct t_gui_window *window,
/* if looking forward, start at first line of buffer */
else
{
*line = window->buffer->lines;
*line = gui_chat_get_first_line_displayed (window->buffer);
if (!(*line))
return;
*line_pos = 0;
@ -904,7 +904,7 @@ gui_chat_calculate_line_diff (struct t_gui_window *window,
(*line_pos)--;
else
{
*line = (*line)->prev_line;
*line = gui_chat_get_prev_line_displayed (*line);
if (*line)
{
current_size = gui_chat_display_line (window, *line, 0, 1);
@ -922,7 +922,7 @@ gui_chat_calculate_line_diff (struct t_gui_window *window,
(*line_pos)++;
else
{
*line = (*line)->next_line;
*line = gui_chat_get_next_line_displayed (*line);
if (*line)
{
current_size = gui_chat_display_line (window, *line, 0, 1);
@ -941,7 +941,7 @@ gui_chat_calculate_line_diff (struct t_gui_window *window,
if (backward)
{
/* first line reached */
*line = window->buffer->lines;
*line = gui_chat_get_first_line_displayed (window->buffer);
*line_pos = 0;
}
else
@ -1158,19 +1158,19 @@ gui_chat_draw (struct t_gui_buffer *buffer, int erase)
ptr_line,
0, 1) -
line_pos, 0);
ptr_line = ptr_line->next_line;
ptr_line = gui_chat_get_next_line_displayed (ptr_line);
ptr_win->first_line_displayed = 0;
}
else
ptr_win->first_line_displayed =
(ptr_line == ptr_win->buffer->lines);
(ptr_line == gui_chat_get_first_line_displayed (ptr_win->buffer));
/* display lines */
count = 0;
while (ptr_line && (ptr_win->win_chat_cursor_y <= ptr_win->win_chat_height - 1))
{
count = gui_chat_display_line (ptr_win, ptr_line, 0, 0);
ptr_line = ptr_line->next_line;
ptr_line = gui_chat_get_next_line_displayed (ptr_line);
}
old_scroll = ptr_win->scroll;
@ -1191,7 +1191,8 @@ gui_chat_draw (struct t_gui_buffer *buffer, int erase)
WEECHAT_HOOK_SIGNAL_POINTER, ptr_win);
}
if (!ptr_win->scroll && (ptr_win->start_line == ptr_win->buffer->lines))
if (!ptr_win->scroll
&& (ptr_win->start_line == gui_chat_get_first_line_displayed (ptr_win->buffer)))
{
ptr_win->start_line = NULL;
ptr_win->start_line_pos = 0;

View File

@ -459,3 +459,18 @@ gui_color_init ()
gui_color_init_pairs ();
gui_color_init_weechat ();
}
/*
* gui_color_end: end GUI colors
*/
void
gui_color_end ()
{
int i;
for (i = 0; i < GUI_NUM_COLORS; i++)
{
gui_color_free (gui_color[i]);
}
}

View File

@ -135,6 +135,7 @@ gui_keyboard_default_bindings ()
gui_keyboard_bind (/* m-w,m-down */ "meta-wmeta-meta2-B", "/window down");
gui_keyboard_bind (/* m-w,m-left */ "meta-wmeta-meta2-D", "/window left");
gui_keyboard_bind (/* m-w,m-right */ "meta-wmeta-meta2-C", "/window right");
gui_keyboard_bind (/* m-= */ "meta-=", "/filter toggle");
gui_keyboard_bind (/* m-0 */ "meta-0", "/buffer 10");
gui_keyboard_bind (/* m-1 */ "meta-1", "/buffer 1");
gui_keyboard_bind (/* m-2 */ "meta-2", "/buffer 2");

View File

@ -263,8 +263,9 @@ gui_main_loop ()
void
gui_main_end ()
{
/* remove bar items */
/* remove bar items and bars */
gui_bar_item_end ();
gui_bar_free_all ();
/* free clipboard buffer */
if (gui_input_clipboard)
@ -290,6 +291,9 @@ gui_main_end ()
if (CONFIG_BOOLEAN(config_look_set_title))
gui_window_title_reset ();
/* end color */
gui_color_end ();
/* end of Curses output */
refresh ();
endwin ();

View File

@ -726,7 +726,7 @@ gui_window_scroll_top (struct t_gui_window *window)
if (!window->first_line_displayed)
{
window->start_line = window->buffer->lines;
window->start_line = gui_chat_get_first_line_displayed (window->buffer);
window->start_line_pos = 0;
gui_chat_draw (window->buffer, 0);
if (!window->scroll)

View File

@ -62,6 +62,7 @@ extern struct t_gui_color gui_weechat_colors[];
/* color functions */
extern int gui_color_get_pair (int num_color);
extern void gui_color_init ();
extern void gui_color_end ();
/* bar functions */
extern void gui_bar_window_calculate_pos_size (struct t_gui_bar_window *bar_window,

View File

@ -170,3 +170,18 @@ gui_color_init ()
gui_color_init_pairs ();
gui_color_init_weechat ();
}
/*
* gui_color_end: end GUI colors
*/
void
gui_color_end ()
{
int i;
for (i = 0; i < GUI_NUM_COLORS; i++)
{
gui_color_free (gui_color[i]);
}
}

View File

@ -92,6 +92,7 @@ extern GtkWidget *gui_gtk_label1;
/* color functions */
extern int gui_color_get_pair (int num_color);
extern void gui_color_init ();
extern void gui_color_end ();
/* chat functions */
extern void gui_chat_calculate_line_diff (struct t_gui_window *window,

View File

@ -1369,7 +1369,7 @@ gui_action_scroll_unread (char *args)
gui_current_window->buffer->last_read_line->next_line;
gui_current_window->start_line_pos = 0;
gui_current_window->first_line_displayed =
(gui_current_window->start_line == gui_current_window->buffer->lines);
(gui_current_window->start_line == gui_chat_get_first_line_displayed (gui_current_window->buffer));
gui_current_window->buffer->chat_refresh_needed = 1;
gui_status_refresh_needed = 1;
}

View File

@ -36,6 +36,7 @@
#include "gui-bar.h"
#include "gui-buffer.h"
#include "gui-color.h"
#include "gui-filter.h"
#include "gui-hotlist.h"
#include "gui-window.h"
@ -43,8 +44,8 @@
struct t_gui_bar_item *gui_bar_items = NULL; /* first bar item */
struct t_gui_bar_item *last_gui_bar_item = NULL; /* last bar item */
char *gui_bar_item_names[GUI_BAR_NUM_ITEMS] =
{ "buffer_count", "buffer_plugin", "buffer_name", "nicklist_count", "scroll",
"hotlist"
{ "buffer_count", "buffer_plugin", "buffer_name", "buffer_filter",
"nicklist_count", "scroll", "hotlist"
};
struct t_gui_bar_item_hook *gui_bar_item_hooks = NULL;
@ -325,6 +326,40 @@ gui_bar_item_default_buffer_name (void *data, struct t_gui_bar_item *item,
return strdup (buf);
}
/*
* gui_bar_item_default_buffer_filter: default item for buffer filter
*/
char *
gui_bar_item_default_buffer_filter (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window,
int max_width, int max_height)
{
char buf[256];
/* make C compiler happy */
(void) data;
(void) item;
(void) max_width;
(void) max_height;
if (!window)
window = gui_current_window;
if (!gui_filters_enabled)
return NULL;
snprintf (buf, sizeof (buf),
_("%s[%sF%s%s%s]"),
GUI_COLOR(GUI_COLOR_STATUS_DELIMITERS),
GUI_COLOR(GUI_COLOR_STATUS_NAME),
(window->buffer->lines_hidden) ? "," : "",
(window->buffer->lines_hidden) ? _("filtered") : "",
GUI_COLOR(GUI_COLOR_STATUS_DELIMITERS));
return strdup (buf);
}
/*
* gui_bar_item_default_nicklist_count: default item for number of nicks in
* buffer nicklist
@ -549,6 +584,15 @@ gui_bar_item_init ()
gui_bar_item_hook ("buffer_moved",
gui_bar_item_names[GUI_BAR_ITEM_WEECHAT_BUFFER_NAME]);
/* buffer filter */
gui_bar_item_new (NULL,
gui_bar_item_names[GUI_BAR_ITEM_WEECHAT_BUFFER_FILTER],
&gui_bar_item_default_buffer_filter, NULL);
gui_bar_item_hook ("buffer_lines_hidden",
gui_bar_item_names[GUI_BAR_ITEM_WEECHAT_BUFFER_FILTER]);
gui_bar_item_hook ("filters_*",
gui_bar_item_names[GUI_BAR_ITEM_WEECHAT_BUFFER_FILTER]);
/* nicklist count */
gui_bar_item_new (NULL,
gui_bar_item_names[GUI_BAR_ITEM_WEECHAT_NICKLIST_COUNT],

View File

@ -25,6 +25,7 @@ enum t_gui_bar_item_weechat
GUI_BAR_ITEM_WEECHAT_BUFFER_COUNT = 0,
GUI_BAR_ITEM_WEECHAT_BUFFER_PLUGIN,
GUI_BAR_ITEM_WEECHAT_BUFFER_NAME,
GUI_BAR_ITEM_WEECHAT_BUFFER_FILTER,
GUI_BAR_ITEM_WEECHAT_NICKLIST_COUNT,
GUI_BAR_ITEM_WEECHAT_SCROLL,
GUI_BAR_ITEM_WEECHAT_HOTLIST,

View File

@ -55,7 +55,6 @@
struct t_gui_buffer *gui_buffers = NULL; /* first buffer */
struct t_gui_buffer *last_gui_buffer = NULL; /* last buffer */
struct t_gui_buffer *gui_previous_buffer = NULL; /* previous buffer */
struct t_gui_buffer *gui_buffer_before_dcc = NULL; /* buffer before dcc */
/*
@ -89,7 +88,8 @@ gui_buffer_new (struct t_weechat_plugin *plugin, char *category, char *name,
}
/* create new buffer */
if ((new_buffer = (struct t_gui_buffer *)(malloc (sizeof (struct t_gui_buffer)))))
new_buffer = (struct t_gui_buffer *)(malloc (sizeof (struct t_gui_buffer)));
if (new_buffer)
{
/* init buffer */
new_buffer->plugin = plugin;
@ -113,6 +113,7 @@ gui_buffer_new (struct t_weechat_plugin *plugin, char *category, char *name,
new_buffer->last_line = NULL;
new_buffer->last_read_line = NULL;
new_buffer->lines_count = 0;
new_buffer->lines_hidden = 0;
new_buffer->prefix_max_length = 0;
new_buffer->chat_refresh_needed = 1;
@ -219,14 +220,14 @@ gui_buffer_valid (struct t_gui_buffer *buffer)
}
/*
* gui_buffer_get: get a buffer property
* gui_buffer_get_string: get a buffer property as string
*/
void *
gui_buffer_get (struct t_gui_buffer *buffer, char *property)
char *
gui_buffer_get_string (struct t_gui_buffer *buffer, char *property)
{
if (string_strcasecmp (property, "plugin") == 0)
return buffer->plugin;
static char value[32];
if (string_strcasecmp (property, "category") == 0)
return buffer->category;
else if (string_strcasecmp (property, "name") == 0)
@ -235,6 +236,24 @@ gui_buffer_get (struct t_gui_buffer *buffer, char *property)
return buffer->title;
else if (string_strcasecmp (property, "nick") == 0)
return buffer->input_nick;
else if (string_strcasecmp (property, "lines_hidden") == 0)
{
snprintf (value, sizeof (value), "%d", buffer->lines_hidden);
return value;
}
return NULL;
}
/*
* gui_buffer_get_pointer: get a buffer property as pointer
*/
void *
gui_buffer_get_pointer (struct t_gui_buffer *buffer, char *property)
{
if (string_strcasecmp (property, "plugin") == 0)
return buffer->plugin;
return NULL;
}
@ -370,21 +389,21 @@ gui_buffer_set (struct t_gui_buffer *buffer, char *property, char *value)
{
error = NULL;
number = strtol (value, &error, 10);
if (error && (error[0] == '\0'))
if (error && !error[0])
gui_buffer_set_nicklist (buffer, number);
}
else if (string_strcasecmp (property, "nicklist_case_sensitive") == 0)
{
error = NULL;
number = strtol (value, &error, 10);
if (error && (error[0] == '\0'))
if (error && !error[0])
gui_buffer_set_nicklist_case_sensitive (buffer, number);
}
else if (string_strcasecmp (property, "nicklist_display_groups") == 0)
{
error = NULL;
number = strtol (value, &error, 10);
if (error && (error[0] == '\0'))
if (error && !error[0])
gui_buffer_set_nicklist_display_groups (buffer, number);
}
else if (string_strcasecmp (property, "nick") == 0)
@ -401,7 +420,7 @@ gui_buffer_set (struct t_gui_buffer *buffer, char *property, char *value)
{
error = NULL;
number = strtol (value, &error, 10);
if (error && (error[0] == '\0'))
if (error && !error[0])
gui_hotlist_add (buffer, number, NULL, 1);
}
}
@ -532,6 +551,54 @@ gui_buffer_is_scrolled (struct t_gui_buffer *buffer)
return 0;
}
/*
* gui_buffer_match_category_name: return 1 if buffer matches category.name
* otherwise 0
* category or name may begin or end with "*"
* examples:
* *.#weechat
* freenode.*
* freenode.#weechat*
* freenode.*chat*
*/
int
gui_buffer_match_category_name (struct t_gui_buffer *buffer, char *mask,
int case_sensitive)
{
char *pos_point, *category, *pos_name;
int rc;
if (!mask || !mask[0])
return 0;
pos_point = strchr (mask, '.');
if (pos_point)
{
category = string_strndup (mask, pos_point - mask);
pos_name = pos_point + 1;
}
else
{
category = NULL;
pos_name = mask;
}
rc = 1;
if (category && buffer->category
&& !string_match (buffer->category, category, case_sensitive))
rc = 0;
if (rc && !string_match (buffer->name, pos_name, case_sensitive))
rc = 0;
if (category)
free (category);
return rc;
}
/*
* gui_buffer_get_dcc: get pointer to DCC buffer (DCC buffer created if not existing)
*/
@ -657,13 +724,6 @@ gui_buffer_close (struct t_gui_buffer *buffer, int switch_to_another)
if (gui_previous_buffer == buffer)
gui_previous_buffer = NULL;
if (gui_buffer_before_dcc == buffer)
gui_buffer_before_dcc = NULL;
/* free title */
if (buffer->title)
free (buffer->title);
if (buffer->type == GUI_BUFFER_TYPE_FORMATED)
{
/* decrease buffer number for all next buffers */
@ -681,7 +741,14 @@ gui_buffer_close (struct t_gui_buffer *buffer, int switch_to_another)
buffer->lines = ptr_line;
}
}
/* free some data */
if (buffer->title)
free (buffer->title);
if (buffer->category)
free (buffer->category);
if (buffer->name)
free (buffer->name);
if (buffer->input_buffer)
free (buffer->input_buffer);
if (buffer->input_buffer_color_mask)
@ -988,6 +1055,7 @@ gui_buffer_print_log ()
{
struct t_gui_buffer *ptr_buffer;
struct t_gui_line *ptr_line;
char *tags;
int num;
for (ptr_buffer = gui_buffers; ptr_buffer;
@ -1007,6 +1075,7 @@ gui_buffer_print_log ()
log_printf (" last_line. . . . . . . : 0x%x", ptr_buffer->last_line);
log_printf (" last_read_line . . . . : 0x%x", ptr_buffer->last_read_line);
log_printf (" lines_count. . . . . . : %d", ptr_buffer->lines_count);
log_printf (" lines_hidden . . . . . : %d", ptr_buffer->lines_hidden);
log_printf (" prefix_max_length. . . : %d", ptr_buffer->prefix_max_length);
log_printf (" chat_refresh_needed. . : %d", ptr_buffer->chat_refresh_needed);
log_printf (" nicklist . . . . . . . : %d", ptr_buffer->nicklist);
@ -1060,10 +1129,17 @@ gui_buffer_print_log ()
while (ptr_line)
{
num--;
log_printf (" line N-%05d: str_time:'%s', prefix:'%s'",
num, ptr_line->str_time, ptr_line->prefix);
tags = string_build_with_exploded (ptr_line->tags_array, ",");
log_printf (" line N-%05d: str_time:'%s', tags:'%s', "
"displayed:%d, prefix:'%s'",
num, ptr_line->str_time,
(tags) ? tags : "",
(int)(ptr_line->displayed),
ptr_line->prefix);
log_printf (" data: '%s'",
ptr_line->message);
ptr_line->message);
if (tags)
free (tags);
ptr_line = ptr_line->next_line;
}

View File

@ -43,6 +43,9 @@ struct t_gui_line
time_t date; /* date/time of line (may be past) */
time_t date_printed; /* date/time when weechat print it */
char *str_time; /* time string (for display) */
int tags_count; /* number of tags for line */
char **tags_array; /* tags for line */
char displayed; /* 1 if line is displayed */
char *prefix; /* prefix for line (may be NULL) */
int prefix_length; /* prefix length (on screen) */
char *message; /* line content (after prefix) */
@ -78,6 +81,7 @@ struct t_gui_buffer
struct t_gui_line *last_line; /* last line of chat window */
struct t_gui_line *last_read_line; /* last read line before jump */
int lines_count; /* number of lines in the buffer */
int lines_hidden; /* 1 if at least one line is hidden */
int prefix_max_length; /* length for prefix align */
int chat_refresh_needed; /* refresh for chat is needed ? */
@ -132,7 +136,6 @@ struct t_gui_buffer
extern struct t_gui_buffer *gui_buffers;
extern struct t_gui_buffer *last_gui_buffer;
extern struct t_gui_buffer *gui_previous_buffer;
extern struct t_gui_buffer *gui_buffer_before_dcc;
/* buffer functions */
@ -146,7 +149,10 @@ extern struct t_gui_buffer *gui_buffer_new (struct t_weechat_plugin *plugin,
struct t_gui_buffer *buffer),
void *close_callback_data);
extern int gui_buffer_valid (struct t_gui_buffer *buffer);
extern void *gui_buffer_get (struct t_gui_buffer *buffer, char *property);
extern char *gui_buffer_get_string (struct t_gui_buffer *buffer,
char *property);
extern void *gui_buffer_get_pointer (struct t_gui_buffer *buffer,
char *property);
extern void gui_buffer_set_category (struct t_gui_buffer *buffer,
char *category);
extern void gui_buffer_set_name (struct t_gui_buffer *buffer, char *name);
@ -165,6 +171,8 @@ extern struct t_gui_buffer *gui_buffer_search_by_category_name (char *category,
extern struct t_gui_buffer *gui_buffer_search_by_number (int number);
extern struct t_gui_window *gui_buffer_find_window (struct t_gui_buffer *buffer);
extern int gui_buffer_is_scrolled (struct t_gui_buffer *buffer);
extern int gui_buffer_match_category_name (struct t_gui_buffer *buffer,
char *mask, int case_sensitive);
extern struct t_gui_buffer *gui_buffer_get_dcc (struct t_gui_window *window);
extern void gui_buffer_clear (struct t_gui_buffer *buffer);
extern void gui_buffer_clear_all ();

View File

@ -27,6 +27,7 @@
#include <string.h>
#include <stdarg.h>
#include <ctype.h>
#include <regex.h>
#include "../core/weechat.h"
#include "../core/wee-config.h"
@ -34,9 +35,11 @@
#include "../core/wee-log.h"
#include "../core/wee-string.h"
#include "../core/wee-utf8.h"
#include "../plugins/plugin.h"
#include "gui-chat.h"
#include "gui-buffer.h"
#include "gui-color.h"
#include "gui-filter.h"
#include "gui-hotlist.h"
#include "gui-main.h"
#include "gui-status.h"
@ -374,6 +377,94 @@ gui_chat_get_line_align (struct t_gui_buffer *buffer, struct t_gui_line *line,
length_suffix + 1;
}
/*
* gui_chat_line_displayed: return 1 if line is displayed (no filter on line,
* or filters disabled), 0 if line is hidden
*/
int
gui_chat_line_displayed (struct t_gui_line *line)
{
/* line is hidden if filters are enabled and flag "displayed" is not set */
if (gui_filters_enabled && !line->displayed)
return 0;
/* in all other cases, line is displayed */
return 1;
}
/*
* gui_chat_get_first_line_displayed: get first line displayed of a buffer
*/
struct t_gui_line *
gui_chat_get_first_line_displayed (struct t_gui_buffer *buffer)
{
struct t_gui_line *ptr_line;
ptr_line = buffer->lines;
while (ptr_line && !gui_chat_line_displayed (ptr_line))
{
ptr_line = ptr_line->next_line;
}
return ptr_line;
}
/*
* gui_chat_get_last_line_displayed: get last line displayed of a buffer
*/
struct t_gui_line *
gui_chat_get_last_line_displayed (struct t_gui_buffer *buffer)
{
struct t_gui_line *ptr_line;
ptr_line = buffer->last_line;
while (ptr_line && !gui_chat_line_displayed (ptr_line))
{
ptr_line = ptr_line->prev_line;
}
return ptr_line;
}
/*
* gui_chat_get_prev_line_displayed: get previous line displayed
*/
struct t_gui_line *
gui_chat_get_prev_line_displayed (struct t_gui_line *line)
{
if (line)
{
line = line->prev_line;
while (line && !gui_chat_line_displayed (line))
{
line = line->prev_line;
}
}
return line;
}
/*
* gui_chat_get_next_line_displayed: get next line displayed
*/
struct t_gui_line *
gui_chat_get_next_line_displayed (struct t_gui_line *line)
{
if (line)
{
line = line->next_line;
while (line && !gui_chat_line_displayed (line))
{
line = line->next_line;
}
}
return line;
}
/*
* gui_chat_line_search: search for text in a line
*/
@ -399,6 +490,78 @@ gui_chat_line_search (struct t_gui_line *line, char *text, int case_sensitive)
return rc;
}
/*
* gui_chat_line_match_regex: return 1 if message matches regex
* 0 if it doesn't match
*/
int
gui_chat_line_match_regex (struct t_gui_line *line, regex_t *regex_prefix,
regex_t *regex_message)
{
char *prefix, *message;
int match_prefix, match_message;
if (!line || (!regex_prefix && !regex_message))
return 0;
match_prefix = 1;
match_message = 1;
prefix = (char *)gui_color_decode ((unsigned char *)line->prefix);
if (prefix && regex_prefix)
{
if (regexec (regex_prefix, prefix, 0, NULL, 0) != 0)
match_prefix = 0;
}
message = (char *)gui_color_decode ((unsigned char *)line->message);
if (message && regex_message)
{
if (regexec (regex_message, message, 0, NULL, 0) != 0)
match_message = 0;
}
if (prefix)
free (prefix);
if (message)
free (message);
return (match_prefix && match_message);
}
/*
* gui_chat_line_match_tags: return 1 if line matches tags
* 0 if it doesn't match any tag in array
*/
int
gui_chat_line_match_tags (struct t_gui_line *line, int tags_count,
char **tags_array)
{
int i, j;
if (!line)
return 0;
if (line->tags_count == 0)
return 0;
for (i = 0; i < tags_count; i++)
{
for (j = 0; j < line->tags_count; j++)
{
/* check tag */
if (string_match (line->tags_array[j],
tags_array[i],
0))
return 1;
}
}
return 0;
}
/*
* gui_chat_line_free: delete a line from a buffer
*/
@ -420,6 +583,8 @@ gui_chat_line_free (struct t_gui_line *line)
}
if (line->str_time)
free (line->str_time);
if (line->tags_array)
string_free_exploded (line->tags_array);
if (line->prefix)
free (line->prefix);
if (line->message)
@ -433,7 +598,8 @@ gui_chat_line_free (struct t_gui_line *line)
void
gui_chat_line_add (struct t_gui_buffer *buffer, time_t date,
time_t date_printed, char *prefix, char *message)
time_t date_printed, char *tags,
char *prefix, char *message)
{
struct t_gui_line *new_line, *ptr_line;
@ -449,6 +615,16 @@ gui_chat_line_add (struct t_gui_buffer *buffer, time_t date,
new_line->date_printed = date_printed;
new_line->str_time = (date == 0) ?
NULL : gui_chat_get_time_string (date);
if (tags)
{
new_line->tags_array = string_explode (tags, ",", 0, 0,
&new_line->tags_count);
}
else
{
new_line->tags_count = 0;
new_line->tags_array = NULL;
}
new_line->prefix = (prefix) ?
strdup (prefix) : ((date != 0) ? strdup ("") : NULL);
new_line->prefix_length = (prefix) ?
@ -465,6 +641,18 @@ gui_chat_line_add (struct t_gui_buffer *buffer, time_t date,
buffer->last_line = new_line;
buffer->lines_count++;
/* check if line is filtered or not */
new_line->displayed = gui_filter_check_line (buffer, new_line);
if (!new_line->displayed)
{
if (!buffer->lines_hidden)
{
buffer->lines_hidden = 1;
hook_signal_send ("buffer_lines_hidden",
WEECHAT_HOOK_SIGNAL_POINTER, buffer);
}
}
/* remove one line if necessary */
if ((CONFIG_INTEGER(config_history_max_lines) > 0)
&& (buffer->lines_count > CONFIG_INTEGER(config_history_max_lines)))
@ -480,12 +668,13 @@ gui_chat_line_add (struct t_gui_buffer *buffer, time_t date,
}
/*
* gui_chat_printf_date: display a message in a buffer
* gui_chat_printf_date_tags: display a message in a buffer with optional
* date and tags
*/
void
gui_chat_printf_date (struct t_gui_buffer *buffer, time_t date,
char *message, ...)
gui_chat_printf_date_tags (struct t_gui_buffer *buffer, time_t date,
char *tags, char *message, ...)
{
char buf[8192];
time_t date_printed;
@ -552,11 +741,15 @@ gui_chat_printf_date (struct t_gui_buffer *buffer, time_t date,
{
gui_chat_line_add (buffer, (display_time) ? date : 0,
(display_time) ? date_printed : 0,
pos_prefix, pos);
tags, pos_prefix, pos);
if (buffer->last_line)
{
hook_print_exec (buffer, buffer->last_line->date,
buffer->last_line->tags_count,
buffer->last_line->tags_array,
buffer->last_line->prefix,
buffer->last_line->message);
}
}
else
{

View File

@ -20,12 +20,14 @@
#ifndef __WEECHAT_GUI_CHAT_H
#define __WEECHAT_GUI_CHAT_H 1
#include <regex.h>
struct t_gui_window;
struct t_gui_buffer;
struct t_gui_line;
#define gui_chat_printf(buffer, argz...) \
gui_chat_printf_date(buffer, 0, ##argz) \
#define gui_chat_printf(buffer, argz...) \
gui_chat_printf_date_tags(buffer, 0, NULL, ##argz)
enum t_gui_prefix
{
@ -58,11 +60,22 @@ extern void gui_chat_change_time_format ();
extern int gui_chat_get_line_align (struct t_gui_buffer *buffer,
struct t_gui_line *line,
int with_suffix);
extern int gui_chat_line_displayed (struct t_gui_line *line);
extern struct t_gui_line *gui_chat_get_first_line_displayed (struct t_gui_buffer *buffer);
extern struct t_gui_line *gui_chat_get_last_line_displayed (struct t_gui_buffer *buffer);
extern struct t_gui_line *gui_chat_get_prev_line_displayed (struct t_gui_line *line);
extern struct t_gui_line *gui_chat_get_next_line_displayed (struct t_gui_line *line);
extern int gui_chat_line_search (struct t_gui_line *line, char *text,
int case_sensitive);
extern int gui_chat_line_match_regex (struct t_gui_line *line,
regex_t *regex_prefix,
regex_t *regex_message);
extern int gui_chat_line_match_tags (struct t_gui_line *line, int tags_count,
char **tags_array);
extern void gui_chat_line_free (struct t_gui_line *line);
extern void gui_chat_printf_date (struct t_gui_buffer *buffer, time_t date,
char *message, ...);
extern void gui_chat_printf_date_tags (struct t_gui_buffer *buffer,
time_t date, char *tags,
char *message, ...);
/* chat functions (GUI dependent) */

View File

@ -116,3 +116,16 @@ gui_color_decode (unsigned char *string)
out[out_pos] = '\0';
return out;
}
/*
* gui_color_free: free a color
*/
void
gui_color_free (struct t_gui_color *color)
{
if (color->string)
free (color->string);
free (color);
}

View File

@ -147,6 +147,7 @@ extern struct t_gui_color *gui_color[GUI_NUM_COLORS];
extern int gui_color_search_config (char *color_name);
extern unsigned char *gui_color_decode (unsigned char *string);
extern void gui_color_free (struct t_gui_color *color);
/* color functions (GUI dependent) */

View File

@ -261,6 +261,27 @@ gui_completion_list_add_buffers_names (struct t_gui_completion *completion)
}
}
/*
* gui_completion_list_add_buffers_categories_names: add buffers categories
* and names to completion
* list
*/
void
gui_completion_list_add_buffers_categories_names (struct t_gui_completion *completion)
{
struct t_gui_buffer *ptr_buffer;
char name[256];
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
snprintf (name, sizeof (name), "%s.%s",
ptr_buffer->category, ptr_buffer->name);
gui_completion_list_add (completion, name, 0, WEECHAT_LIST_POS_SORT);
}
}
/*
* gui_completion_list_add_buffers_categories: add buffers categories to
* completion list
@ -728,6 +749,9 @@ gui_completion_build_list_template (struct t_gui_completion *completion,
case 'b': /* buffers names */
gui_completion_list_add_buffers_names (completion);
break;
case 'B': /* buffers categories + names */
gui_completion_list_add_buffers_categories_names (completion);
break;
case 'c': /* buffers categories */
gui_completion_list_add_buffers_categories (completion);
break;

426
src/gui/gui-filter.c Normal file
View File

@ -0,0 +1,426 @@
/*
* 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/>.
*/
/* gui-filter.c: filter functions, used by all GUI */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <string.h>
#include <regex.h>
#include "../core/weechat.h"
#include "../core/wee-hook.h"
#include "../core/wee-log.h"
#include "../core/wee-string.h"
#include "../plugins/plugin.h"
#include "gui-filter.h"
#include "gui-buffer.h"
#include "gui-chat.h"
struct t_gui_filter *gui_filters = NULL; /* first filter */
struct t_gui_filter *last_gui_filter = NULL; /* last filter */
int gui_filters_enabled = 1; /* filters enabled? */
/*
* gui_filter_enable: enable filters
*/
void
gui_filter_enable ()
{
struct t_gui_buffer *ptr_buffer;
if (!gui_filters_enabled)
{
gui_filters_enabled = 1;
/* ask refresh for buffer with hidden lines */
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
if (ptr_buffer->lines_hidden)
{
hook_signal_send ("buffer_lines_hidden",
WEECHAT_HOOK_SIGNAL_POINTER, ptr_buffer);
}
if (ptr_buffer->lines_hidden)
ptr_buffer->chat_refresh_needed = 1;
}
}
hook_signal_send ("filters_enabled",
WEECHAT_HOOK_SIGNAL_STRING, NULL);
}
/*
* gui_filter_disable: disable filters
*/
void
gui_filter_disable ()
{
struct t_gui_buffer *ptr_buffer;
if (gui_filters_enabled)
{
gui_filters_enabled = 0;
/* ask refresh for buffer with hidden lines */
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
if (ptr_buffer->lines_hidden)
{
hook_signal_send ("buffer_lines_hidden",
WEECHAT_HOOK_SIGNAL_POINTER, ptr_buffer);
}
if (ptr_buffer->lines_hidden)
ptr_buffer->chat_refresh_needed = 1;
}
}
hook_signal_send ("filters_disabled",
WEECHAT_HOOK_SIGNAL_STRING, NULL);
}
/*
* gui_filter_check_line: return 1 if a line should be displayed, or
* 0 if line is hidden (tag or regex found)
*/
int
gui_filter_check_line (struct t_gui_buffer *buffer, struct t_gui_line *line)
{
struct t_gui_filter *ptr_filter;
/* make C compiler happy */
(void) buffer;
for (ptr_filter = gui_filters; ptr_filter;
ptr_filter = ptr_filter->next_filter)
{
/* check buffer name */
if (gui_buffer_match_category_name (buffer,
ptr_filter->buffer, 0))
{
/* check line with regex */
if (gui_chat_line_match_regex (line,
ptr_filter->regex_prefix,
ptr_filter->regex_message))
return 0;
if ((strcmp (ptr_filter->tags, "*") != 0)
&& (gui_chat_line_match_tags (line,
ptr_filter->tags_count,
ptr_filter->tags_array)))
return 0;
}
}
/* no tag or regex matching, then line is displayed */
return 1;
}
/*
* gui_filter_buffer: filter a buffer, using message filters
*/
void
gui_filter_buffer (struct t_gui_buffer *buffer)
{
struct t_gui_line *ptr_line;
int line_displayed, lines_hidden;
lines_hidden = 0;
for (ptr_line = buffer->lines; ptr_line;
ptr_line = ptr_line->next_line)
{
line_displayed = gui_filter_check_line (buffer, ptr_line);
/* force chat refresh if at least one line changed */
if (ptr_line->displayed != line_displayed)
buffer->chat_refresh_needed = 1;
ptr_line->displayed = line_displayed;
if (!line_displayed)
lines_hidden = 1;
}
if (buffer->lines_hidden != lines_hidden)
{
buffer->lines_hidden = lines_hidden;
hook_signal_send ("buffer_lines_hidden",
WEECHAT_HOOK_SIGNAL_POINTER, buffer);
}
}
/*
* gui_filter_all_buffers: filter all buffers, using message filters
*/
void
gui_filter_all_buffers ()
{
struct t_gui_buffer *ptr_buffer;
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
gui_filter_buffer (ptr_buffer);
}
}
/*
* gui_filter_search: search a filter
*/
struct t_gui_filter *
gui_filter_search (char *buffer, char *tags, char *regex)
{
struct t_gui_filter *ptr_filter;
for (ptr_filter = gui_filters; ptr_filter;
ptr_filter = ptr_filter->next_filter)
{
if ((strcmp (ptr_filter->buffer, buffer) == 0)
&& (strcmp (ptr_filter->tags, tags) == 0)
&& (strcmp (ptr_filter->regex, regex) == 0))
return ptr_filter;
}
/* no filter found */
return NULL;
}
/*
* gui_filter_search_by_number: search a filter by number (first is #1)
*/
struct t_gui_filter *
gui_filter_search_by_number (int number)
{
struct t_gui_filter *ptr_filter;
int i;
i = 1;
for (ptr_filter = gui_filters; ptr_filter;
ptr_filter = ptr_filter->next_filter)
{
if (i == number)
return ptr_filter;
i++;
}
/* no filter found */
return NULL;
}
/*
* gui_filter_new: create a new filter
*/
struct t_gui_filter *
gui_filter_new (char *buffer, char *tags, char *regex)
{
struct t_gui_filter *new_filter;
regex_t *regex1, *regex2;
char *pos_tab, *regex_prefix, *pos_regex_message;
if (!buffer || !tags || !regex)
return NULL;
regex1 = NULL;
regex2 = NULL;
if (strcmp (regex, "*") != 0)
{
pos_tab = strstr (regex, "\\t");
if (pos_tab)
{
regex_prefix = string_strndup (regex, pos_tab - regex);
pos_regex_message = pos_tab + 2;
}
else
{
regex_prefix = strdup (regex);
pos_regex_message = regex;
}
if (!regex_prefix)
return NULL;
regex1 = (regex_t *)malloc (sizeof (regex_t));
if (regex1)
{
if (regcomp (regex1, regex_prefix,
REG_NOSUB | REG_ICASE) != 0)
{
free (regex_prefix);
free (regex1);
return NULL;
}
}
regex2 = (regex_t *)malloc (sizeof (regex_t));
if (regex2)
{
if (regcomp (regex2, pos_regex_message,
REG_NOSUB | REG_ICASE) != 0)
{
free (regex_prefix);
if (regex1)
free (regex1);
free (regex2);
return NULL;
}
}
free (regex_prefix);
}
/* create new filter */
new_filter = (struct t_gui_filter *)(malloc (sizeof (struct t_gui_filter)));
if (new_filter)
{
/* init filter */
new_filter->buffer = (buffer) ? strdup (buffer) : strdup ("*");
if (tags)
{
new_filter->tags = (tags) ? strdup (tags) : NULL;
new_filter->tags_array = string_explode (tags, ",", 0, 0,
&new_filter->tags_count);
}
else
{
new_filter->tags = NULL;
new_filter->tags_count = 0;
new_filter->tags_array = NULL;
}
new_filter->regex = strdup (regex);
new_filter->regex_prefix = regex1;
new_filter->regex_message = regex2;
/* add filter to filters list */
new_filter->prev_filter = last_gui_filter;
if (gui_filters)
last_gui_filter->next_filter = new_filter;
else
gui_filters = new_filter;
last_gui_filter = new_filter;
new_filter->next_filter = NULL;
gui_filter_all_buffers ();
hook_signal_send ("filter_added",
WEECHAT_HOOK_SIGNAL_POINTER, new_filter);
}
return new_filter;
}
/*
* gui_filter_free: remove a filter
*/
void
gui_filter_free (struct t_gui_filter *filter)
{
hook_signal_send ("filter_removing",
WEECHAT_HOOK_SIGNAL_POINTER, filter);
/* free data */
if (filter->buffer)
free (filter->buffer);
if (filter->tags)
free (filter->tags);
if (filter->regex)
free (filter->regex);
if (filter->regex_prefix)
{
regfree (filter->regex_prefix);
free (filter->regex_prefix);
}
if (filter->regex_message)
{
regfree (filter->regex_message);
free (filter->regex_message);
}
/* remove filter from filters list */
if (filter->prev_filter)
filter->prev_filter->next_filter = filter->next_filter;
if (filter->next_filter)
filter->next_filter->prev_filter = filter->prev_filter;
if (gui_filters == filter)
gui_filters = filter->next_filter;
if (last_gui_filter == filter)
last_gui_filter = filter->prev_filter;
free (filter);
gui_filter_all_buffers ();
hook_signal_send ("filter_removed", WEECHAT_HOOK_SIGNAL_STRING, NULL);
}
/*
* gui_filter_free_all: remove all filters
*/
void
gui_filter_free_all ()
{
while (gui_filters)
{
gui_filter_free (gui_filters);
}
}
/*
* gui_filter_print_log: print filter infos in log (usually for crash dump)
*/
void
gui_filter_print_log ()
{
struct t_gui_filter *ptr_filter;
log_printf ("");
log_printf ("gui_filters_enabled = %d", gui_filters_enabled);
for (ptr_filter = gui_filters; ptr_filter;
ptr_filter = ptr_filter->next_filter)
{
log_printf ("");
log_printf ("[filter (addr:0x%x)]", ptr_filter);
log_printf (" buffer . . . . . . . . : '%s'", ptr_filter->buffer);
log_printf (" tags . . . . . . . . . : '%s'", ptr_filter->tags);
log_printf (" regex. . . . . . . . . : '%s'", ptr_filter->regex);
log_printf (" regex_prefix . . . . . : 0x%x", ptr_filter->regex_prefix);
log_printf (" regex_message. . . . . : 0x%x", ptr_filter->regex_message);
log_printf (" prev_filter. . . . . . : 0x%x", ptr_filter->prev_filter);
log_printf (" next_filter. . . . . . : 0x%x", ptr_filter->next_filter);
}
}

63
src/gui/gui-filter.h Normal file
View File

@ -0,0 +1,63 @@
/*
* 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_GUI_FILTER_H
#define __WEECHAT_GUI_FILTER_H 1
#include <regex.h>
/* filter structures */
struct t_gui_line;
struct t_gui_filter
{
char *buffer; /* name of buffer */
char *tags; /* tags */
int tags_count; /* number of tags */
char **tags_array; /* array of tags */
char *regex; /* regex */
regex_t *regex_prefix; /* regex for line prefix */
regex_t *regex_message; /* regex for line message */
struct t_gui_filter *prev_filter; /* link to previous line */
struct t_gui_filter *next_filter; /* link to next line */
};
/* filter variables */
extern struct t_gui_filter *gui_filters;
extern struct t_gui_filter *last_gui_filter;
extern int gui_filters_enabled;
/* filter functions */
extern void gui_filter_enable ();
extern void gui_filter_disable ();
extern int gui_filter_check_line (struct t_gui_buffer *buffer,
struct t_gui_line *line);
extern struct t_gui_filter *gui_filter_search (char *buffer, char *tags,
char *regex);
extern struct t_gui_filter *gui_filter_search_by_number (int number);
extern struct t_gui_filter *gui_filter_new (char *buffer, char *tags,
char *regex);
extern void gui_filter_free (struct t_gui_filter *filter);
extern void gui_filter_free_all ();
extern void gui_filter_print_log ();
#endif /* gui-filter.h */

View File

@ -714,7 +714,9 @@ void
gui_keyboard_free_all ()
{
while (gui_keys)
{
gui_keyboard_free (gui_keys);
}
}
/*
@ -827,3 +829,18 @@ gui_keyboard_paste_cancel ()
gui_keyboard_buffer_reset ();
gui_keyboard_paste_pending = 0;
}
/*
* gui_keyboard_end: end keyboard (free some data)
*/
void
gui_keyboard_end ()
{
/* free keyboard buffer */
if (gui_keyboard_buffer)
free (gui_keyboard_buffer);
/* free all keys */
gui_keyboard_free_all ();
}

View File

@ -76,6 +76,7 @@ extern void gui_keyboard_buffer_add (int key);
extern int gui_keyboard_get_paste_lines ();
extern void gui_keyboard_paste_accept ();
extern void gui_keyboard_paste_cancel ();
extern void gui_keyboard_end ();
/* keyboard functions (GUI dependent) */

View File

@ -39,6 +39,7 @@
#include "gui-window.h"
#include "gui-buffer.h"
#include "gui-chat.h"
#include "gui-filter.h"
#include "gui-input.h"
#include "gui-hotlist.h"
#include "gui-status.h"
@ -280,7 +281,11 @@ gui_window_free (struct t_gui_window *window)
window->buffer->num_displayed--;
/* free data */
gui_window_objects_free (window, 1);
if (window->gui_objects)
{
gui_window_objects_free (window, 1);
free (window->gui_objects);
}
/* remove window from windows list */
if (window->prev_window)
@ -448,7 +453,7 @@ gui_window_scroll (struct t_gui_window *window, char *scroll)
number = 0;
time_letter = ' ';
// search direction
/* search direction */
if (scroll[0] == '-')
{
direction = -1;
@ -460,7 +465,7 @@ gui_window_scroll (struct t_gui_window *window, char *scroll)
scroll++;
}
// search number and letter
/* search number and letter */
char *pos = scroll;
while (pos && pos[0] && isdigit (pos[0]))
{
@ -481,7 +486,7 @@ gui_window_scroll (struct t_gui_window *window, char *scroll)
pos[0] = '\0';
error = NULL;
number = strtol (scroll, &error, 10);
if (!error || (error[0] != '\0'))
if (!error || error[0])
number = 0;
pos[0] = saved_char;
}
@ -491,15 +496,27 @@ gui_window_scroll (struct t_gui_window *window, char *scroll)
if ((number == 0) && (time_letter == ' '))
return;
// do the scroll!
/* do the scroll! */
stop = 0;
count_msg = 0;
if (direction < 0)
{
ptr_line = (window->start_line) ?
window->start_line : window->buffer->last_line;
while (ptr_line && !gui_chat_line_displayed (ptr_line))
{
ptr_line = ptr_line->prev_line;
}
}
else
{
ptr_line = (window->start_line) ?
window->start_line : window->buffer->lines;
while (ptr_line && !gui_chat_line_displayed (ptr_line))
{
ptr_line = ptr_line->next_line;
}
}
old_date = ptr_line->date;
date_tmp = localtime (&old_date);
@ -507,7 +524,8 @@ gui_window_scroll (struct t_gui_window *window, char *scroll)
while (ptr_line)
{
ptr_line = (direction < 0) ? ptr_line->prev_line : ptr_line->next_line;
ptr_line = (direction < 0) ?
gui_chat_get_prev_line_displayed (ptr_line) : gui_chat_get_next_line_displayed (ptr_line);
if (ptr_line)
{
@ -614,7 +632,7 @@ gui_window_scroll (struct t_gui_window *window, char *scroll)
window->start_line = ptr_line;
window->start_line_pos = 0;
window->first_line_displayed =
(window->start_line == window->buffer->lines);
(window->start_line == gui_chat_get_first_line_displayed (window->buffer));
window->buffer->chat_refresh_needed = 1;
gui_status_refresh_needed = 1;
return;
@ -644,6 +662,10 @@ gui_window_search_text (struct t_gui_window *window)
{
ptr_line = (window->start_line) ?
window->start_line->prev_line : window->buffer->last_line;
while (ptr_line && !gui_chat_line_displayed (ptr_line))
{
ptr_line = ptr_line->prev_line;
}
while (ptr_line)
{
if (gui_chat_line_search (ptr_line,
@ -653,12 +675,12 @@ gui_window_search_text (struct t_gui_window *window)
window->start_line = ptr_line;
window->start_line_pos = 0;
window->first_line_displayed =
(window->start_line == window->buffer->lines);
(window->start_line == gui_chat_get_first_line_displayed (window->buffer));
window->buffer->chat_refresh_needed = 1;
gui_status_refresh_needed = 1;
return 1;
}
ptr_line = ptr_line->prev_line;
ptr_line = gui_chat_get_prev_line_displayed (ptr_line);
}
}
}
@ -669,6 +691,10 @@ gui_window_search_text (struct t_gui_window *window)
{
ptr_line = (window->start_line) ?
window->start_line->next_line : window->buffer->lines->next_line;
while (ptr_line && !gui_chat_line_displayed (ptr_line))
{
ptr_line = ptr_line->next_line;
}
while (ptr_line)
{
if (gui_chat_line_search (ptr_line,
@ -683,7 +709,7 @@ gui_window_search_text (struct t_gui_window *window)
gui_status_refresh_needed = 1;
return 1;
}
ptr_line = ptr_line->next_line;
ptr_line = gui_chat_get_next_line_displayed (ptr_line);
}
}
}

View File

@ -147,8 +147,8 @@ demo_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
"buffer_input_data_cb: buffer = %x (%s / %s), "
"input_data = '%s'",
buffer,
weechat_buffer_get (buffer, "category"),
weechat_buffer_get (buffer, "name"),
weechat_buffer_get_string (buffer, "category"),
weechat_buffer_get_string (buffer, "name"),
input_data);
return WEECHAT_RC_OK;
@ -169,8 +169,8 @@ demo_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
weechat_printf (NULL,
"buffer_close_cb: buffer = %x (%s / %s)",
buffer,
weechat_buffer_get (buffer, "category"),
weechat_buffer_get (buffer, "name"));
weechat_buffer_get_string (buffer, "category"),
weechat_buffer_get_string (buffer, "name"));
}
return WEECHAT_RC_OK;

View File

@ -169,12 +169,14 @@ irc_channel_free (struct t_irc_server *server, struct t_irc_channel *channel)
free (channel->modes);
if (channel->key)
free (channel->key);
//irc_nick_free_all (channel);
irc_nick_free_all (channel);
if (channel->away_message)
free (channel->away_message);
if (channel->nicks_speaking)
weechat_list_free (channel->nicks_speaking);
free (channel);
server->channels = new_channels;
}

View File

@ -568,7 +568,7 @@ irc_command_connect (void *data, struct t_gui_buffer *buffer, int argc,
}
error = NULL;
number = strtol (argv[++i], &error, 10);
if (error && (error[0] == '\0'))
if (error && !error[0])
port = number;
}
}

View File

@ -352,9 +352,10 @@ irc_nick_free (struct t_irc_channel *channel, struct t_irc_nick *nick)
free (nick->name);
if (nick->host)
free (nick->host);
free (nick);
channel->nicks = new_nicks;
free (nick);
channel->nicks = new_nicks;
channel->nick_completion_reset = 1;
}

File diff suppressed because it is too large Load Diff

View File

@ -46,7 +46,7 @@ struct t_irc_server;
typedef int (t_irc_recv_func)(struct t_irc_server *server, char *comand,
int argc, char **argv, char **argv_eol,
int ignore, int highlight);
int highlight);
struct t_irc_protocol_msg
{

View File

@ -315,7 +315,7 @@ irc_server_set_addresses (struct t_irc_server *server, char *addresses)
pos++;
error = NULL;
number = strtol (pos, &error, 10);
server->ports_array[i] = (error && (error[0] == '\0')) ?
server->ports_array[i] = (error && !error[0]) ?
number : IRC_SERVER_DEFAULT_PORT;
}
else
@ -990,6 +990,124 @@ irc_server_outqueue_send (struct t_irc_server *server)
}
}
/*
* irc_server_parse_message: parse IRC message and return pointer to
* host, command, channel, target nick and arguments
* (if any)
*/
void
irc_server_parse_message (char *message, char **nick, char **host,
char **command, char **channel, char **arguments)
{
char *pos, *pos2, *pos3, *pos4;
if (nick)
*nick = NULL;
if (host)
*host = NULL;
if (command)
*command = NULL;
if (channel)
*channel = NULL;
if (arguments)
*arguments = NULL;
if (message[0] == ':')
{
pos2 = strchr (message, '!');
pos = strchr (message, ' ');
if (pos2)
{
if (nick)
*nick = weechat_strndup (message + 1, pos2 - (message + 1));
}
else if (pos)
{
if (nick)
*nick = weechat_strndup (message + 1, pos - (message + 1));
}
if (pos)
{
if (host)
*host = weechat_strndup (message + 1, pos - (message + 1));
pos++;
}
else
pos = message;
}
else
pos = message;
if (pos && pos[0])
{
while (pos[0] == ' ')
{
pos++;
}
pos2 = strchr (pos, ' ');
if (pos2)
{
if (command)
*command = weechat_strndup (pos, pos2 - pos);
pos2++;
while (pos2[0] == ' ')
{
pos2++;
}
if (arguments)
*arguments = strdup (pos2);
if (pos2[0] != ':')
{
if (irc_channel_is_channel (pos2))
{
pos3 = strchr (pos2, ' ');
if (channel)
{
if (pos3)
*channel = weechat_strndup (pos2, pos3 - pos2);
else
*channel = strdup (pos2);
}
}
else
{
pos3 = strchr (pos2, ' ');
if (nick && !*nick)
{
if (nick)
{
if (pos3)
*nick = weechat_strndup (pos2, pos3 - pos2);
else
*nick = strdup (pos2);
}
}
if (pos3)
{
pos3++;
while (pos3[0] == ' ')
{
pos3++;
}
if (irc_channel_is_channel (pos3))
{
pos4 = strchr (pos3, ' ');
if (channel)
{
if (pos4)
*channel = weechat_strndup (pos3, pos4 - pos3);
else
*channel = strdup (pos3);
}
}
}
}
}
}
}
}
/*
* irc_server_send_one_msg: send one message to IRC server
*/
@ -998,20 +1116,24 @@ int
irc_server_send_one_msg (struct t_irc_server *server, char *message)
{
static char buffer[4096];
char *new_msg, *ptr_msg, *pos;
char *new_msg, *ptr_msg, *pos, *nick, *command, *channel;
char *ptr_chan_nick, *msg_encoded;
char str_modifier[64], modifier_data[256];
int rc, queue, first_message;
time_t time_now;
rc = 1;
/*new_msg = plugin_modifier_exec (PLUGIN_MODIFIER_IRC_OUT,
server->name,
message)
*/
new_msg = NULL;
irc_server_parse_message (message, &nick, NULL, &command, &channel, NULL);
snprintf (str_modifier, sizeof (str_modifier),
"irc_out_%s",
(command) ? command : "unknown");
new_msg = weechat_hook_modifier_exec (str_modifier,
server->name,
message);
/* no changes in new message */
if (new_msg && (strcmp (buffer, new_msg) == 0))
if (new_msg && (strcmp (message, new_msg) == 0))
{
free (new_msg);
new_msg = NULL;
@ -1022,6 +1144,31 @@ irc_server_send_one_msg (struct t_irc_server *server, char *message)
{
first_message = 1;
ptr_msg = (new_msg) ? new_msg : message;
msg_encoded = NULL;
ptr_chan_nick = (channel) ? channel : nick;
if (ptr_chan_nick)
{
snprintf (modifier_data, sizeof (modifier_data),
"%s.%s.%s",
weechat_plugin->name,
server->name,
ptr_chan_nick);
}
else
{
snprintf (modifier_data, sizeof (modifier_data),
"%s.%s.%s",
weechat_plugin->name,
server->name,
ptr_chan_nick);
}
msg_encoded = weechat_hook_modifier_exec ("charset_decode",
modifier_data,
ptr_msg);
if (msg_encoded)
ptr_msg = msg_encoded;
while (rc && ptr_msg && ptr_msg[0])
{
@ -1073,9 +1220,18 @@ irc_server_send_one_msg (struct t_irc_server *server, char *message)
first_message = 0;
}
if (msg_encoded)
free (msg_encoded);
}
else
irc_debug_printf (server, 1, 1, _("(message dropped)"));
if (nick)
free (nick);
if (command)
free (command);
if (channel)
free (channel);
if (new_msg)
free (new_msg);
@ -1124,95 +1280,6 @@ irc_server_sendf (struct t_irc_server *server, char *format, ...)
}
}
/*
* irc_server_parse_message: parse IRC message and return pointer to
* host, command, channel, target nick and arguments
* (if any)
*/
void
irc_server_parse_message (char *message, char **nick, char **host,
char **command, char **channel, char **arguments)
{
char *pos, *pos2, *pos3, *pos4;
*nick = NULL;
*host = NULL;
*command = NULL;
*channel = NULL;
*arguments = NULL;
if (message[0] == ':')
{
pos2 = strchr (message, '!');
pos = strchr (message, ' ');
if (pos2)
*nick = weechat_strndup (message + 1, pos2 - (message + 1));
else if (pos)
*nick = weechat_strndup (message + 1, pos - (message + 1));
if (pos)
{
*host = weechat_strndup (message + 1, pos - (message + 1));
pos++;
}
else
pos = message;
}
else
pos = message;
if (pos && pos[0])
{
while (pos[0] == ' ')
pos++;
pos2 = strchr (pos, ' ');
if (pos2)
{
*command = weechat_strndup (pos, pos2 - pos);
pos2++;
while (pos2[0] == ' ')
pos2++;
*arguments = strdup (pos2);
if (pos2[0] != ':')
{
if (irc_channel_is_channel (pos2))
{
pos3 = strchr (pos2, ' ');
if (pos3)
*channel = weechat_strndup (pos2, pos3 - pos2);
else
*channel = strdup (pos2);
}
else
{
pos3 = strchr (pos2, ' ');
if (!*nick)
{
if (pos3)
*nick = weechat_strndup (pos2, pos3 - pos2);
else
*nick = strdup (pos2);
}
if (pos3)
{
pos3++;
while (pos3[0] == ' ')
pos3++;
if (irc_channel_is_channel (pos3))
{
pos4 = strchr (pos3, ' ');
if (pos4)
*channel = weechat_strndup (pos3, pos4 - pos3);
else
*channel = strdup (pos3);
}
}
}
}
}
}
}
/*
* irc_server_msgq_add_msg: add a message to received messages queue (at the end)
*/
@ -1257,7 +1324,7 @@ irc_server_msgq_add_msg (struct t_irc_server *server, char *msg)
else
message->data = strdup (msg);
message->next_message = NULL;
if (irc_msgq_last_msg)
{
irc_msgq_last_msg->next_message = message;
@ -1357,8 +1424,7 @@ irc_server_msgq_flush ()
struct t_irc_message *next;
char *ptr_data, *new_msg, *ptr_msg, *pos;
char *nick, *host, *command, *channel, *arguments, *msg_decoded;
char *modifier_data, *ptr_chan_nick;
int length;
char str_modifier[64], modifier_data[256], *ptr_chan_nick;
while (irc_recv_msgq)
{
@ -1366,15 +1432,24 @@ irc_server_msgq_flush ()
{
ptr_data = irc_recv_msgq->data;
while (ptr_data[0] == ' ')
{
ptr_data++;
}
if (ptr_data[0])
{
irc_debug_printf (irc_recv_msgq->server, 0, 0, ptr_data);
/*new_msg = plugin_modifier_exec (PLUGIN_MODIFIER_IRC_IN,
irc_recv_msgq->server->name,
ptr_data);*/
new_msg = NULL;
irc_server_parse_message (ptr_data, NULL, NULL, &command,
NULL, NULL);
snprintf (str_modifier, sizeof (str_modifier),
"irc_in_%s",
(command) ? command : "unknown");
new_msg = weechat_hook_modifier_exec (str_modifier,
irc_recv_msgq->server->name,
ptr_data);
if (command)
free (command);
/* no changes in new message */
if (new_msg && (strcmp (ptr_data, new_msg) == 0))
@ -1404,33 +1479,26 @@ irc_server_msgq_flush ()
&arguments);
/* convert charset for message */
msg_decoded = NULL;
ptr_chan_nick = (channel) ? channel : nick;
length = strlen (weechat_plugin->name) + 1 +
strlen (irc_recv_msgq->server->name) + 1 +
((ptr_chan_nick) ? strlen (ptr_chan_nick) : 0) + 1;
modifier_data = (char *)malloc (length * sizeof (char));
if (modifier_data)
if (ptr_chan_nick)
{
if (ptr_chan_nick)
{
snprintf (modifier_data, length, "%s.%s.%s",
weechat_plugin->name,
irc_recv_msgq->server->name,
ptr_chan_nick);
}
else
{
snprintf (modifier_data, length, "%s.%s.%s",
weechat_plugin->name,
irc_recv_msgq->server->name,
ptr_chan_nick);
}
msg_decoded = weechat_hook_modifier_exec ("charset_decode",
modifier_data,
ptr_msg);
free (modifier_data);
snprintf (modifier_data, sizeof (modifier_data),
"%s.%s.%s",
weechat_plugin->name,
irc_recv_msgq->server->name,
ptr_chan_nick);
}
else
{
snprintf (modifier_data, sizeof (modifier_data),
"%s.%s.%s",
weechat_plugin->name,
irc_recv_msgq->server->name,
ptr_chan_nick);
}
msg_decoded = weechat_hook_modifier_exec ("charset_decode",
modifier_data,
ptr_msg);
/* parse and execute command */
irc_protocol_recv_command (irc_recv_msgq->server,
@ -1440,12 +1508,18 @@ irc_server_msgq_flush ()
command,
arguments);
if (nick)
free (nick);
if (host)
free (host);
if (command)
free (command);
if (channel)
free (channel);
if (arguments)
free (arguments);
if (msg_decoded)
free (msg_decoded);
if (pos)
{
@ -1457,8 +1531,10 @@ irc_server_msgq_flush ()
}
}
else
{
irc_debug_printf (irc_recv_msgq->server, 0, 1,
_("(message dropped)"));
}
if (new_msg)
free (new_msg);
}
@ -1468,7 +1544,7 @@ irc_server_msgq_flush ()
next = irc_recv_msgq->next_message;
free (irc_recv_msgq);
irc_recv_msgq = next;
if (irc_recv_msgq == NULL)
if (!irc_recv_msgq)
irc_msgq_last_msg = NULL;
}
}
@ -1744,11 +1820,11 @@ irc_server_switch_address (struct t_irc_server *server)
}
/*
* irc_server_child_read: read connection progress from child process
* irc_server_child_read_cb: read connection progress from child process
*/
int
irc_server_child_read (void *arg_server)
irc_server_child_read_cb (void *arg_server)
{
struct t_irc_server *server;
char buffer[1];
@ -1843,6 +1919,7 @@ irc_server_child_read (void *arg_server)
break;
}
}
return WEECHAT_RC_OK;
}
@ -2560,7 +2637,7 @@ irc_server_connect (struct t_irc_server *server, int disable_autojoin)
server->child_pid = pid;
server->hook_fd = weechat_hook_fd (server->child_read,
1, 0, 0,
irc_server_child_read,
irc_server_child_read_cb,
server);
#endif

View File

@ -137,17 +137,12 @@ extern const int gnutls_prot_prio[];
#endif
extern struct t_irc_message *irc_recv_msgq, *irc_msgq_last_msg;
extern void irc_server_init (struct t_irc_server *server);
extern int irc_server_init_with_url (struct t_irc_server *server, char *irc_url);
extern void irc_server_set_nick (struct t_irc_server *server, char *nick);
extern struct t_irc_server *irc_server_alloc ();
extern void irc_server_init_with_config_options (struct t_irc_server *server,
struct t_config_section *section,
int config_reload);
extern struct t_irc_server *irc_server_alloc ();
extern void irc_server_outqueue_free_all (struct t_irc_server *server);
extern void irc_server_free_data (struct t_irc_server *server);
extern void irc_server_free (struct t_irc_server *server);
extern void irc_server_free_all ();
extern struct t_irc_server *irc_server_new (char *name, int autoconnect,
int autoreconnect,
int autoreconnect_delay,
@ -162,46 +157,27 @@ extern struct t_irc_server *irc_server_new (char *name, int autoconnect,
extern struct t_irc_server *irc_server_duplicate (struct t_irc_server *server,
char *new_name);
extern int irc_server_rename (struct t_irc_server *server, char *new_name);
extern int irc_server_send (struct t_irc_server *server, char *buffer,
int size_buf);
extern void irc_server_outqueue_send (struct t_irc_server *server);
extern void irc_server_sendf (struct t_irc_server *server, char *format, ...);
extern void irc_server_parse_message (char *message, char **nick,
char **host, char **command,
char **channel, char **arguments);
extern int irc_server_recv_cb (void *arg_server);
extern int irc_server_timer_cb (void *data);
extern void irc_server_timer_check_away (void *empty);
extern int irc_server_child_read (void *arg_server);
extern void irc_server_convbase64_8x3_to_6x4 (char *from, char *to);
extern void irc_server_base64encode (char *from, char *to);
extern int irc_server_pass_httpproxy (int sock, char *address, int port);
extern int irc_server_resolve (char *hostname, char *ip, int *version);
extern int irc_server_pass_socks4proxy (int sock, char *address, int port,
char *username);
extern int irc_server_pass_socks5proxy (int sock, char *address, int port);
extern int irc_server_pass_proxy (int sock, char *address, int port,
char *username);
extern void irc_server_set_nick (struct t_irc_server *server, char *nick);
extern struct t_irc_server *irc_server_search (char *server_name);
extern void irc_server_free_all ();
extern int irc_server_connect (struct t_irc_server *server,
int disable_autojoin);
extern void irc_server_reconnect (struct t_irc_server *server);
extern void irc_server_auto_connect (int auto_connect, int temp_server);
extern void irc_server_disconnect (struct t_irc_server *server, int reconnect);
extern void irc_server_disconnect_all ();
extern void irc_server_autojoin_channels ();
extern struct t_irc_server *irc_server_search (char *server_name);
extern int irc_server_get_number_connected ();
extern void irc_server_get_number_buffer (struct t_irc_server *server,
int *server_pos, int *server_total);
extern int irc_server_timer_cb (void *data);
extern void irc_server_sendf (struct t_irc_server *server, char *format, ...);
extern void irc_server_outqueue_free_all (struct t_irc_server *server);
extern int irc_server_get_channel_count (struct t_irc_server *server);
extern int irc_server_get_pv_count (struct t_irc_server *server);
extern void irc_server_remove_away ();
extern void irc_server_check_away ();
extern void irc_server_set_away (struct t_irc_server *server, char *nick,
int is_away);
extern int irc_server_get_default_notify_level (struct t_irc_server *server);
extern void irc_server_set_default_notify_level (struct t_irc_server *server,
int notify);
extern void irc_server_remove_away ();
extern void irc_server_check_away ();
extern void irc_server_reconnect (struct t_irc_server *server);
extern void irc_server_disconnect (struct t_irc_server *server, int reconnect);
extern void irc_server_disconnect_all ();
extern void irc_server_free (struct t_irc_server *server);
extern void irc_server_free_data (struct t_irc_server *server);
extern void irc_server_print_log ();
#endif /* irc-server.h */

View File

@ -29,22 +29,22 @@
#define IRC_GET_SERVER(__buffer) \
struct t_weechat_plugin *buffer_plugin = NULL; \
struct t_irc_server *ptr_server = NULL; \
buffer_plugin = weechat_buffer_get (__buffer, "plugin"); \
buffer_plugin = weechat_buffer_get_pointer (__buffer, "plugin"); \
if (buffer_plugin == weechat_irc_plugin) \
ptr_server = irc_server_search ( \
weechat_buffer_get (__buffer, "category"));
weechat_buffer_get_string (__buffer, "category"));
#define IRC_GET_SERVER_CHANNEL(__buffer) \
struct t_weechat_plugin *buffer_plugin = NULL; \
struct t_irc_server *ptr_server = NULL; \
struct t_irc_channel *ptr_channel = NULL; \
buffer_plugin = weechat_buffer_get (__buffer, "plugin"); \
buffer_plugin = weechat_buffer_get_pointer (__buffer, "plugin"); \
if (buffer_plugin == weechat_irc_plugin) \
{ \
ptr_server = irc_server_search ( \
weechat_buffer_get (__buffer, "category")); \
weechat_buffer_get_string (__buffer, "category")); \
ptr_channel = irc_channel_search ( \
ptr_server, weechat_buffer_get (__buffer, "name")); \
ptr_server, weechat_buffer_get_string (__buffer, "name")); \
}
#define IRC_COLOR_CHAT weechat_color("color_chat")

View File

@ -130,10 +130,10 @@ logger_config_read ()
{
error = NULL;
number = strtol (string, &error, 10);
if (error && (error[0] == '\0'))
if (error && !error[0])
logger_option_backlog = number;
}
if (logger_option_path && logger_option_time_format && logger_option_backlog)
if (logger_option_path && logger_option_time_format)
return 1;
else
return 0;
@ -374,10 +374,14 @@ logger_start_buffer_all ()
struct t_plugin_infolist *ptr_infolist;
ptr_infolist = weechat_infolist_get ("buffer", NULL);
while (weechat_infolist_next (ptr_infolist))
if (ptr_infolist)
{
logger_start_buffer (weechat_infolist_pointer (ptr_infolist,
"pointer"));
while (weechat_infolist_next (ptr_infolist))
{
logger_start_buffer (weechat_infolist_pointer (ptr_infolist,
"pointer"));
}
weechat_infolist_free (ptr_infolist);
}
}
@ -598,6 +602,7 @@ logger_stop_signal_cb (void *data, char *signal, char *type_data,
int
logger_print_cb (void *data, struct t_gui_buffer *buffer, time_t date,
int tags_count, char **tags,
char *prefix, char *message)
{
struct t_logger_buffer *ptr_logger_buffer;
@ -606,7 +611,9 @@ logger_print_cb (void *data, struct t_gui_buffer *buffer, time_t date,
/* make C compiler happy */
(void) data;
(void) tags_count;
(void) tags;
ptr_logger_buffer = logger_buffer_search (buffer);
if (ptr_logger_buffer && ptr_logger_buffer->log_filename
&& ptr_logger_buffer->log_enabled)
@ -614,8 +621,10 @@ logger_print_cb (void *data, struct t_gui_buffer *buffer, time_t date,
date_tmp = localtime (&date);
buf_time[0] = '\0';
if (date_tmp)
{
strftime (buf_time, sizeof (buf_time) - 1,
logger_option_time_format, date_tmp);
}
logger_write_line (ptr_logger_buffer,
"%s\t%s\t%s",
@ -667,7 +676,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin)
weechat_hook_signal ("logger_start", &logger_start_signal_cb, NULL);
weechat_hook_signal ("logger_stop", &logger_stop_signal_cb, NULL);
weechat_hook_print (NULL, NULL, 1, &logger_print_cb, NULL);
weechat_hook_print (NULL, NULL, NULL, 1, &logger_print_cb, NULL);
weechat_hook_config ("plugin", "logger." LOGGER_OPTION_PATH,
&logger_config_cb, NULL);

View File

@ -38,6 +38,7 @@
#include "../gui/gui-buffer.h"
#include "../gui/gui-chat.h"
#include "../gui/gui-color.h"
#include "../gui/gui-filter.h"
#include "../gui/gui-infobar.h"
#include "../gui/gui-keyboard.h"
#include "../gui/gui-window.h"
@ -318,7 +319,7 @@ char *
plugin_api_info_get (struct t_weechat_plugin *plugin, char *info)
{
time_t inactivity;
static char keyboard_inactivity[32];
static char value[32];
if (!plugin || !info)
return NULL;
@ -361,9 +362,13 @@ plugin_api_info_get (struct t_weechat_plugin *plugin, char *info)
inactivity = 0;
else
inactivity = time (NULL) - gui_keyboard_last_activity_time;
snprintf (keyboard_inactivity, sizeof (keyboard_inactivity),
"%ld", (long int)inactivity);
return keyboard_inactivity;
snprintf (value, sizeof (value), "%ld", (long int)inactivity);
return value;
}
else if (string_strcasecmp (info, "filters_enabled") == 0)
{
snprintf (value, sizeof (value), "%d", gui_filters_enabled);
return value;
}
/* info not found */
@ -402,6 +407,8 @@ plugin_api_infolist_get_add_buffer (struct t_plugin_infolist *infolist,
return 0;
if (!plugin_infolist_new_var_integer (ptr_item, "num_displayed", buffer->num_displayed))
return 0;
if (!plugin_infolist_new_var_integer (ptr_item, "lines_hidden", buffer->lines_hidden))
return 0;
if (!plugin_infolist_new_var_string (ptr_item, "title", buffer->title))
return 0;
if (!plugin_infolist_new_var_integer (ptr_item, "input", buffer->input))

View File

@ -261,12 +261,10 @@ plugin_config_free (struct t_config_option *option)
if (option->next_option)
(option->next_option)->prev_option = option->prev_option;
/* free data */
if (option->name)
free (option->name);
if (option->value)
free (option->value);
/* free option */
config_file_option_free_data (option);
free (option);
plugin_options = new_plugin_options;
}
@ -278,7 +276,9 @@ void
plugin_config_free_all ()
{
while (plugin_options)
{
plugin_config_free (plugin_options);
}
}
/*
@ -396,3 +396,14 @@ plugin_config_write ()
log_printf (_("Saving plugins configuration to disk"));
return config_file_write (plugin_config);
}
/*
* plugin_config_end: end plugin config
*/
void
plugin_config_end ()
{
/* free all plugin config options */
plugin_config_free_all ();
}

View File

@ -35,5 +35,6 @@ extern void plugin_config_init ();
extern int plugin_config_read ();
extern int plugin_config_reload ();
extern int plugin_config_write ();
extern void plugin_config_end ();
#endif /* plugin-config.h */

View File

@ -476,6 +476,8 @@ plugin_infolist_var_free (struct t_plugin_infolist_item *item,
free (var->value);
}
free (var);
item->vars = new_vars;
}
@ -511,6 +513,8 @@ plugin_infolist_item_free (struct t_plugin_infolist *list,
if (item->fields)
free (item->fields);
free (item);
list->items = new_items;
}
@ -543,6 +547,8 @@ plugin_infolist_free (struct t_plugin_infolist *list)
plugin_infolist_item_free (list, list->items);
}
free (list);
plugin_infolists = new_plugin_infolists;
}

View File

@ -88,6 +88,7 @@ plugin_load (char *filename)
void *handle;
char *name, *author, *description, *version, *license, *charset;
t_weechat_init_func *init_func;
int rc;
struct t_weechat_plugin *new_plugin;
if (!filename)
@ -242,6 +243,7 @@ plugin_load (char *filename)
new_plugin->strncasecmp = &string_strncasecmp;
new_plugin->strcmp_ignore_chars = &string_strcmp_ignore_chars;
new_plugin->strcasestr = &string_strcasestr;
new_plugin->string_match = &string_match;
new_plugin->string_replace = &string_replace;
new_plugin->string_remove_quotes = &string_remove_quotes;
new_plugin->string_strip = &string_strip;
@ -309,7 +311,7 @@ plugin_load (char *filename)
new_plugin->prefix = &plugin_api_prefix;
new_plugin->color = &plugin_api_color;
new_plugin->printf_date = &gui_chat_printf_date;
new_plugin->printf_date_tags = &gui_chat_printf_date_tags;
new_plugin->infobar_printf = &plugin_api_infobar_printf;
new_plugin->infobar_remove = &plugin_api_infobar_remove;
new_plugin->log_printf = &log_printf;
@ -330,7 +332,8 @@ plugin_load (char *filename)
new_plugin->buffer_new = &gui_buffer_new;
new_plugin->buffer_search = &gui_buffer_search_by_category_name;
new_plugin->buffer_close = &gui_buffer_close;
new_plugin->buffer_get = &gui_buffer_get;
new_plugin->buffer_get_string = &gui_buffer_get_string;
new_plugin->buffer_get_pointer = &gui_buffer_get_pointer;
new_plugin->buffer_set = &gui_buffer_set;
new_plugin->nicklist_add_group = &gui_nicklist_add_group;
@ -374,7 +377,8 @@ plugin_load (char *filename)
last_weechat_plugin = new_plugin;
/* init plugin */
if (((t_weechat_init_func *)init_func) (new_plugin) < 0)
rc = ((t_weechat_init_func *)init_func) (new_plugin);
if (rc != WEECHAT_RC_OK)
{
gui_chat_printf (NULL,
_("%sError: unable to initialize plugin "
@ -428,11 +432,14 @@ plugin_auto_load_file (void *plugin, char *filename)
{
if (string_strcasecmp (pos,
CONFIG_STRING(config_plugins_extension)) == 0)
{
plugin_load (filename);
}
}
}
else
plugin_load (filename);
return 1;
}
@ -559,10 +566,15 @@ plugin_remove (struct t_weechat_plugin *plugin)
free (plugin->name);
if (plugin->description)
free (plugin->description);
if (plugin->author)
free (plugin->author);
if (plugin->version)
free (plugin->version);
if (plugin->license)
free (plugin->license);
if (plugin->charset)
free (plugin->charset);
free (plugin);
weechat_plugins = new_weechat_plugins;
@ -578,11 +590,12 @@ plugin_unload (struct t_weechat_plugin *plugin)
t_weechat_end_func *end_func;
char *name;
name = (plugin->name) ? strdup (plugin->name) : strdup ("???");
name = (plugin->name) ? strdup (plugin->name) : NULL;
end_func = dlsym (plugin->handle, "weechat_plugin_end");
if (end_func)
(void) (end_func) (plugin);
plugin_remove (plugin);
gui_chat_printf (NULL,
@ -622,7 +635,9 @@ void
plugin_unload_all ()
{
while (weechat_plugins)
{
plugin_unload (last_weechat_plugin);
}
}
/*
@ -687,6 +702,9 @@ plugin_end ()
/* unload all plugins */
plugin_unload_all ();
/* free all plugin options */
plugin_config_end ();
}
/*

View File

@ -2208,22 +2208,27 @@ weechat_lua_api_hook_fd (lua_State *L)
int
weechat_lua_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
time_t date, char *prefix, char *message)
time_t date, int tags_count, char **tags,
char *prefix, char *message)
{
struct t_script_callback *script_callback;
char *lua_argv[5];
char *lua_argv[6];
static char timebuffer[64];
int *rc, ret;
/* make C compiler happy */
(void) tags_count;
script_callback = (struct t_script_callback *)data;
snprintf (timebuffer, sizeof (timebuffer) - 1, "%ld", date);
lua_argv[0] = script_ptr2str (buffer);
lua_argv[1] = timebuffer;
lua_argv[2] = prefix;
lua_argv[3] = message;
lua_argv[4] = NULL;
lua_argv[2] = weechat_string_build_with_exploded (tags, ",");
lua_argv[3] = prefix;
lua_argv[4] = message;
lua_argv[5] = NULL;
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
@ -2237,6 +2242,10 @@ weechat_lua_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
ret = *rc;
free (rc);
}
if (lua_argv[0])
free (lua_argv[0]);
if (lua_argv[2])
free (lua_argv[2]);
return ret;
}
@ -2248,7 +2257,7 @@ weechat_lua_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
static int
weechat_lua_api_hook_print (lua_State *L)
{
const char *buffer, *message, *function;
const char *buffer, *tags, *message, *function;
char *result;
int n, strip_colors;
@ -2262,6 +2271,7 @@ weechat_lua_api_hook_print (lua_State *L)
}
buffer = NULL;
tags = NULL;
message = NULL;
strip_colors = 0;
function = NULL;
@ -2274,7 +2284,8 @@ weechat_lua_api_hook_print (lua_State *L)
LUA_RETURN_EMPTY;
}
buffer = lua_tostring (lua_current_interpreter, -4);
buffer = lua_tostring (lua_current_interpreter, -5);
tags = lua_tostring (lua_current_interpreter, -4);
message = lua_tostring (lua_current_interpreter, -3);
strip_colors = lua_tonumber (lua_current_interpreter, -2);
function = lua_tostring (lua_current_interpreter, -1);
@ -2282,6 +2293,7 @@ weechat_lua_api_hook_print (lua_State *L)
result = script_ptr2str (script_api_hook_print (weechat_lua_plugin,
lua_current_script,
script_str2ptr ((char *)buffer),
(char *)tags,
(char *)message,
strip_colors,
&weechat_lua_api_hook_print_cb,
@ -2979,11 +2991,11 @@ weechat_lua_api_buffer_close (lua_State *L)
}
/*
* weechat_lua_api_buffer_get: get a buffer property
* weechat_lua_api_buffer_get_string: get a buffer property as string
*/
static int
weechat_lua_api_buffer_get (lua_State *L)
weechat_lua_api_buffer_get_string (lua_State *L)
{
const char *buffer, *property;
char *value;
@ -2994,7 +3006,7 @@ weechat_lua_api_buffer_get (lua_State *L)
if (!lua_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("buffer_get");
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("buffer_get_string");
LUA_RETURN_EMPTY;
}
@ -3005,19 +3017,59 @@ weechat_lua_api_buffer_get (lua_State *L)
if (n < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_get");
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_get_string");
LUA_RETURN_EMPTY;
}
buffer = lua_tostring (lua_current_interpreter, -2);
property = lua_tostring (lua_current_interpreter, -1);
value = weechat_buffer_get (script_str2ptr ((char *)buffer),
(char *)property);
value = weechat_buffer_get_string (script_str2ptr ((char *)buffer),
(char *)property);
LUA_RETURN_STRING(value);
}
/*
* weechat_lua_api_buffer_get_pointer: get a buffer property as pointer
*/
static int
weechat_lua_api_buffer_get_pointer (lua_State *L)
{
const char *buffer, *property;
char *value;
int n;
/* make C compiler happy */
(void) L;
if (!lua_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("buffer_get_pointer");
LUA_RETURN_EMPTY;
}
buffer = NULL;
property = NULL;
n = lua_gettop (lua_current_interpreter);
if (n < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_get_pointer");
LUA_RETURN_EMPTY;
}
buffer = lua_tostring (lua_current_interpreter, -2);
property = lua_tostring (lua_current_interpreter, -1);
value = script_ptr2str (weechat_buffer_get_string (script_str2ptr ((char *)buffer),
(char *)property));
LUA_RETURN_STRING_FREE(value);
}
/*
* weechat_lua_api_buffer_set: set a buffer property
*/
@ -4169,46 +4221,6 @@ weechat_lua_api_constant_weechat_rc_error (lua_State *L)
return 1;
}
static int
weechat_lua_api_constant_weechat_rc_ok_ignore_weechat (lua_State *L)
{
/* make C compiler happy */
(void) L;
lua_pushnumber (lua_current_interpreter, WEECHAT_RC_OK_IGNORE_WEECHAT);
return 1;
}
static int
weechat_lua_api_constant_weechat_rc_ok_ignore_plugins (lua_State *L)
{
/* make C compiler happy */
(void) L;
lua_pushnumber (lua_current_interpreter, WEECHAT_RC_OK_IGNORE_PLUGINS);
return 1;
}
static int
weechat_lua_api_constant_weechat_rc_ok_ignore_all (lua_State *L)
{
/* make C compiler happy */
(void) L;
lua_pushnumber (lua_current_interpreter, WEECHAT_RC_OK_IGNORE_ALL);
return 1;
}
static int
weechat_lua_api_constant_weechat_rc_ok_with_highlight (lua_State *L)
{
/* make C compiler happy */
(void) L;
lua_pushnumber (lua_current_interpreter, WEECHAT_RC_OK_WITH_HIGHLIGHT);
return 1;
}
static int
weechat_lua_api_constant_weechat_list_pos_sort (lua_State *L)
{
@ -4372,7 +4384,8 @@ const struct luaL_reg weechat_lua_api_funcs[] = {
{ "buffer_new", &weechat_lua_api_buffer_new },
{ "buffer_search", &weechat_lua_api_buffer_search },
{ "buffer_close", &weechat_lua_api_buffer_close },
{ "buffer_get", &weechat_lua_api_buffer_get },
{ "buffer_get_string", &weechat_lua_api_buffer_get_string },
{ "buffer_get_pointer", &weechat_lua_api_buffer_get_pointer },
{ "buffer_set", &weechat_lua_api_buffer_set },
{ "nicklist_add_group", &weechat_lua_api_nicklist_add_group },
{ "nicklist_search_group", &weechat_lua_api_nicklist_search_group },
@ -4403,10 +4416,6 @@ const struct luaL_reg weechat_lua_api_funcs[] = {
/* define constants as function which returns values */
{ "WEECHAT_RC_OK", &weechat_lua_api_constant_weechat_rc_ok },
{ "WEECHAT_RC_ERROR", &weechat_lua_api_constant_weechat_rc_error },
{ "WEECHAT_RC_OK_IGNORE_WEECHAT", &weechat_lua_api_constant_weechat_rc_ok_ignore_weechat },
{ "WEECHAT_RC_OK_IGNORE_PLUGINS", &weechat_lua_api_constant_weechat_rc_ok_ignore_plugins },
{ "WEECHAT_RC_OK_IGNORE_ALL", &weechat_lua_api_constant_weechat_rc_ok_ignore_all },
{ "WEECHAT_RC_OK_WITH_HIGHLIGHT", &weechat_lua_api_constant_weechat_rc_ok_with_highlight },
{ "WEECHAT_LIST_POS_SORT", &weechat_lua_api_constant_weechat_list_pos_sort },
{ "WEECHAT_LIST_POS_BEGINNING", &weechat_lua_api_constant_weechat_list_pos_beginning },
{ "WEECHAT_LIST_POS_END", &weechat_lua_api_constant_weechat_list_pos_end },

View File

@ -1815,22 +1815,27 @@ static XS (XS_weechat_hook_fd)
int
weechat_perl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
time_t date, char *prefix, char *message)
time_t date, int tags_count, char **tags,
char *prefix, char *message)
{
struct t_script_callback *script_callback;
char *perl_argv[5];
char *perl_argv[6];
static char timebuffer[64];
int *rc, ret;
/* make C compiler happy */
(void) tags_count;
script_callback = (struct t_script_callback *)data;
snprintf (timebuffer, sizeof (timebuffer) - 1, "%ld", date);
perl_argv[0] = script_ptr2str (buffer);
perl_argv[1] = timebuffer;
perl_argv[2] = prefix;
perl_argv[3] = message;
perl_argv[4] = NULL;
perl_argv[2] = weechat_string_build_with_exploded (tags, ",");
perl_argv[3] = prefix;
perl_argv[4] = message;
perl_argv[5] = NULL;
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
@ -1846,6 +1851,8 @@ weechat_perl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
}
if (perl_argv[0])
free (perl_argv[0]);
if (perl_argv[2])
free (perl_argv[2]);
return ret;
}
@ -1856,7 +1863,7 @@ weechat_perl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
static XS (XS_weechat_hook_print)
{
char *result, *buffer, *message, *function;
char *result, *buffer, *tags, *message, *function;
dXSARGS;
/* make C compiler happy */
@ -1868,20 +1875,22 @@ static XS (XS_weechat_hook_print)
PERL_RETURN_EMPTY;
}
if (items < 4)
if (items < 5)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("hook_print");
PERL_RETURN_EMPTY;
}
buffer = SvPV (ST (0), PL_na);
message = SvPV (ST (1), PL_na);
function = SvPV (ST (3), PL_na);
tags = SvPV (ST (1), PL_na);
message = SvPV (ST (2), PL_na);
function = SvPV (ST (4), PL_na);
result = script_ptr2str (script_api_hook_print (weechat_perl_plugin,
perl_current_script,
script_str2ptr (buffer),
tags,
message,
SvIV (ST (2)), /* strip_colors */
SvIV (ST (3)), /* strip_colors */
&weechat_perl_api_hook_print_cb,
function));
@ -2492,10 +2501,10 @@ static XS (XS_weechat_buffer_close)
}
/*
* weechat::buffer_get: get a buffer property
* weechat::buffer_get_string: get a buffer property as string
*/
static XS (XS_weechat_buffer_get)
static XS (XS_weechat_buffer_get_string)
{
char *value, *buffer, *property;
dXSARGS;
@ -2505,23 +2514,55 @@ static XS (XS_weechat_buffer_get)
if (!perl_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("buffer_get");
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("buffer_get_string");
PERL_RETURN_EMPTY;
}
if (items < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_get");
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_get_string");
PERL_RETURN_EMPTY;
}
buffer = SvPV (ST (0), PL_na);
property = SvPV (ST (1), PL_na);
value = weechat_buffer_get (script_str2ptr (buffer), property);
value = weechat_buffer_get_string (script_str2ptr (buffer), property);
PERL_RETURN_STRING(value);
}
/*
* weechat::buffer_get_pointer: get a buffer property as pointer
*/
static XS (XS_weechat_buffer_get_pointer)
{
char *value, *buffer, *property;
dXSARGS;
/* make C compiler happy */
(void) cv;
if (!perl_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("buffer_get_pointer");
PERL_RETURN_EMPTY;
}
if (items < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_get_pointer");
PERL_RETURN_EMPTY;
}
buffer = SvPV (ST (0), PL_na);
property = SvPV (ST (1), PL_na);
value = script_ptr2str (weechat_buffer_get_pointer (script_str2ptr (buffer),
property));
PERL_RETURN_STRING_FREE(value);
}
/*
* weechat::buffer_set: set a buffer property
*/
@ -3489,7 +3530,8 @@ weechat_perl_api_init (pTHX)
newXS ("weechat::buffer_new", XS_weechat_buffer_new, "weechat");
newXS ("weechat::buffer_search", XS_weechat_buffer_search, "weechat");
newXS ("weechat::buffer_close", XS_weechat_buffer_close, "weechat");
newXS ("weechat::buffer_get", XS_weechat_buffer_get, "weechat");
newXS ("weechat::buffer_get_string", XS_weechat_buffer_get_string, "weechat");
newXS ("weechat::buffer_get_pointer", XS_weechat_buffer_get_pointer, "weechat");
newXS ("weechat::buffer_set", XS_weechat_buffer_set, "weechat");
newXS ("weechat::nicklist_add_group", XS_weechat_nicklist_add_group, "weechat");
newXS ("weechat::nicklist_search_group", XS_weechat_nicklist_search_group, "weechat");
@ -3522,10 +3564,6 @@ weechat_perl_api_init (pTHX)
stash = gv_stashpv ("weechat", TRUE);
newCONSTSUB (stash, "weechat::WEECHAT_RC_OK", newSViv (WEECHAT_RC_OK));
newCONSTSUB (stash, "weechat::WEECHAT_RC_ERROR", newSViv (WEECHAT_RC_ERROR));
newCONSTSUB (stash, "weechat::WEECHAT_RC_OK_IGNORE_WEECHAT", newSViv (WEECHAT_RC_OK_IGNORE_WEECHAT));
newCONSTSUB (stash, "weechat::WEECHAT_RC_OK_IGNORE_PLUGINS", newSViv (WEECHAT_RC_OK_IGNORE_PLUGINS));
newCONSTSUB (stash, "weechat::WEECHAT_RC_OK_IGNORE_ALL", newSViv (WEECHAT_RC_OK_IGNORE_ALL));
newCONSTSUB (stash, "weechat::WEECHAT_RC_OK_WITH_HIGHLIGHT", newSViv (WEECHAT_RC_OK_WITH_HIGHLIGHT));
newCONSTSUB (stash, "weechat::WEECHAT_LIST_POS_SORT", newSVpv (WEECHAT_LIST_POS_SORT, PL_na));
newCONSTSUB (stash, "weechat::WEECHAT_LIST_POS_BEGINNING", newSVpv (WEECHAT_LIST_POS_BEGINNING, PL_na));
newCONSTSUB (stash, "weechat::WEECHAT_LIST_POS_END", newSVpv (WEECHAT_LIST_POS_END, PL_na));

View File

@ -1939,22 +1939,27 @@ weechat_python_api_hook_fd (PyObject *self, PyObject *args)
int
weechat_python_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
time_t date, char *prefix, char *message)
time_t date, int tags_count, char **tags,
char *prefix, char *message)
{
struct t_script_callback *script_callback;
char *python_argv[5];
char *python_argv[6];
static char timebuffer[64];
int *rc, ret;
/* make C compiler happy */
(void) tags_count;
script_callback = (struct t_script_callback *)data;
snprintf (timebuffer, sizeof (timebuffer) - 1, "%ld", date);
python_argv[0] = script_ptr2str (buffer);
python_argv[1] = timebuffer;
python_argv[2] = prefix;
python_argv[3] = message;
python_argv[4] = NULL;
python_argv[2] = weechat_string_build_with_exploded (tags, ",");
python_argv[3] = prefix;
python_argv[4] = message;
python_argv[5] = NULL;
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
@ -1970,6 +1975,8 @@ weechat_python_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
}
if (python_argv[0])
free (python_argv[0]);
if (python_argv[2])
free (python_argv[2]);
return ret;
}
@ -1981,7 +1988,7 @@ weechat_python_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
static PyObject *
weechat_python_api_hook_print (PyObject *self, PyObject *args)
{
char *buffer, *message, *function, *result;
char *buffer, *tags, *message, *function, *result;
int strip_colors;
PyObject *object;
@ -1995,12 +2002,13 @@ weechat_python_api_hook_print (PyObject *self, PyObject *args)
}
buffer = NULL;
tags = NULL;
message = NULL;
strip_colors = 0;
function = NULL;
if (!PyArg_ParseTuple (args, "ssis", &buffer, &message, &strip_colors,
&function))
if (!PyArg_ParseTuple (args, "sssis", &buffer, &tags, &message,
&strip_colors, &function))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("hook_print");
PYTHON_RETURN_EMPTY;
@ -2009,6 +2017,7 @@ weechat_python_api_hook_print (PyObject *self, PyObject *args)
result = script_ptr2str(script_api_hook_print (weechat_python_plugin,
python_current_script,
script_str2ptr (buffer),
tags,
message,
strip_colors,
&weechat_python_api_hook_print_cb,
@ -2146,7 +2155,7 @@ weechat_python_api_hook_signal_send (PyObject *self, PyObject *args)
{
error = NULL;
number = (int)strtol (signal_data, &error, 10);
if (error && (error[0] == '\0'))
if (error && !error[0])
{
weechat_hook_signal_send (signal, type_data, &number);
}
@ -2645,11 +2654,11 @@ weechat_python_api_buffer_close (PyObject *self, PyObject *args)
}
/*
* weechat_python_api_buffer_get: get a buffer property
* weechat_python_api_buffer_get_string: get a buffer property as string
*/
static PyObject *
weechat_python_api_buffer_get (PyObject *self, PyObject *args)
weechat_python_api_buffer_get_string (PyObject *self, PyObject *args)
{
char *buffer, *property, *value;
@ -2658,7 +2667,7 @@ weechat_python_api_buffer_get (PyObject *self, PyObject *args)
if (!python_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("buffer_get");
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("buffer_get_string");
PYTHON_RETURN_ERROR;
}
@ -2667,15 +2676,49 @@ weechat_python_api_buffer_get (PyObject *self, PyObject *args)
if (!PyArg_ParseTuple (args, "ss", &buffer, &property))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_get");
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_get_string");
PYTHON_RETURN_EMPTY;
}
value = weechat_buffer_get (script_str2ptr (buffer), property);
value = weechat_buffer_get_string (script_str2ptr (buffer), property);
PYTHON_RETURN_STRING(value);
}
/*
* weechat_python_api_buffer_get_pointer: get a buffer property as pointer
*/
static PyObject *
weechat_python_api_buffer_get_pointer (PyObject *self, PyObject *args)
{
char *buffer, *property, *value;
PyObject *object;
/* make C compiler happy */
(void) self;
if (!python_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("buffer_get_pointer");
PYTHON_RETURN_ERROR;
}
buffer = NULL;
property = NULL;
if (!PyArg_ParseTuple (args, "ss", &buffer, &property))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_get_pointer");
PYTHON_RETURN_EMPTY;
}
value = script_ptr2str (weechat_buffer_get_pointer (script_str2ptr (buffer),
property));
PYTHON_RETURN_STRING_FREE(value);
}
/*
* weechat_python_api_buffer_set: set a buffer property
*/
@ -3710,7 +3753,8 @@ PyMethodDef weechat_python_funcs[] =
{ "buffer_new", &weechat_python_api_buffer_new, METH_VARARGS, "" },
{ "buffer_search", &weechat_python_api_buffer_search, METH_VARARGS, "" },
{ "buffer_close", &weechat_python_api_buffer_close, METH_VARARGS, "" },
{ "buffer_get", &weechat_python_api_buffer_get, METH_VARARGS, "" },
{ "buffer_get_string", &weechat_python_api_buffer_get_string, METH_VARARGS, "" },
{ "buffer_get_pointer", &weechat_python_api_buffer_get_pointer, METH_VARARGS, "" },
{ "buffer_set", &weechat_python_api_buffer_set, METH_VARARGS, "" },
{ "nicklist_add_group", &weechat_python_api_nicklist_add_group, METH_VARARGS, "" },
{ "nicklist_search_group", &weechat_python_api_nicklist_search_group, METH_VARARGS, "" },

View File

@ -87,9 +87,16 @@ weechat_python_exec (struct t_plugin_script *script,
{
if (argv[4])
{
rc = PyObject_CallFunction (evFunc, "sssss", argv[0],
argv[1], argv[2], argv[3],
argv[4]);
if (argv[5])
{
rc = PyObject_CallFunction (evFunc, "ssssss", argv[0],
argv[1], argv[2], argv[3],
argv[4], argv[5]);
}
else
rc = PyObject_CallFunction (evFunc, "sssss", argv[0],
argv[1], argv[2], argv[3],
argv[4]);
}
else
rc = PyObject_CallFunction (evFunc, "ssss", argv[0],
@ -315,10 +322,6 @@ weechat_python_load (char *filename)
weechat_dict = PyModule_GetDict(weechat_module);
PyDict_SetItemString(weechat_dict, "WEECHAT_RC_OK", PyInt_FromLong((long) WEECHAT_RC_OK));
PyDict_SetItemString(weechat_dict, "WEECHAT_RC_ERROR", PyInt_FromLong((long) WEECHAT_RC_ERROR));
PyDict_SetItemString(weechat_dict, "WEECHAT_RC_OK_IGNORE_WEECHAT", PyInt_FromLong((long) WEECHAT_RC_OK_IGNORE_WEECHAT));
PyDict_SetItemString(weechat_dict, "WEECHAT_RC_OK_IGNORE_PLUGINS", PyInt_FromLong((long) WEECHAT_RC_OK_IGNORE_PLUGINS));
PyDict_SetItemString(weechat_dict, "WEECHAT_RC_OK_IGNORE_ALL", PyInt_FromLong((long) WEECHAT_RC_OK_IGNORE_ALL));
PyDict_SetItemString(weechat_dict, "WEECHAT_RC_OK_WITH_HIGHLIGHT", PyInt_FromLong((long) WEECHAT_RC_OK_WITH_HIGHLIGHT));
PyDict_SetItemString(weechat_dict, "WEECHAT_LIST_POS_SORT", PyString_FromString(WEECHAT_LIST_POS_SORT));
PyDict_SetItemString(weechat_dict, "WEECHAT_LIST_POS_BEGINNING", PyString_FromString(WEECHAT_LIST_POS_BEGINNING));
PyDict_SetItemString(weechat_dict, "WEECHAT_LIST_POS_END", PyString_FromString(WEECHAT_LIST_POS_END));

View File

@ -2244,22 +2244,27 @@ weechat_ruby_api_hook_fd (VALUE class, VALUE fd, VALUE read, VALUE write,
int
weechat_ruby_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
time_t date, char *prefix, char *message)
time_t date, int tags_count, char **tags,
char *prefix, char *message)
{
struct t_script_callback *script_callback;
char *ruby_argv[5];
char *ruby_argv[6];
static char timebuffer[64];
int *rc, ret;
/* make C compiler happy */
(void) tags_count;
script_callback = (struct t_script_callback *)data;
snprintf (timebuffer, sizeof (timebuffer) - 1, "%ld", date);
ruby_argv[0] = script_ptr2str (buffer);
ruby_argv[1] = timebuffer;
ruby_argv[2] = prefix;
ruby_argv[3] = message;
ruby_argv[4] = NULL;
ruby_argv[2] = weechat_string_build_with_exploded (tags, ",");
ruby_argv[3] = prefix;
ruby_argv[4] = message;
ruby_argv[5] = NULL;
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
@ -2275,6 +2280,8 @@ weechat_ruby_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
}
if (ruby_argv[0])
free (ruby_argv[0]);
if (ruby_argv[2])
free (ruby_argv[2]);
return ret;
}
@ -2284,10 +2291,10 @@ weechat_ruby_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
*/
static VALUE
weechat_ruby_api_hook_print (VALUE class, VALUE buffer, VALUE message,
VALUE strip_colors, VALUE function)
weechat_ruby_api_hook_print (VALUE class, VALUE buffer, VALUE tags,
VALUE message, VALUE strip_colors, VALUE function)
{
char *c_buffer, *c_message, *c_function, *result;
char *c_buffer, *c_tags, *c_message, *c_function, *result;
int c_strip_colors;
VALUE return_value;
@ -2301,23 +2308,26 @@ weechat_ruby_api_hook_print (VALUE class, VALUE buffer, VALUE message,
}
c_buffer = NULL;
c_tags = NULL;
c_message = NULL;
c_strip_colors = 0;
c_function = NULL;
if (NIL_P (buffer) || NIL_P (message) || NIL_P (strip_colors)
|| NIL_P (function))
if (NIL_P (buffer) || NIL_P (tags) || NIL_P (message)
|| NIL_P (strip_colors) || NIL_P (function))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("hook_print");
RUBY_RETURN_EMPTY;
}
Check_Type (buffer, T_STRING);
Check_Type (tags, T_STRING);
Check_Type (message, T_STRING);
Check_Type (strip_colors, T_FIXNUM);
Check_Type (function, T_STRING);
c_buffer = STR2CSTR (buffer);
c_tags = STR2CSTR (tags);
c_message = STR2CSTR (message);
c_strip_colors = FIX2INT (strip_colors);
c_function = STR2CSTR (function);
@ -2325,6 +2335,7 @@ weechat_ruby_api_hook_print (VALUE class, VALUE buffer, VALUE message,
result = script_ptr2str (script_api_hook_print (weechat_ruby_plugin,
ruby_current_script,
script_str2ptr (c_buffer),
c_tags,
c_message,
c_strip_colors,
&weechat_ruby_api_hook_print_cb,
@ -3034,11 +3045,11 @@ weechat_ruby_api_buffer_close (VALUE class, VALUE buffer,
}
/*
* weechat_ruby_api_buffer_get: get a buffer property
* weechat_ruby_api_buffer_get_string: get a buffer property as string
*/
static VALUE
weechat_ruby_api_buffer_get (VALUE class, VALUE buffer, VALUE property)
weechat_ruby_api_buffer_get_string (VALUE class, VALUE buffer, VALUE property)
{
char *c_buffer, *c_property, *value;
@ -3047,13 +3058,13 @@ weechat_ruby_api_buffer_get (VALUE class, VALUE buffer, VALUE property)
if (!ruby_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("buffer_get");
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("buffer_get_string");
RUBY_RETURN_EMPTY;
}
if (NIL_P (buffer) || NIL_P (property))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_get");
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_get_string");
RUBY_RETURN_EMPTY;
}
@ -3063,12 +3074,49 @@ weechat_ruby_api_buffer_get (VALUE class, VALUE buffer, VALUE property)
c_buffer = STR2CSTR (buffer);
c_property = STR2CSTR (property);
value = weechat_buffer_get (script_str2ptr (c_buffer),
c_property);
value = weechat_buffer_get_string (script_str2ptr (c_buffer),
c_property);
RUBY_RETURN_STRING(value);
}
/*
* weechat_ruby_api_buffer_get_pointer: get a buffer property as pointer
*/
static VALUE
weechat_ruby_api_buffer_get_pointer (VALUE class, VALUE buffer, VALUE property)
{
char *c_buffer, *c_property, *value;
VALUE return_value;
/* make C compiler happy */
(void) class;
if (!ruby_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("buffer_get_pointer");
RUBY_RETURN_EMPTY;
}
if (NIL_P (buffer) || NIL_P (property))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("buffer_get_pointer");
RUBY_RETURN_EMPTY;
}
Check_Type (buffer, T_STRING);
Check_Type (property, T_STRING);
c_buffer = STR2CSTR (buffer);
c_property = STR2CSTR (property);
value = script_ptr2str (weechat_buffer_get_string (script_str2ptr (c_buffer),
c_property));
RUBY_RETURN_STRING_FREE(value);
}
/*
* weechat_ruby_api_buffer_set: set a buffer property
*/
@ -4171,10 +4219,6 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
{
rb_define_const(ruby_mWeechat, "WEECHAT_RC_OK", INT2NUM(WEECHAT_RC_OK));
rb_define_const(ruby_mWeechat, "WEECHAT_RC_ERROR", INT2NUM(WEECHAT_RC_ERROR));
rb_define_const(ruby_mWeechat, "WEECHAT_RC_OK_IGNORE_WEECHAT", INT2NUM(WEECHAT_RC_OK_IGNORE_WEECHAT));
rb_define_const(ruby_mWeechat, "WEECHAT_RC_OK_IGNORE_PLUGINS", INT2NUM(WEECHAT_RC_OK_IGNORE_PLUGINS));
rb_define_const(ruby_mWeechat, "WEECHAT_RC_OK_IGNORE_ALL", INT2NUM(WEECHAT_RC_OK_IGNORE_ALL));
rb_define_const(ruby_mWeechat, "WEECHAT_RC_OK_WITH_HIGHLIGHT", INT2NUM(WEECHAT_RC_OK_WITH_HIGHLIGHT));
rb_define_const(ruby_mWeechat, "WEECHAT_LIST_POS_SORT", rb_str_new2(WEECHAT_LIST_POS_SORT));
rb_define_const(ruby_mWeechat, "WEECHAT_LIST_POS_BEGINNING", rb_str_new2(WEECHAT_LIST_POS_BEGINNING));
rb_define_const(ruby_mWeechat, "WEECHAT_LIST_POS_END", rb_str_new2(WEECHAT_LIST_POS_END));
@ -4231,7 +4275,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
rb_define_module_function (ruby_mWeechat, "hook_command", &weechat_ruby_api_hook_command, 6);
rb_define_module_function (ruby_mWeechat, "hook_timer", &weechat_ruby_api_hook_timer, 4);
rb_define_module_function (ruby_mWeechat, "hook_fd", &weechat_ruby_api_hook_fd, 5);
rb_define_module_function (ruby_mWeechat, "hook_print", &weechat_ruby_api_hook_print, 4);
rb_define_module_function (ruby_mWeechat, "hook_print", &weechat_ruby_api_hook_print, 5);
rb_define_module_function (ruby_mWeechat, "hook_signal", &weechat_ruby_api_hook_signal, 2);
rb_define_module_function (ruby_mWeechat, "hook_signal_send", &weechat_ruby_api_hook_signal_send, 3);
rb_define_module_function (ruby_mWeechat, "hook_config", &weechat_ruby_api_hook_config, 3);
@ -4243,7 +4287,8 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
rb_define_module_function (ruby_mWeechat, "buffer_new", &weechat_ruby_api_buffer_new, 4);
rb_define_module_function (ruby_mWeechat, "buffer_search", &weechat_ruby_api_buffer_search, 2);
rb_define_module_function (ruby_mWeechat, "buffer_close", &weechat_ruby_api_buffer_close, 1);
rb_define_module_function (ruby_mWeechat, "buffer_get", &weechat_ruby_api_buffer_get, 2);
rb_define_module_function (ruby_mWeechat, "buffer_get_string", &weechat_ruby_api_buffer_get_string, 2);
rb_define_module_function (ruby_mWeechat, "buffer_get_pointer", &weechat_ruby_api_buffer_get_pointer, 2);
rb_define_module_function (ruby_mWeechat, "buffer_set", &weechat_ruby_api_buffer_set, 3);
rb_define_module_function (ruby_mWeechat, "nicklist_add_group", &weechat_ruby_api_nicklist_add_group, 5);
rb_define_module_function (ruby_mWeechat, "nicklist_search_group", &weechat_ruby_api_nicklist_search_group, 3);

View File

@ -124,13 +124,25 @@ weechat_ruby_exec (struct t_plugin_script *script,
{
if (argv[4])
{
rc = rb_protect_funcall ((VALUE) script->interpreter, rb_intern(function),
&ruby_error, 5,
rb_str_new2(argv[0]),
rb_str_new2(argv[1]),
rb_str_new2(argv[2]),
rb_str_new2(argv[3]),
rb_str_new2(argv[4]));
if (argv[5])
{
rc = rb_protect_funcall ((VALUE) script->interpreter, rb_intern(function),
&ruby_error, 6,
rb_str_new2(argv[0]),
rb_str_new2(argv[1]),
rb_str_new2(argv[2]),
rb_str_new2(argv[3]),
rb_str_new2(argv[4]),
rb_str_new2(argv[5]));
}
else
rc = rb_protect_funcall ((VALUE) script->interpreter, rb_intern(function),
&ruby_error, 5,
rb_str_new2(argv[0]),
rb_str_new2(argv[1]),
rb_str_new2(argv[2]),
rb_str_new2(argv[3]),
rb_str_new2(argv[4]));
}
else
rc = rb_protect_funcall ((VALUE) script->interpreter, rb_intern(function),

View File

@ -481,11 +481,12 @@ struct t_hook *
script_api_hook_print (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_gui_buffer *buffer,
char *message, int strip_colors,
char *tags, char *message, int strip_colors,
int (*callback)(void *data,
struct t_gui_buffer *buffer,
time_t date, char *prefix,
char *message),
time_t date,
int tags_count, char **tags,
char *prefix, char *message),
char *function)
{
struct t_script_callback *new_script_callback;
@ -495,7 +496,7 @@ script_api_hook_print (struct t_weechat_plugin *weechat_plugin,
if (!new_script_callback)
return NULL;
new_hook = weechat_hook_print (buffer, message, strip_colors,
new_hook = weechat_hook_print (buffer, tags, message, strip_colors,
callback, new_script_callback);
if (!new_hook)
{

View File

@ -95,10 +95,14 @@ extern struct t_hook *script_api_hook_fd (struct t_weechat_plugin *weechat_plugi
extern struct t_hook *script_api_hook_print (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_gui_buffer *buffer,
char *message, int strip_colors,
char *tags,
char *message,
int strip_colors,
int (*callback)(void *data,
struct t_gui_buffer *buffer,
time_t date,
int tags_count,
char **tags,
char *prefix,
char *message),
char *function);

View File

@ -98,7 +98,7 @@ weechat_trigger_list_del (char *pattern, char *commands,
number = strtol (pattern, &error, 10);
p = NULL;
if (error && (error[0] == '\0') && number > 0)
if (error && !error[0] && number > 0)
{
l = weechat_trigger_list;
while (l && number >= 0)

View File

@ -45,16 +45,6 @@ struct t_weelist;
#define WEECHAT_RC_ERROR -1 /* function failed with an error */
#define WEECHAT_RC_OK 0 /* function ok */
/* return codes specific to message handlers: messages can be discarded for
WeeChat, for plugins, or both */
#define WEECHAT_RC_OK_IGNORE_WEECHAT 1 /* ignore WeeChat for this message */
#define WEECHAT_RC_OK_IGNORE_PLUGINS 2 /* ignore other plugins for msg */
#define WEECHAT_RC_OK_IGNORE_ALL (WEECHAT_RC_OK_IGNORE_WEECHAT \
| WEECHAT_RC_OK_IGNORE_PLUGINS)
/* ignore WeeChat and other plugins */
#define WEECHAT_RC_OK_WITH_HIGHLIGHT 4 /* ok and ask for highlight */
/* (for message handler only) */
/* list management (order of elements) */
#define WEECHAT_LIST_POS_SORT "sort"
#define WEECHAT_LIST_POS_BEGINNING "beginning"
@ -105,12 +95,15 @@ struct t_weechat_plugin
int (*strcmp_ignore_chars) (char *string1, char *string2,
char *chars_ignored, int case_sensitive);
char *(*strcasestr) (char *string1, char *string2);
int (*string_match) (char *string, char *mask, int case_sensitive);
char *(*string_replace) (char *string, char *search, char *replace);
char *(*string_remove_quotes) (char *string, char *quotes);
char *(*string_strip) (char *string, int left, int right, char *chars);
char **(*string_explode) (char *string, char *separators, int keep_eol,
int num_items_max, int *num_items);
void (*string_free_exploded) (char **exploded_string);
char *(*string_build_with_exploded) (char **exploded_string,
char *separator);
char **(*string_split_command) (char *command, char separator);
void (*string_free_splitted_command) (char **splitted_command);
@ -218,8 +211,8 @@ struct t_weechat_plugin
/* display */
char *(*prefix) (char *prefix);
char *(*color) (char *color_name);
void (*printf_date) (struct t_gui_buffer *buffer, time_t date,
char *message, ...);
void (*printf_date_tags) (struct t_gui_buffer *buffer, time_t date,
char *tags, char *message, ...);
void (*infobar_printf) (struct t_weechat_plugin *plugin, int delay,
char *color_name, char *format, ...);
void (*infobar_remove) (int how_many);
@ -247,11 +240,14 @@ struct t_weechat_plugin
void *callback_data);
struct t_hook *(*hook_print) (struct t_weechat_plugin *plugin,
struct t_gui_buffer *buffer,
char *message, int strip_colors,
char *tags, char *message,
int strip_colors,
int (*callback)(void *data,
struct t_gui_buffer *buffer,
time_t date, char *prefix,
char *message),
time_t date,
int tags_count,
char **tags,
char *prefix, char *message),
void *callback_data);
struct t_hook *(*hook_signal) (struct t_weechat_plugin *plugin,
char *signal,
@ -298,7 +294,8 @@ struct t_weechat_plugin
void *close_callback_data);
struct t_gui_buffer *(*buffer_search) (char *category, char *name);
void (*buffer_close) (struct t_gui_buffer *buffer, int switch_to_another);
void *(*buffer_get) (struct t_gui_buffer *buffer, char *property);
char *(*buffer_get_string) (struct t_gui_buffer *buffer, char *property);
void *(*buffer_get_pointer) (struct t_gui_buffer *buffer, char *property);
void (*buffer_set) (struct t_gui_buffer *buffer, char *property,
char *value);
@ -403,6 +400,8 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
__case_sensitive)
#define weechat_strcasestr(__string1, __string2) \
weechat_plugin->strcasestr(__string1, __string2)
#define weechat_string_match(__string, __mask, __case_sensitive) \
weechat_plugin->string_match(__string, __mask, __case_sensitive)
#define weechat_string_replace(__string, __search, __replace) \
weechat_plugin->string_replace(__string, __search, __replace)
#define weechat_string_remove_quotes(__string, __quotes) \
@ -415,6 +414,10 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
__max, __num_items)
#define weechat_string_free_exploded(__exploded_string) \
weechat_plugin->string_free_exploded(__exploded_string)
#define weechat_string_build_with_exploded(__exploded_string, \
__separator) \
weechat_plugin->string_build_with_exploded(__exploded_string, \
__separator)
#define weechat_string_split_command(__command, __separator) \
weechat_plugin->string_split_command(__command, __separator)
#define weechat_string_free_splitted_command(__splitted_command) \
@ -559,9 +562,18 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
#define weechat_color(__color_name) \
weechat_plugin->color(__color_name)
#define weechat_printf(__buffer, __message, __argz...) \
weechat_plugin->printf_date(__buffer, 0, __message, ##__argz)
weechat_plugin->printf_date_tags(__buffer, 0, NULL, __message, \
##__argz)
#define weechat_printf_date(__buffer, __date, __message, __argz...) \
weechat_plugin->printf_date(__buffer, __date, __message, ##__argz)
weechat_plugin->printf_date_tags(__buffer, __date, NULL, \
__message, ##__argz)
#define weechat_printf_tags(__buffer, __tags, __message, __argz...) \
weechat_plugin->printf_date_tags(__buffer, 0, __tags, __message, \
##__argz)
#define weechat_printf_date_tags(__buffer, __date, __tags, __message, \
__argz...) \
weechat_plugin->printf_date_tags(__buffer, __date, __tags, \
__message, ##__argz)
#define weechat_infobar_printf(__delay, __color_name, __message, \
__argz...) \
weechat_plugin->infobar_printf(weechat_plugin, __delay, \
@ -588,10 +600,11 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
weechat_plugin->hook_fd(weechat_plugin, __fd, __flag_read, \
__flag_write, __flag_exception, __callback, \
__data)
#define weechat_hook_print(__buffer, __msg, __stri__colors, __callback, \
__data) \
weechat_plugin->hook_print(weechat_plugin, __buffer, __msg, \
__stri__colors, __callback, __data)
#define weechat_hook_print(__buffer, __tags, __msg, __strip__colors, \
__callback, __data) \
weechat_plugin->hook_print(weechat_plugin, __buffer, __tags, \
__msg, __strip__colors, __callback, \
__data)
#define weechat_hook_signal(__signal, __callback, __data) \
weechat_plugin->hook_signal(weechat_plugin, __signal, __callback, \
__data)
@ -629,8 +642,10 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
weechat_plugin->buffer_search(NULL, NULL)
#define weechat_buffer_close(__buffer, __switch_to_another) \
weechat_plugin->buffer_close(__buffer, __switch_to_another)
#define weechat_buffer_get(__buffer, __property) \
weechat_plugin->buffer_get(__buffer, __property)
#define weechat_buffer_get_string(__buffer, __property) \
weechat_plugin->buffer_get_string(__buffer, __property)
#define weechat_buffer_get_pointer(__buffer, __property) \
weechat_plugin->buffer_get_pointer(__buffer, __property)
#define weechat_buffer_set(__buffer, __property, __value) \
weechat_plugin->buffer_set(__buffer, __property, __value)