diff --git a/po/POTFILES.in b/po/POTFILES.in index 77ead9276..d085f4b8c 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -116,6 +116,8 @@ ./src/plugins/irc/irc-display.c ./src/plugins/irc/irc-display.h ./src/plugins/irc/irc.h +./src/plugins/irc/irc-ignore.c +./src/plugins/irc/irc-ignore.h ./src/plugins/irc/irc-info.c ./src/plugins/irc/irc-info.h ./src/plugins/irc/irc-input.c diff --git a/po/cs.po b/po/cs.po index 488297e0e..f1b2e36f7 100644 --- a/po/cs.po +++ b/po/cs.po @@ -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-09-03 10:09+0200\n" +"POT-Creation-Date: 2008-09-03 15:15+0200\n" "PO-Revision-Date: 2007-09-06 12:44+0200\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" @@ -165,7 +165,7 @@ msgid "%sError: wrong size \"%s\" for bar \"%s\"" msgstr "%s špatný počet parametrů pro příkaz \"%s\"\n" #, fuzzy -msgid "All bars deleted" +msgid "All bars have been deleted" msgstr "uživatel byl zablokován" #, fuzzy, c-format @@ -256,6 +256,14 @@ msgstr "%sChyba: musíte specifikovat buď tag(y) nebo regulární výrazpro fil msgid "Filter added" msgstr "uživatel byl zablokován" +#, fuzzy, c-format +msgid "%sError adding filter" +msgstr "%s nekorektní číslo bufferu\n" + +#, fuzzy +msgid "All filters have been deleted" +msgstr "uživatel byl zablokován" + #, fuzzy msgid "Filter deleted" msgstr "uživatel byl zablokován" @@ -738,8 +746,10 @@ msgstr "" "filtrovat zprávy v bufferu, pro jejich schováni/zobrazení podle tagů nebo " "regulárního výrazu" +#, fuzzy msgid "" -"[list] | [enable|disable|toggle] | [add buffer tags regex] | [del number]" +"[list] | [enable|disable|toggle] | [add buffer tags regex] | [del number|-" +"all]" msgstr "" "[list] | [enable|disable|toggle] | [add buffer tagy regex] | [del číslo]" @@ -752,6 +762,7 @@ msgid "" " add: add a filter\n" " del: delete a filter\n" " number: number of filter to delete (look at list to find it)\n" +" -all: delete all filters\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," @@ -2209,6 +2220,54 @@ msgstr "Automatické znovupřipojené je zrušeno\n" msgid "%s%s: server \"%s\" not found" msgstr "%s server \"%s\" nenalezen\n" +#, fuzzy, c-format +msgid "%s: ignore list:" +msgstr "konec /who seznamu" + +#, fuzzy, c-format +msgid " %s[%s%d%s]%s mask: %s / server: %s / channel: %s" +msgstr " (není obsluhovač zprávy)\n" + +#, c-format +msgid "%s: no ignore in list" +msgstr "" + +#, fuzzy, c-format +msgid "%s%s: missing arguments for \"%s\" command" +msgstr "%s chybí argumenty pro příkaz \"%s\"\n" + +#, fuzzy, c-format +msgid "%s%s: ignore already exists" +msgstr "%s ignorování již existuje\n" + +#, c-format +msgid "%s: ignore added" +msgstr "" + +#, fuzzy, c-format +msgid "%s%s: error adding ignore" +msgstr "%s nedostatek paměti pro infobar zprávu\n" + +#, fuzzy, c-format +msgid "%s: all ignore deleted" +msgstr "uživatel byl zablokován" + +#, fuzzy, c-format +msgid "%s: ignore deleted" +msgstr "uživatel byl zablokován" + +#, fuzzy, c-format +msgid "%s%s: ignore not found" +msgstr "%s IP adresa nenalezena\n" + +#, fuzzy, c-format +msgid "%s%s: wrong ignore number" +msgstr "%s nekorektní číslo bufferu\n" + +#, fuzzy, c-format +msgid "%s%s: unknown option for \"%s\" command" +msgstr "%s neznámá volba pro příkaz \"%s\"\n" + #, fuzzy, c-format msgid "%s%s: \"%s\" is not a valid regular expression (%s)" msgstr "%s \"%s\" není validní regulární výraz (%s)\n" @@ -2288,10 +2347,6 @@ msgstr "" "Fronty odchozích zpráv všech serverů byly SMAZÁNY. Některé zprávy od Vás " "nebo WeeChat mohou být ztraceny!\n" -#, fuzzy, c-format -msgid "%s%s: unknown option for \"%s\" command" -msgstr "%s neznámá volba pro příkaz \"%s\"\n" - #, fuzzy, c-format msgid "%s%s: wrong argument count for \"%s\" command" msgstr "%s špatný počet parametrů pro příkaz \"%s\"\n" @@ -2459,6 +2514,31 @@ msgstr "" msgid "give half channel operator status to nickname(s)" msgstr "dát přezdívce (přezdívkám) status operátora polovičního kanálu" +msgid "ignore nicks/hosts from servers or channels" +msgstr "" + +msgid "[list] | [add nick/host [server [channel]]] | [del number|-all]" +msgstr "" + +msgid "" +" list: list all ignore\n" +" add: add a ignore\n" +" del: del a ignore\n" +" number: number of ignore to delete (look at list to find it)\n" +" -all: delete all ignore\n" +"nick/host: nick or host to ignore (regular expression allowed)\n" +" server: internal server name where ignore is working\n" +" channel: channel name where ignore is working\n" +"\n" +"Examples:\n" +" ignore nick \"toto\" everywhere:\n" +" /ignore add toto\n" +" ignore host \"toto@domain.com\" on freenode server:\n" +" /ignore add toto@domain.com freenode\n" +" ignore host \"toto*@*.domain.com\" on freenode/#weechat:\n" +" /ignore add toto*@*.domain.com freenode #weechat" +msgstr "" + msgid "get information describing the server" msgstr "získat informace popisující server" @@ -3289,6 +3369,10 @@ msgstr "seznam uživatelů přihlášených k serveru" msgid "list of nicks for an IRC channel" msgstr "seznam uživatelů na kanálu" +#, fuzzy +msgid "list of IRC ignore" +msgstr "heslo pro IRC server" + #, fuzzy, c-format msgid "%s%s: you are not connected to server" msgstr "%s nepřipojen k serveru\n" diff --git a/po/de.po b/po/de.po index a0658bf6c..93b2d2548 100644 --- a/po/de.po +++ b/po/de.po @@ -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-09-03 10:09+0200\n" +"POT-Creation-Date: 2008-09-03 15:15+0200\n" "PO-Revision-Date: 2007-09-06 12:44+0200\n" "Last-Translator: Thomas Schuetz \n" "Language-Team: weechat-dev \n" @@ -170,7 +170,7 @@ msgid "%sError: wrong size \"%s\" for bar \"%s\"" msgstr "%s fehlerhafte Anzahl von Argumenten für der \"%s\"-Befehl\n" #, fuzzy -msgid "All bars deleted" +msgid "All bars have been deleted" msgstr "/users wurde deaktiviert" #, fuzzy, c-format @@ -261,6 +261,14 @@ msgstr "" msgid "Filter added" msgstr "/users wurde deaktiviert" +#, fuzzy, c-format +msgid "%sError adding filter" +msgstr "%s falsche Puffernummer\n" + +#, fuzzy +msgid "All filters have been deleted" +msgstr "/users wurde deaktiviert" + #, fuzzy msgid "Filter deleted" msgstr "/users wurde deaktiviert" @@ -728,7 +736,8 @@ msgid "" msgstr "" msgid "" -"[list] | [enable|disable|toggle] | [add buffer tags regex] | [del number]" +"[list] | [enable|disable|toggle] | [add buffer tags regex] | [del number|-" +"all]" msgstr "" msgid "" @@ -739,6 +748,7 @@ msgid "" " add: add a filter\n" " del: delete a filter\n" " number: number of filter to delete (look at list to find it)\n" +" -all: delete all filters\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," @@ -2153,6 +2163,54 @@ msgstr "Automatisches Neuverbinden abgebrochen\n" msgid "%s%s: server \"%s\" not found" msgstr "%s Server \"%s\" nicht gefunden\n" +#, fuzzy, c-format +msgid "%s: ignore list:" +msgstr "Ende der /who-Liste" + +#, fuzzy, c-format +msgid " %s[%s%d%s]%s mask: %s / server: %s / channel: %s" +msgstr " (kein Message-Handler)\n" + +#, fuzzy, c-format +msgid "%s: no ignore in list" +msgstr "%s Keine /ignore-Regel gefunden.\n" + +#, fuzzy, c-format +msgid "%s%s: missing arguments for \"%s\" command" +msgstr "%s fehlende Argumente für den \"%s\"-Befehl\n" + +#, fuzzy, c-format +msgid "%s%s: ignore already exists" +msgstr "%s diese /ignore-Regel existiert bereits\n" + +#, fuzzy, c-format +msgid "%s: ignore added" +msgstr "Keine /ignore-Regeln definiert.\n" + +#, fuzzy, c-format +msgid "%s%s: error adding ignore" +msgstr "%s nicht genügend Speicher für Infobar-Nachricht\n" + +#, fuzzy, c-format +msgid "%s: all ignore deleted" +msgstr "/users wurde deaktiviert" + +#, fuzzy, c-format +msgid "%s: ignore deleted" +msgstr "Keine /ignore-Regeln definiert.\n" + +#, fuzzy, c-format +msgid "%s%s: ignore not found" +msgstr "Sitzungssignatur nicht gefunden" + +#, fuzzy, c-format +msgid "%s%s: wrong ignore number" +msgstr "%s falsche Puffernummer\n" + +#, fuzzy, c-format +msgid "%s%s: unknown option for \"%s\" command" +msgstr "%s unbekannte Option für den \"%s\"-Befehl\n" + #, fuzzy, c-format msgid "%s%s: \"%s\" is not a valid regular expression (%s)" msgstr "%s \"%s\" ist kein korrekter regulärer Ausdruck (%s)\n" @@ -2232,10 +2290,6 @@ msgid "" "WeeChat may have been lost!" msgstr "" -#, fuzzy, c-format -msgid "%s%s: unknown option for \"%s\" command" -msgstr "%s unbekannte Option für den \"%s\"-Befehl\n" - #, fuzzy, c-format msgid "%s%s: wrong argument count for \"%s\" command" msgstr "%s fehlerhafte Anzahl von Argumenten für der \"%s\"-Befehl\n" @@ -2397,6 +2451,31 @@ msgstr "" msgid "give half channel operator status to nickname(s)" msgstr "Halb-Operatorstatus verleihen" +msgid "ignore nicks/hosts from servers or channels" +msgstr "" + +msgid "[list] | [add nick/host [server [channel]]] | [del number|-all]" +msgstr "" + +msgid "" +" list: list all ignore\n" +" add: add a ignore\n" +" del: del a ignore\n" +" number: number of ignore to delete (look at list to find it)\n" +" -all: delete all ignore\n" +"nick/host: nick or host to ignore (regular expression allowed)\n" +" server: internal server name where ignore is working\n" +" channel: channel name where ignore is working\n" +"\n" +"Examples:\n" +" ignore nick \"toto\" everywhere:\n" +" /ignore add toto\n" +" ignore host \"toto@domain.com\" on freenode server:\n" +" /ignore add toto@domain.com freenode\n" +" ignore host \"toto*@*.domain.com\" on freenode/#weechat:\n" +" /ignore add toto*@*.domain.com freenode #weechat" +msgstr "" + msgid "get information describing the server" msgstr "Information über den Server abfragen" @@ -3206,6 +3285,10 @@ msgstr "Channels, die bei Verbindung zum Server zu betreten sind" msgid "list of nicks for an IRC channel" msgstr "Liste von Nicks im Channel" +#, fuzzy +msgid "list of IRC ignore" +msgstr "Port des IRC-Servers" + #, fuzzy, c-format msgid "%s%s: you are not connected to server" msgstr "%s keine Verbindung zum Server \"%s\"!\n" @@ -6005,9 +6088,6 @@ msgstr "%s fehlende Argumente für die \"--dir\"-Option\n" #~ msgid "session file not found" #~ msgstr "Sitzungsdatei nicht gefunden" -#~ msgid "signature not found" -#~ msgstr "Sitzungssignatur nicht gefunden" - #~ msgid "bad session signature" #~ msgstr "Fehlerhafte Sitzungssignatur" @@ -6439,9 +6519,6 @@ msgstr "%s fehlende Argumente für die \"--dir\"-Option\n" #~ msgid "IRC commands:\n" #~ msgstr "IRC-Befehle:\n" -#~ msgid "No ignore defined.\n" -#~ msgstr "Keine /ignore-Regeln definiert.\n" - #~ msgid "New ignore:" #~ msgstr "Neue /ignore-Regel:" @@ -6482,9 +6559,6 @@ msgstr "%s fehlende Argumente für die \"--dir\"-Option\n" #~ msgstr[0] "/ignore-Regel entfernt.\n" #~ msgstr[1] "/ignore-Regel entfernt.\n" -#~ msgid "%s no ignore found\n" -#~ msgstr "%s Keine /ignore-Regel gefunden.\n" - #~ msgid "%s can't upgrade: connection to at least one server is pending\n" #~ msgstr "" #~ "%s Aktualisierung nicht möglich: es wird noch auf eine Verbindung zu " diff --git a/po/es.po b/po/es.po index 9bb23c0fb..2cfa85576 100644 --- a/po/es.po +++ b/po/es.po @@ -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-09-03 10:09+0200\n" +"POT-Creation-Date: 2008-09-03 15:15+0200\n" "PO-Revision-Date: 2007-09-19 12:09+0200\n" "Last-Translator: Roberto González Cardenete \n" "Language-Team: weechat-dev \n" @@ -166,7 +166,7 @@ msgid "%sError: wrong size \"%s\" for bar \"%s\"" msgstr "%s número de argumentos incorrecto para el comando \"%s\"\n" #, fuzzy -msgid "All bars deleted" +msgid "All bars have been deleted" msgstr "los usuarios han sido desactivados" #, fuzzy, c-format @@ -257,6 +257,14 @@ msgstr "" msgid "Filter added" msgstr "los usuarios han sido desactivados" +#, fuzzy, c-format +msgid "%sError adding filter" +msgstr "%s número de búfer incorrecto\n" + +#, fuzzy +msgid "All filters have been deleted" +msgstr "los usuarios han sido desactivados" + #, fuzzy msgid "Filter deleted" msgstr "los usuarios han sido desactivados" @@ -724,7 +732,8 @@ msgid "" msgstr "" msgid "" -"[list] | [enable|disable|toggle] | [add buffer tags regex] | [del number]" +"[list] | [enable|disable|toggle] | [add buffer tags regex] | [del number|-" +"all]" msgstr "" msgid "" @@ -735,6 +744,7 @@ msgid "" " add: add a filter\n" " del: delete a filter\n" " number: number of filter to delete (look at list to find it)\n" +" -all: delete all filters\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," @@ -1127,8 +1137,8 @@ msgstr "la cadena mostrada tras la finalización de los nombres de usuario" #, fuzzy msgid "use a marker (line or char) on buffers to show first unread line" msgstr "" -"usar un marcador en los servidores/canales para mostrar la primera línea sin " -"leer" +"usar un marcador en los servidores/canales para mostrar la primera línea " +"sin leer" #, fuzzy msgid "save configuration file on exit" @@ -2131,6 +2141,55 @@ msgstr "La reconexión automática está anulada\n" msgid "%s%s: server \"%s\" not found" msgstr "%s servidor \"%s\" no encontrado\n" +#, fuzzy, c-format +msgid "%s: ignore list:" +msgstr "fin de la lista /who" + +#, fuzzy, c-format +msgid " %s[%s%d%s]%s mask: %s / server: %s / channel: %s" +msgstr " (sin manejador de mensaje)\n" + +#, fuzzy, c-format +msgid "%s: no ignore in list" +msgstr "%s no se encontraron ignores\n" + +#, fuzzy, c-format +msgid "%s%s: missing arguments for \"%s\" command" +msgstr "%s faltan argumentos para el comando \"%s\"\n" + +#, fuzzy, c-format +msgid "%s%s: ignore already exists" +msgstr "el ignore %s ya existe\n" + +#, fuzzy, c-format +msgid "%s: ignore added" +msgstr "Sin ignores definidos.\n" + +#, fuzzy, c-format +msgid "%s%s: error adding ignore" +msgstr "" +"No hay suficiente memoria para el mensaje de la barra de información\n" + +#, fuzzy, c-format +msgid "%s: all ignore deleted" +msgstr "los usuarios han sido desactivados" + +#, fuzzy, c-format +msgid "%s: ignore deleted" +msgstr "Sin ignores definidos.\n" + +#, fuzzy, c-format +msgid "%s%s: ignore not found" +msgstr "firma no encontrada" + +#, fuzzy, c-format +msgid "%s%s: wrong ignore number" +msgstr "%s número de búfer incorrecto\n" + +#, fuzzy, c-format +msgid "%s%s: unknown option for \"%s\" command" +msgstr "%s opción desconocida para el comando \"%s\"\n" + #, fuzzy, c-format msgid "%s%s: \"%s\" is not a valid regular expression (%s)" msgstr "%s \"%s\" no es una expresión regular válida (%s)\n" @@ -2207,10 +2266,6 @@ msgid "" "WeeChat may have been lost!" msgstr "" -#, fuzzy, c-format -msgid "%s%s: unknown option for \"%s\" command" -msgstr "%s opción desconocida para el comando \"%s\"\n" - #, fuzzy, c-format msgid "%s%s: wrong argument count for \"%s\" command" msgstr "%s número de argumentos incorrecto para el comando \"%s\"\n" @@ -2379,6 +2434,31 @@ msgstr "nombre_del_servidor: nombre del servidor al que conectarse" msgid "give half channel operator status to nickname(s)" msgstr "dar el estado de operador de medio canal a/a los usuario(s)" +msgid "ignore nicks/hosts from servers or channels" +msgstr "" + +msgid "[list] | [add nick/host [server [channel]]] | [del number|-all]" +msgstr "" + +msgid "" +" list: list all ignore\n" +" add: add a ignore\n" +" del: del a ignore\n" +" number: number of ignore to delete (look at list to find it)\n" +" -all: delete all ignore\n" +"nick/host: nick or host to ignore (regular expression allowed)\n" +" server: internal server name where ignore is working\n" +" channel: channel name where ignore is working\n" +"\n" +"Examples:\n" +" ignore nick \"toto\" everywhere:\n" +" /ignore add toto\n" +" ignore host \"toto@domain.com\" on freenode server:\n" +" /ignore add toto@domain.com freenode\n" +" ignore host \"toto*@*.domain.com\" on freenode/#weechat:\n" +" /ignore add toto*@*.domain.com freenode #weechat" +msgstr "" + msgid "get information describing the server" msgstr "obtener información describiendo al servidor" @@ -3200,6 +3280,10 @@ msgstr "lista de canales a unirse cuando se conecte a un servidor" msgid "list of nicks for an IRC channel" msgstr "lista de usuarios en el canal" +#, fuzzy +msgid "list of IRC ignore" +msgstr "puerto para el servidor IRC" + #, fuzzy, c-format msgid "%s%s: you are not connected to server" msgstr "%s ¡no conectado al servidor \"%s\"!\n" @@ -5692,8 +5776,8 @@ msgstr "%s falta un argumento para la opción --dir\n" #~ "maximum number of lines in history for one server/channel/private window " #~ "(0 = unlimited)" #~ msgstr "" -#~ "número máximo de líneas en el histórico para un servidor/canal/privado " -#~ "(0 = ilimitado)" +#~ "número máximo de líneas en el histórico para un servidor/canal/" +#~ "privado (0 = ilimitado)" #, fuzzy #~ msgid "log messages from plugins" @@ -5884,8 +5968,8 @@ msgstr "%s falta un argumento para la opción --dir\n" #~ "max size for aligning nick and other messages (should be >= to " #~ "look_align_size)" #~ msgstr "" -#~ "tamaño máximo para la alineación de nick y otros mensajes (debería ser " -#~ ">= a look_align_size)" +#~ "tamaño máximo para la alineación de nick y otros mensajes (debería " +#~ "ser >= a look_align_size)" #~ msgid "server name not found" #~ msgstr "nombre de servidor no encontrado" @@ -6026,9 +6110,6 @@ msgstr "%s falta un argumento para la opción --dir\n" #~ msgid "session file not found" #~ msgstr "archivo de sesión no encontrado" -#~ msgid "signature not found" -#~ msgstr "firma no encontrada" - #~ msgid "bad session signature" #~ msgstr "firma de sesión corrupta" @@ -6466,9 +6547,6 @@ msgstr "%s falta un argumento para la opción --dir\n" #~ msgid "IRC commands:\n" #~ msgstr "Comandos IRC :\n" -#~ msgid "No ignore defined.\n" -#~ msgstr "Sin ignores definidos.\n" - #~ msgid "New ignore:" #~ msgstr "Nuevo ignore:" @@ -6499,9 +6577,6 @@ msgstr "%s falta un argumento para la opción --dir\n" #~ msgstr[0] "el ignore fue eliminado.\n" #~ msgstr[1] "el ignore fue eliminado.\n" -#~ msgid "%s no ignore found\n" -#~ msgstr "%s no se encontraron ignores\n" - #~ msgid "%s can't upgrade: connection to at least one server is pending\n" #~ msgstr "" #~ "%s no se puede actualizar: conexión pendiente a un servidor al menos\n" @@ -6648,7 +6723,8 @@ msgstr "%s falta un argumento para la opción --dir\n" #~ msgid "color for chan owner symbol (specific to unrealircd)" #~ msgstr "" -#~ "color para el símbolo de propietario de canal (especificado en unrealircd)" +#~ "color para el símbolo de propietario de canal (especificado en " +#~ "unrealircd)" #~ msgid "color for chan admin symbol" #~ msgstr "color para el símbolo de administrador de canal" diff --git a/po/fr.po b/po/fr.po index ca9e5f095..a9818ef17 100644 --- a/po/fr.po +++ b/po/fr.po @@ -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-09-03 10:09+0200\n" -"PO-Revision-Date: 2008-09-03 10:10+0200\n" +"POT-Creation-Date: 2008-09-03 15:15+0200\n" +"PO-Revision-Date: 2008-09-03 15:22+0200\n" "Last-Translator: FlashCode \n" "Language-Team: weechat-dev \n" "MIME-Version: 1.0\n" @@ -161,7 +161,7 @@ msgstr "%sErreur: impossible de créer la barre \"%s\"" msgid "%sError: wrong size \"%s\" for bar \"%s\"" msgstr "%sErreur: taille erronée \"%s\" pour la barre \"%s\"" -msgid "All bars deleted" +msgid "All bars have been deleted" msgstr "Toutes les barres ont été supprimées" #, c-format @@ -248,6 +248,13 @@ msgstr "" msgid "Filter added" msgstr "Filtre ajouté" +#, c-format +msgid "%sError adding filter" +msgstr "%sErreur d'ajout du filtre" + +msgid "All filters have been deleted" +msgstr "Tous les filtres ont été supprimés" + msgid "Filter deleted" msgstr "Filtre supprimé" @@ -743,9 +750,11 @@ msgstr "" "tags ou expressions régulières" msgid "" -"[list] | [enable|disable|toggle] | [add buffer tags regex] | [del number]" +"[list] | [enable|disable|toggle] | [add buffer tags regex] | [del number|-" +"all]" msgstr "" -"[list] | [enable|disable|toggle] | [add buffer tags regex] | [del numéro]" +"[list] | [enable|disable|toggle] | [add buffer tags regex] | [del numéro|-" +"all]" msgid "" " list: list all filters\n" @@ -755,6 +764,7 @@ msgid "" " add: add a filter\n" " del: delete a filter\n" " number: number of filter to delete (look at list to find it)\n" +" -all: delete all filters\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," @@ -780,6 +790,7 @@ msgstr "" " del: supprime un filtre\n" " numéro: numéro du filtre à supprimer (voir la liste des filtres pour le " "trouver)\n" +" -all: supprime tous les filtres\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," @@ -2141,6 +2152,54 @@ msgstr "%s: la reconnexion automatique est annulée" msgid "%s%s: server \"%s\" not found" msgstr "%s%s: serveur \"%s\" non trouvé" +#, c-format +msgid "%s: ignore list:" +msgstr "%s: liste ignore:" + +#, c-format +msgid " %s[%s%d%s]%s mask: %s / server: %s / channel: %s" +msgstr " %s[%s%d%s]%s masque: %s / serveur: %s / canal: %s" + +#, c-format +msgid "%s: no ignore in list" +msgstr "%s: pas d'ignore dans la liste" + +#, c-format +msgid "%s%s: missing arguments for \"%s\" command" +msgstr "%s%s: paramètres manquants pour la commande \"%s\"" + +#, c-format +msgid "%s%s: ignore already exists" +msgstr "%s%s: le ignore existe déjà" + +#, c-format +msgid "%s: ignore added" +msgstr "%s: ignore ajouté" + +#, c-format +msgid "%s%s: error adding ignore" +msgstr "%s%s: erreur d'ajout du ignore" + +#, c-format +msgid "%s: all ignore deleted" +msgstr "%s: ignore supprimés" + +#, c-format +msgid "%s: ignore deleted" +msgstr "%s: ignore supprimé" + +#, c-format +msgid "%s%s: ignore not found" +msgstr "%s%s: ignore non trouvé" + +#, c-format +msgid "%s%s: wrong ignore number" +msgstr "%s%s: numéro d'ignore incorrect" + +#, c-format +msgid "%s%s: unknown option for \"%s\" command" +msgstr "%s%s: option inconnue pour la commande \"%s\"" + #, c-format msgid "%s%s: \"%s\" is not a valid regular expression (%s)" msgstr "%s%s: \"%s\" n'est pas une expression régulière valide (%s)" @@ -2218,10 +2277,6 @@ msgstr "" "%s: la file d'attente de messages sortants a été SUPPRIMEE. Quelques " "messages de vous ou WeeChat risquent d'être perdus !" -#, c-format -msgid "%s%s: unknown option for \"%s\" command" -msgstr "%s%s: option inconnue pour la commande \"%s\"" - #, c-format msgid "%s%s: wrong argument count for \"%s\" command" msgstr "%s%s: nombre de paramètres erroné pour la commande \"%s\"" @@ -2383,6 +2438,49 @@ msgstr "" msgid "give half channel operator status to nickname(s)" msgstr "donner le statut de demi-opérateur à un/des pseudo(s)" +msgid "ignore nicks/hosts from servers or channels" +msgstr "ignore des pseudos/hôtes de serveurs ou canaux" + +msgid "[list] | [add nick/host [server [channel]]] | [del number|-all]" +msgstr "[list] | [add pseudo/hote [server [channel]]] | [del numéro|-all]" + +msgid "" +" list: list all ignore\n" +" add: add a ignore\n" +" del: del a ignore\n" +" number: number of ignore to delete (look at list to find it)\n" +" -all: delete all ignore\n" +"nick/host: nick or host to ignore (regular expression allowed)\n" +" server: internal server name where ignore is working\n" +" channel: channel name where ignore is working\n" +"\n" +"Examples:\n" +" ignore nick \"toto\" everywhere:\n" +" /ignore add toto\n" +" ignore host \"toto@domain.com\" on freenode server:\n" +" /ignore add toto@domain.com freenode\n" +" ignore host \"toto*@*.domain.com\" on freenode/#weechat:\n" +" /ignore add toto*@*.domain.com freenode #weechat" +msgstr "" +" list: liste tous les ignore\n" +" add: ajoute un ignore\n" +" del: supprime un ignore\n" +" numéro: numéro du ignore à supprimer (voir la liste des ignore pour le " +"trouver)\n" +" -all: supprime tous les ignore\n" +"pseudo/hôte: pseudo ou hôte à ignorer (une expression régulière est " +"autorisée)\n" +" serveur: nom de serveur interne où le ignore fonctionnera\n" +" canal: canal où le ignore fonctionnera\n" +"\n" +"Exemples:\n" +" ignorer le pseudo \"toto\" partout:\n" +" /ignore add toto\n" +" ignorer le hôte \"toto@domain.com\" sur le serveur freenode:\n" +" /ignore add toto@domain.com freenode\n" +" ignorer le hôte \"toto*@*.domain.com\" sur freenode/#weechat:\n" +" /ignore add toto*@*.domain.com freenode #weechat" + msgid "get information describing the server" msgstr "voir les informations décrivant le serveur" @@ -3204,6 +3302,9 @@ msgstr "liste des canaux pour un serveur IRC" msgid "list of nicks for an IRC channel" msgstr "liste des pseudos pour un canal IRC" +msgid "list of IRC ignore" +msgstr "liste des ignore IRC" + #, c-format msgid "%s%s: you are not connected to server" msgstr "%s%s: vous n'êtes pas connecté au serveur" diff --git a/po/hu.po b/po/hu.po index 151d149e3..2c1578792 100644 --- a/po/hu.po +++ b/po/hu.po @@ -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-09-03 10:09+0200\n" +"POT-Creation-Date: 2008-09-03 15:15+0200\n" "PO-Revision-Date: 2007-10-10 18:07+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -171,7 +171,7 @@ msgid "%sError: wrong size \"%s\" for bar \"%s\"" msgstr "%s rossz argumentum szám a \"%s\" parancsnak\n" #, fuzzy -msgid "All bars deleted" +msgid "All bars have been deleted" msgstr "a felhasználók le lettek tiltva" #, fuzzy, c-format @@ -262,6 +262,14 @@ msgstr "" msgid "Filter added" msgstr "a felhasználók le lettek tiltva" +#, fuzzy, c-format +msgid "%sError adding filter" +msgstr "%s helytelen pufferszám\n" + +#, fuzzy +msgid "All filters have been deleted" +msgstr "a felhasználók le lettek tiltva" + #, fuzzy msgid "Filter deleted" msgstr "a felhasználók le lettek tiltva" @@ -743,7 +751,8 @@ msgid "" msgstr "" msgid "" -"[list] | [enable|disable|toggle] | [add buffer tags regex] | [del number]" +"[list] | [enable|disable|toggle] | [add buffer tags regex] | [del number|-" +"all]" msgstr "" msgid "" @@ -754,6 +763,7 @@ msgid "" " add: add a filter\n" " del: delete a filter\n" " number: number of filter to delete (look at list to find it)\n" +" -all: delete all filters\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," @@ -2158,6 +2168,54 @@ msgstr "automata újracsatlakozás megszakítva\n" msgid "%s%s: server \"%s\" not found" msgstr "%s a \"%s\" szerver nem található\n" +#, fuzzy, c-format +msgid "%s: ignore list:" +msgstr "a /who lista vége" + +#, fuzzy, c-format +msgid " %s[%s%d%s]%s mask: %s / server: %s / channel: %s" +msgstr " (nincs üzenetkezelő)\n" + +#, fuzzy, c-format +msgid "%s: no ignore in list" +msgstr "%s nem található ilyen mellőzés\n" + +#, fuzzy, c-format +msgid "%s%s: missing arguments for \"%s\" command" +msgstr "%s hiányzó argumentum a \"%s\" parancsnak\n" + +#, fuzzy, c-format +msgid "%s%s: ignore already exists" +msgstr "%s az ignore már létezik\n" + +#, fuzzy, c-format +msgid "%s: ignore added" +msgstr "Nincs mellőzés megadva.\n" + +#, fuzzy, c-format +msgid "%s%s: error adding ignore" +msgstr "%s nincs elég memória az információs pult üzenethez\n" + +#, fuzzy, c-format +msgid "%s: all ignore deleted" +msgstr "a felhasználók le lettek tiltva" + +#, fuzzy, c-format +msgid "%s: ignore deleted" +msgstr "Nincs mellőzés megadva.\n" + +#, fuzzy, c-format +msgid "%s%s: ignore not found" +msgstr "aláírás nem található" + +#, fuzzy, c-format +msgid "%s%s: wrong ignore number" +msgstr "%s helytelen pufferszám\n" + +#, fuzzy, c-format +msgid "%s%s: unknown option for \"%s\" command" +msgstr "%s ismeretlen opció a \"%s\" parancsnak\n" + #, fuzzy, c-format msgid "%s%s: \"%s\" is not a valid regular expression (%s)" msgstr "%s a(z) \"%s\" érvénytelen reguláris kifejezés (%s)\n" @@ -2235,10 +2293,6 @@ msgstr "" "Minden szerver kimenő üzenetlistája TÖRÖLVE. Néhány üzenete vagy WeeChat " "üzenetek elveszhettek!\n" -#, fuzzy, c-format -msgid "%s%s: unknown option for \"%s\" command" -msgstr "%s ismeretlen opció a \"%s\" parancsnak\n" - #, fuzzy, c-format msgid "%s%s: wrong argument count for \"%s\" command" msgstr "%s rossz argumentum szám a \"%s\" parancsnak\n" @@ -2408,6 +2462,31 @@ msgstr "" msgid "give half channel operator status to nickname(s)" msgstr "féloperátori jog biztosítása a felhasználó(k)nak" +msgid "ignore nicks/hosts from servers or channels" +msgstr "" + +msgid "[list] | [add nick/host [server [channel]]] | [del number|-all]" +msgstr "" + +msgid "" +" list: list all ignore\n" +" add: add a ignore\n" +" del: del a ignore\n" +" number: number of ignore to delete (look at list to find it)\n" +" -all: delete all ignore\n" +"nick/host: nick or host to ignore (regular expression allowed)\n" +" server: internal server name where ignore is working\n" +" channel: channel name where ignore is working\n" +"\n" +"Examples:\n" +" ignore nick \"toto\" everywhere:\n" +" /ignore add toto\n" +" ignore host \"toto@domain.com\" on freenode server:\n" +" /ignore add toto@domain.com freenode\n" +" ignore host \"toto*@*.domain.com\" on freenode/#weechat:\n" +" /ignore add toto*@*.domain.com freenode #weechat" +msgstr "" + msgid "get information describing the server" msgstr "szerverleíró információ lekérdezése" @@ -3232,6 +3311,10 @@ msgstr "szobák listája ahová be akarunk lépni csatlakozás után" msgid "list of nicks for an IRC channel" msgstr "felhasználók listája a szobában" +#, fuzzy +msgid "list of IRC ignore" +msgstr "IRC szerver portja" + #, fuzzy, c-format msgid "%s%s: you are not connected to server" msgstr "%s nincs csatlakozva szerverhez!\n" @@ -5995,9 +6078,6 @@ msgstr "%s hiányzó argumentum a(z) \"%s\" opciónak\n" #~ msgid "session file not found" #~ msgstr "folyamatfájl nem található" -#~ msgid "signature not found" -#~ msgstr "aláírás nem található" - #~ msgid "bad session signature" #~ msgstr "hibás folyamatellenőrző" @@ -6425,9 +6505,6 @@ msgstr "%s hiányzó argumentum a(z) \"%s\" opciónak\n" #~ msgid "IRC commands:\n" #~ msgstr "IRC parancsok:\n" -#~ msgid "No ignore defined.\n" -#~ msgstr "Nincs mellőzés megadva.\n" - #~ msgid "New ignore:" #~ msgstr "Új mellőzés:" @@ -6462,9 +6539,6 @@ msgstr "%s hiányzó argumentum a(z) \"%s\" opciónak\n" #~ msgid " . type color (Curses or Gtk color, look at WeeChat doc)\n" #~ msgstr " . típus szín (Curses vagy Gtk szín, lásd WeeChat dokumentáció)\n" -#~ msgid "%s no ignore found\n" -#~ msgstr "%s nem található ilyen mellőzés\n" - #~ msgid "%s can't upgrade: connection to at least one server is pending\n" #~ msgstr "" #~ "%s nem sikerült frissíteni: a kapcsolat egy vagy több szerverrel még " diff --git a/po/ru.po b/po/ru.po index c071802a8..12d67129c 100644 --- a/po/ru.po +++ b/po/ru.po @@ -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-09-03 10:09+0200\n" +"POT-Creation-Date: 2008-09-03 15:15+0200\n" "PO-Revision-Date: 2007-09-06 12:44+0200\n" "Last-Translator: Pavel Shevchuk \n" "Language-Team: weechat-dev \n" @@ -167,7 +167,7 @@ msgid "%sError: wrong size \"%s\" for bar \"%s\"" msgstr "%s некорректное количество аргументов команды \"%s\"\n" #, fuzzy -msgid "All bars deleted" +msgid "All bars have been deleted" msgstr "команда users отключена" #, fuzzy, c-format @@ -258,6 +258,14 @@ msgstr "" msgid "Filter added" msgstr "команда users отключена" +#, fuzzy, c-format +msgid "%sError adding filter" +msgstr "%s неправильный номер буфера\n" + +#, fuzzy +msgid "All filters have been deleted" +msgstr "команда users отключена" + #, fuzzy msgid "Filter deleted" msgstr "команда users отключена" @@ -737,7 +745,8 @@ msgid "" msgstr "" msgid "" -"[list] | [enable|disable|toggle] | [add buffer tags regex] | [del number]" +"[list] | [enable|disable|toggle] | [add buffer tags regex] | [del number|-" +"all]" msgstr "" msgid "" @@ -748,6 +757,7 @@ msgid "" " add: add a filter\n" " del: delete a filter\n" " number: number of filter to delete (look at list to find it)\n" +" -all: delete all filters\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," @@ -2163,6 +2173,54 @@ msgstr "Авто-переподключение отменено\n" msgid "%s%s: server \"%s\" not found" msgstr "%s сервер \"%s\" не найден\n" +#, fuzzy, c-format +msgid "%s: ignore list:" +msgstr "конец списка /who" + +#, fuzzy, c-format +msgid " %s[%s%d%s]%s mask: %s / server: %s / channel: %s" +msgstr " (нет обработчика сообщений)\n" + +#, fuzzy, c-format +msgid "%s: no ignore in list" +msgstr "%s игнорирования не найдены\n" + +#, fuzzy, c-format +msgid "%s%s: missing arguments for \"%s\" command" +msgstr "%s нет аргументов для \"%s\" команды\n" + +#, fuzzy, c-format +msgid "%s%s: ignore already exists" +msgstr "%s игнорирование уже существует\n" + +#, fuzzy, c-format +msgid "%s: ignore added" +msgstr "Игнорирования не заданы.\n" + +#, fuzzy, c-format +msgid "%s%s: error adding ignore" +msgstr "%s недостаточно памяти для сообщения в строке информации\n" + +#, fuzzy, c-format +msgid "%s: all ignore deleted" +msgstr "команда users отключена" + +#, fuzzy, c-format +msgid "%s: ignore deleted" +msgstr "Игнорирования не заданы.\n" + +#, fuzzy, c-format +msgid "%s%s: ignore not found" +msgstr "подпись не найдена" + +#, fuzzy, c-format +msgid "%s%s: wrong ignore number" +msgstr "%s неправильный номер буфера\n" + +#, fuzzy, c-format +msgid "%s%s: unknown option for \"%s\" command" +msgstr "%s неизвестный параметр для команды \"%s\"\n" + #, fuzzy, c-format msgid "%s%s: \"%s\" is not a valid regular expression (%s)" msgstr "%s \"%s\" не является регулярным выражением (%s)\n" @@ -2241,10 +2299,6 @@ msgstr "" "Исходящая очередь сообщений УДАЛЕНА на всех серверах. Некоторые исходящие " "сообщения могли быть утеряны!\n" -#, fuzzy, c-format -msgid "%s%s: unknown option for \"%s\" command" -msgstr "%s неизвестный параметр для команды \"%s\"\n" - #, fuzzy, c-format msgid "%s%s: wrong argument count for \"%s\" command" msgstr "%s некорректное количество аргументов команды \"%s\"\n" @@ -2412,6 +2466,31 @@ msgstr "" msgid "give half channel operator status to nickname(s)" msgstr "даёт статус полу-оператора канала пользователю(-ям)" +msgid "ignore nicks/hosts from servers or channels" +msgstr "" + +msgid "[list] | [add nick/host [server [channel]]] | [del number|-all]" +msgstr "" + +msgid "" +" list: list all ignore\n" +" add: add a ignore\n" +" del: del a ignore\n" +" number: number of ignore to delete (look at list to find it)\n" +" -all: delete all ignore\n" +"nick/host: nick or host to ignore (regular expression allowed)\n" +" server: internal server name where ignore is working\n" +" channel: channel name where ignore is working\n" +"\n" +"Examples:\n" +" ignore nick \"toto\" everywhere:\n" +" /ignore add toto\n" +" ignore host \"toto@domain.com\" on freenode server:\n" +" /ignore add toto@domain.com freenode\n" +" ignore host \"toto*@*.domain.com\" on freenode/#weechat:\n" +" /ignore add toto*@*.domain.com freenode #weechat" +msgstr "" + msgid "get information describing the server" msgstr "получить описание сервера" @@ -3226,6 +3305,10 @@ msgstr "Список каналов, на которые заходить при msgid "list of nicks for an IRC channel" msgstr "список ников на канале" +#, fuzzy +msgid "list of IRC ignore" +msgstr "порт IRC сервера" + #, fuzzy, c-format msgid "%s%s: you are not connected to server" msgstr "%s вы не подключены к серверу\n" @@ -6012,9 +6095,6 @@ msgstr "%s нет аргумента для параметра \"%s\"\n" #~ msgid "session file not found" #~ msgstr "файл сессии не найден" -#~ msgid "signature not found" -#~ msgstr "подпись не найдена" - #~ msgid "bad session signature" #~ msgstr "некорректная подпись сессии" @@ -6441,9 +6521,6 @@ msgstr "%s нет аргумента для параметра \"%s\"\n" #~ msgid "IRC commands:\n" #~ msgstr "Команды IRC:\n" -#~ msgid "No ignore defined.\n" -#~ msgstr "Игнорирования не заданы.\n" - #~ msgid "New ignore:" #~ msgstr "Новое игнорирование:" @@ -6482,9 +6559,6 @@ msgstr "%s нет аргумента для параметра \"%s\"\n" #~ msgstr[0] "%s%d%s игнорирование удалено.\n" #~ msgstr[1] "%s%d%s игнорирований удалено.\n" -#~ msgid "%s no ignore found\n" -#~ msgstr "%s игнорирования не найдены\n" - #~ msgid "%s can't upgrade: connection to at least one server is pending\n" #~ msgstr "%s не могу обновиться: подключение к серверам в процессе\n" diff --git a/po/srcfiles.cmake b/po/srcfiles.cmake index e8e5bde83..fccd74776 100644 --- a/po/srcfiles.cmake +++ b/po/srcfiles.cmake @@ -117,6 +117,8 @@ SET(WEECHAT_SOURCES ./src/plugins/irc/irc-display.c ./src/plugins/irc/irc-display.h ./src/plugins/irc/irc.h +./src/plugins/irc/irc-ignore.c +./src/plugins/irc/irc-ignore.h ./src/plugins/irc/irc-info.c ./src/plugins/irc/irc-info.h ./src/plugins/irc/irc-input.c diff --git a/po/weechat.pot b/po/weechat.pot index 5cea235d5..bb95f01f1 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-09-03 10:09+0200\n" +"POT-Creation-Date: 2008-09-03 15:15+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -142,7 +142,7 @@ msgstr "" msgid "%sError: wrong size \"%s\" for bar \"%s\"" msgstr "" -msgid "All bars deleted" +msgid "All bars have been deleted" msgstr "" #, c-format @@ -227,6 +227,13 @@ msgstr "" msgid "Filter added" msgstr "" +#, c-format +msgid "%sError adding filter" +msgstr "" + +msgid "All filters have been deleted" +msgstr "" + msgid "Filter deleted" msgstr "" @@ -635,7 +642,8 @@ msgid "" msgstr "" msgid "" -"[list] | [enable|disable|toggle] | [add buffer tags regex] | [del number]" +"[list] | [enable|disable|toggle] | [add buffer tags regex] | [del number|-" +"all]" msgstr "" msgid "" @@ -646,6 +654,7 @@ msgid "" " add: add a filter\n" " del: delete a filter\n" " number: number of filter to delete (look at list to find it)\n" +" -all: delete all filters\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," @@ -1828,6 +1837,54 @@ msgstr "" msgid "%s%s: server \"%s\" not found" msgstr "" +#, c-format +msgid "%s: ignore list:" +msgstr "" + +#, c-format +msgid " %s[%s%d%s]%s mask: %s / server: %s / channel: %s" +msgstr "" + +#, c-format +msgid "%s: no ignore in list" +msgstr "" + +#, c-format +msgid "%s%s: missing arguments for \"%s\" command" +msgstr "" + +#, c-format +msgid "%s%s: ignore already exists" +msgstr "" + +#, c-format +msgid "%s: ignore added" +msgstr "" + +#, c-format +msgid "%s%s: error adding ignore" +msgstr "" + +#, c-format +msgid "%s: all ignore deleted" +msgstr "" + +#, c-format +msgid "%s: ignore deleted" +msgstr "" + +#, c-format +msgid "%s%s: ignore not found" +msgstr "" + +#, c-format +msgid "%s%s: wrong ignore number" +msgstr "" + +#, c-format +msgid "%s%s: unknown option for \"%s\" command" +msgstr "" + #, c-format msgid "%s%s: \"%s\" is not a valid regular expression (%s)" msgstr "" @@ -1899,10 +1956,6 @@ msgid "" "WeeChat may have been lost!" msgstr "" -#, c-format -msgid "%s%s: unknown option for \"%s\" command" -msgstr "" - #, c-format msgid "%s%s: wrong argument count for \"%s\" command" msgstr "" @@ -2038,6 +2091,31 @@ msgstr "" msgid "give half channel operator status to nickname(s)" msgstr "" +msgid "ignore nicks/hosts from servers or channels" +msgstr "" + +msgid "[list] | [add nick/host [server [channel]]] | [del number|-all]" +msgstr "" + +msgid "" +" list: list all ignore\n" +" add: add a ignore\n" +" del: del a ignore\n" +" number: number of ignore to delete (look at list to find it)\n" +" -all: delete all ignore\n" +"nick/host: nick or host to ignore (regular expression allowed)\n" +" server: internal server name where ignore is working\n" +" channel: channel name where ignore is working\n" +"\n" +"Examples:\n" +" ignore nick \"toto\" everywhere:\n" +" /ignore add toto\n" +" ignore host \"toto@domain.com\" on freenode server:\n" +" /ignore add toto@domain.com freenode\n" +" ignore host \"toto*@*.domain.com\" on freenode/#weechat:\n" +" /ignore add toto*@*.domain.com freenode #weechat" +msgstr "" + msgid "get information describing the server" msgstr "" @@ -2700,6 +2778,9 @@ msgstr "" msgid "list of nicks for an IRC channel" msgstr "" +msgid "list of IRC ignore" +msgstr "" + #, c-format msgid "%s%s: you are not connected to server" msgstr "" diff --git a/src/core/wee-command.c b/src/core/wee-command.c index 8f8d078ef..579954436 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -302,7 +302,7 @@ command_bar (void *data, struct t_gui_buffer *buffer, if (string_strcasecmp (argv[2], "-all") == 0) { gui_bar_free_all (); - gui_chat_printf (NULL, _("All bars deleted")); + gui_chat_printf (NULL, _("All bars have been deleted")); //gui_bar_create_default (); } else @@ -891,9 +891,17 @@ command_filter (void *data, struct t_gui_buffer *buffer, return WEECHAT_RC_ERROR; } - gui_filter_new (argv[2], argv[3], argv_eol[4]); - gui_chat_printf_date_tags (NULL, 0, GUI_FILTER_TAG_NO_FILTER, - _("Filter added")); + if (gui_filter_new (argv[2], argv[3], argv_eol[4])) + { + gui_chat_printf_date_tags (NULL, 0, GUI_FILTER_TAG_NO_FILTER, + _("Filter added")); + } + else + { + gui_chat_printf_date_tags (NULL, 0, GUI_FILTER_TAG_NO_FILTER, + _("%sError adding filter"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]); + } return WEECHAT_RC_OK; } @@ -910,33 +918,49 @@ command_filter (void *data, struct t_gui_buffer *buffer, "filter del"); return WEECHAT_RC_ERROR; } - error = NULL; - number = strtol (argv[2], &error, 10); - if (error && !error[0]) + if (string_strcasecmp (argv[2], "-all") == 0) { - ptr_filter = gui_filter_search_by_number (number); - if (ptr_filter) + if (gui_filters) { - gui_filter_free (ptr_filter); + gui_filter_free_all (); gui_chat_printf_date_tags (NULL, 0, GUI_FILTER_TAG_NO_FILTER, - _("Filter deleted")); + _("All filters have been deleted")); } else { gui_chat_printf_date_tags (NULL, 0, GUI_FILTER_TAG_NO_FILTER, - _("%sError: filter not found"), - gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]); - return WEECHAT_RC_ERROR; + _("No message filter defined")); } } else { - gui_chat_printf_date_tags (NULL, 0, GUI_FILTER_TAG_NO_FILTER, - _("%sError: wrong filter number"), - gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]); - 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_date_tags (NULL, 0, GUI_FILTER_TAG_NO_FILTER, + _("Filter deleted")); + } + else + { + gui_chat_printf_date_tags (NULL, 0, GUI_FILTER_TAG_NO_FILTER, + _("%sError: filter not found"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]); + return WEECHAT_RC_ERROR; + } + } + else + { + gui_chat_printf_date_tags (NULL, 0, GUI_FILTER_TAG_NO_FILTER, + _("%sError: wrong filter number"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]); + return WEECHAT_RC_ERROR; + } } - return WEECHAT_RC_OK; } @@ -2816,7 +2840,7 @@ command_init () "to tags or regex"), N_("[list] | [enable|disable|toggle] | " "[add buffer tags regex] | " - "[del number]"), + "[del number|-all]"), N_(" list: list all filters\n" " enable: enable filters (filters are enabled by " "default)\n" @@ -2826,6 +2850,7 @@ command_init () " del: delete a filter\n" " number: number of filter to delete (look at list to " "find it)\n" + " -all: delete all filters\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 " diff --git a/src/gui/gui-filter.c b/src/gui/gui-filter.c index bf7a4e53d..bec85e5fb 100644 --- a/src/gui/gui-filter.c +++ b/src/gui/gui-filter.c @@ -218,7 +218,7 @@ gui_filter_search (const char *buffer, const char *tags, const char *regex) return ptr_filter; } - /* no filter found */ + /* filter not found */ return NULL; } @@ -241,7 +241,7 @@ gui_filter_search_by_number (int number) i++; } - /* no filter found */ + /* filter not found */ return NULL; } @@ -311,7 +311,7 @@ gui_filter_new (const char *buffer, const char *tags, const char *regex) } /* create new filter */ - new_filter = (malloc (sizeof (*new_filter))); + new_filter = malloc (sizeof (*new_filter)); if (new_filter) { /* init filter */ diff --git a/src/gui/gui-filter.h b/src/gui/gui-filter.h index 3522463bc..4e249b5de 100644 --- a/src/gui/gui-filter.h +++ b/src/gui/gui-filter.h @@ -37,8 +37,8 @@ struct t_gui_filter 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 */ + struct t_gui_filter *prev_filter; /* link to previous filter */ + struct t_gui_filter *next_filter; /* link to next filter */ }; /* filter variables */ diff --git a/src/plugins/irc/CMakeLists.txt b/src/plugins/irc/CMakeLists.txt index 05eb00665..7ed63016c 100644 --- a/src/plugins/irc/CMakeLists.txt +++ b/src/plugins/irc/CMakeLists.txt @@ -24,6 +24,7 @@ irc-completion.c irc-completion.h irc-config.c irc-config.h irc-debug.c irc-debug.h irc-display.c irc-display.h +irc-ignore.c irc-ignore.h irc-info.c irc-info.h irc-input.c irc-input.h irc-mode.c irc-mode.h diff --git a/src/plugins/irc/Makefile.am b/src/plugins/irc/Makefile.am index 9adf6056b..f6ff77f85 100644 --- a/src/plugins/irc/Makefile.am +++ b/src/plugins/irc/Makefile.am @@ -38,6 +38,8 @@ irc_la_SOURCES = irc.c \ irc-debug.h \ irc-display.c \ irc-display.h \ + irc-ignore.c \ + irc-ignore.h \ irc-info.c \ irc-info.h \ irc-input.c \ diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c index 3343ad18e..d89fb9d01 100644 --- a/src/plugins/irc/irc-command.c +++ b/src/plugins/irc/irc-command.c @@ -38,6 +38,7 @@ #include "irc-channel.h" #include "irc-nick.h" #include "irc-display.h" +#include "irc-ignore.h" /* @@ -1285,6 +1286,159 @@ irc_command_halfop (void *data, struct t_gui_buffer *buffer, int argc, return WEECHAT_RC_OK; } +/* + * irc_command_ignore: add or remove ignore + */ + +int +irc_command_ignore (void *data, struct t_gui_buffer *buffer, int argc, + char **argv, char **argv_eol) +{ + int i; + struct t_irc_ignore *ptr_ignore; + char *mask, *server, *channel, *error; + long number; + + /* make C compiler happy */ + (void) data; + (void) buffer; + (void) argv_eol; + + if ((argc == 1) + || ((argc == 2) && (weechat_strcasecmp (argv[1], "list") == 0))) + { + /* display all key bindings */ + if (irc_ignore_list) + { + weechat_printf (NULL, ""); + weechat_printf (NULL, _("%s: ignore list:"), "irc"); + i = 0; + for (ptr_ignore = irc_ignore_list; ptr_ignore; + ptr_ignore = ptr_ignore->next_ignore) + { + i++; + weechat_printf (NULL, + _(" %s[%s%d%s]%s mask: %s / server: %s / channel: %s"), + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT, + i, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT, + ptr_ignore->mask, + (ptr_ignore->server) ? + ptr_ignore->server : "*", + (ptr_ignore->channel) ? + ptr_ignore->channel : "*"); + } + } + else + weechat_printf (NULL, _("%s: no ignore in list"), "irc"); + + return WEECHAT_RC_OK; + } + + /* add ignore */ + if (weechat_strcasecmp (argv[1], "add") == 0) + { + if (argc < 3) + { + weechat_printf (NULL, + _("%s%s: missing arguments for \"%s\" " + "command"), + weechat_prefix ("error"), "irc", + "ignore add"); + return WEECHAT_RC_ERROR; + } + + mask = argv[2]; + server = (argc > 3) ? argv[3] : NULL; + channel = (argc > 4) ? argv[4] : NULL; + + if (irc_ignore_search (mask, server, channel)) + { + weechat_printf (NULL, + _("%s%s: ignore already exists"), + weechat_prefix ("error"), "irc"); + return WEECHAT_RC_ERROR; + } + + if (irc_ignore_new (mask, server, channel)) + { + weechat_printf (NULL, _("%s: ignore added"), "irc"); + } + else + { + weechat_printf (NULL, _("%s%s: error adding ignore"), + weechat_prefix ("error"), "irc"); + } + + return WEECHAT_RC_OK; + } + + /* delete ignore */ + if (weechat_strcasecmp (argv[1], "del") == 0) + { + if (argc < 3) + { + weechat_printf (NULL, + _("%s%s: missing arguments for \"%s\" " + "command"), + weechat_prefix ("error"), "irc", + "ignore del"); + return WEECHAT_RC_ERROR; + } + + if (weechat_strcasecmp (argv[2], "-all") == 0) + { + if (irc_ignore_list) + { + irc_ignore_free_all (); + weechat_printf (NULL, _("%s: all ignore deleted"), "irc"); + } + else + { + weechat_printf (NULL, _("%s: no ignore in list"), "irc"); + } + } + else + { + error = NULL; + number = strtol (argv[2], &error, 10); + if (error && !error[0]) + { + ptr_ignore = irc_ignore_search_by_number (number); + if (ptr_ignore) + { + irc_ignore_free (ptr_ignore); + weechat_printf (NULL, _("%s: ignore deleted"), "irc"); + } + else + { + weechat_printf (NULL, + _("%s%s: ignore not found"), + weechat_prefix ("error"), "irc"); + return WEECHAT_RC_ERROR; + } + } + else + { + weechat_printf (NULL, + _("%s%s: wrong ignore number"), + weechat_prefix ("error"), "irc"); + return WEECHAT_RC_ERROR; + } + } + + return WEECHAT_RC_OK; + } + + weechat_printf (NULL, + _("%s%s: unknown option for \"%s\" " + "command"), + weechat_prefix ("error"), "irc", "ignore"); + return WEECHAT_RC_ERROR; +} + /* * irc_command_info: get information describing the server */ @@ -3602,6 +3756,30 @@ irc_command_init () N_("[nickname [nickname]]"), "", NULL, &irc_command_halfop, NULL); + weechat_hook_command ("ignore", + N_("ignore nicks/hosts from servers or channels"), + N_("[list] | [add nick/host [server [channel]]] | " + "[del number|-all]"), + N_(" list: list all ignore\n" + " add: add a ignore\n" + " del: del a ignore\n" + " number: number of ignore to delete (look at " + "list to find it)\n" + " -all: delete all ignore\n" + "nick/host: nick or host to ignore (regular " + "expression allowed)\n" + " server: internal server name where ignore " + "is working\n" + " channel: channel name where ignore is " + "working\n\n" + "Examples:\n" + " ignore nick \"toto\" everywhere:\n" + " /ignore add toto\n" + " ignore host \"toto@domain.com\" on freenode server:\n" + " /ignore add toto@domain.com freenode\n" + " ignore host \"toto*@*.domain.com\" on freenode/#weechat:\n" + " /ignore add toto*@*.domain.com freenode #weechat"), + NULL, &irc_command_ignore, NULL); weechat_hook_command ("info", N_("get information describing the server"), N_("[target]"), diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index 24d05f9af..c627377b5 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -29,6 +29,7 @@ #include "../weechat-plugin.h" #include "irc.h" #include "irc-config.h" +#include "irc-ignore.h" #include "irc-server.h" @@ -444,6 +445,8 @@ irc_config_reload (void *data, struct t_config_file *config_file) ptr_server->reloaded_from_config = 0; } + irc_ignore_free_all (); + rc = weechat_config_reload (config_file); if (rc == WEECHAT_CONFIG_READ_OK) @@ -478,6 +481,72 @@ irc_config_reload (void *data, struct t_config_file *config_file) return rc; } +/* + * irc_config_ignore_read: read ignore option from config file + * return 1 if ok, 0 if error + */ + +int +irc_config_ignore_read (void *data, + struct t_config_file *config_file, + struct t_config_section *section, + const char *option_name, const char *value) +{ + char **argv, **argv_eol; + int argc; + + /* make C compiler happy */ + (void) data; + (void) config_file; + (void) section; + + if (option_name) + { + if (value && value[0]) + { + argv = weechat_string_explode (value, ";", 0, 0, &argc); + argv_eol = weechat_string_explode (value, ";", 1, 0, NULL); + if (argv && argv_eol && (argc >= 3)) + { + irc_ignore_new (argv_eol[2], argv[0], argv[1]); + } + if (argv) + weechat_string_free_exploded (argv); + if (argv_eol) + weechat_string_free_exploded (argv_eol); + } + } + + return 1; +} + +/* + * irc_config_ignore_write: write ignore section in configuration file + */ + +void +irc_config_ignore_write (void *data, struct t_config_file *config_file, + const char *section_name) +{ + struct t_irc_ignore *ptr_ignore; + + /* make C compiler happy */ + (void) data; + + weechat_config_write_line (config_file, section_name, NULL); + + for (ptr_ignore = irc_ignore_list; ptr_ignore; + ptr_ignore = ptr_ignore->next_ignore) + { + weechat_config_write_line (config_file, + "ignore", + "%s;%s;%s", + (ptr_ignore->server) ? ptr_ignore->server : "*", + (ptr_ignore->channel) ? ptr_ignore->channel : "*", + ptr_ignore->mask); + } +} + /* * irc_config_server_write_default: write default server section in configuration file */ @@ -847,6 +916,7 @@ irc_config_init () if (!irc_config_file) return 0; + /* look */ ptr_section = weechat_config_new_section (irc_config_file, "look", 0, 0, NULL, NULL, NULL, NULL, @@ -905,6 +975,7 @@ irc_config_init () N_("display notices as private messages"), NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL); + /* network */ ptr_section = weechat_config_new_section (irc_config_file, "network", 0, 0, NULL, NULL, NULL, NULL, @@ -980,6 +1051,7 @@ irc_config_init () N_("send unknown commands to IRC server"), NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL); + /* log */ ptr_section = weechat_config_new_section (irc_config_file, "log", 0, 0, NULL, NULL, NULL, NULL, @@ -1010,7 +1082,21 @@ irc_config_init () "hide_nickserv_pwd", "boolean", N_("hide password displayed by nickserv"), NULL, 0, 0, "on", NULL, NULL, &irc_config_change_log, NULL, NULL, NULL); + + /* filters */ + ptr_section = weechat_config_new_section (irc_config_file, "ignore", + 0, 0, + &irc_config_ignore_read, NULL, + &irc_config_ignore_write, NULL, + &irc_config_ignore_write, NULL, + NULL, NULL); + if (!ptr_section) + { + weechat_config_free (irc_config_file); + return 0; + } + /* server_default */ ptr_section = weechat_config_new_section (irc_config_file, "server_default", 0, 0, NULL, NULL, NULL, NULL, @@ -1025,6 +1111,7 @@ irc_config_init () irc_config_server_create_default_options (ptr_section); + /* server */ ptr_section = weechat_config_new_section (irc_config_file, "server", 1, 1, NULL, NULL, diff --git a/src/plugins/irc/irc-ignore.c b/src/plugins/irc/irc-ignore.c new file mode 100644 index 000000000..22d827436 --- /dev/null +++ b/src/plugins/irc/irc-ignore.c @@ -0,0 +1,286 @@ +/* + * Copyright (c) 2003-2008 by FlashCode + * 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 . + */ + +/* irc-ignore.c: manages ignore list (nicks/hosts) on IRC servers/channels */ + + +#include +#include + +#include "../weechat-plugin.h" +#include "irc.h" +#include "irc-ignore.h" +#include "irc-channel.h" +#include "irc-server.h" + + +struct t_irc_ignore *irc_ignore_list = NULL; /* list of ignore */ +struct t_irc_ignore *last_irc_ignore = NULL; /* last ignore in list */ + + +/* + * irc_ignore_valid: check if a ignore pointer exists + * return 1 if ignore exists + * 0 if ignore is not found + */ + +int +irc_ignore_valid (struct t_irc_ignore *ignore) +{ + struct t_irc_ignore *ptr_ignore; + + if (!ignore) + return 0; + + for (ptr_ignore = irc_ignore_list; ptr_ignore; + ptr_ignore = ptr_ignore->next_ignore) + { + if (ptr_ignore == ignore) + return 1; + } + + /* ignore not found */ + return 0; +} + +/* + * irc_ignore_search: search a ignore + */ + +struct t_irc_ignore * +irc_ignore_search (const char *mask, const char *server, const char *channel) +{ + struct t_irc_ignore *ptr_ignore; + char any[2] = "*"; + + if (!server) + server = any; + if (!channel) + channel = any; + + for (ptr_ignore = irc_ignore_list; ptr_ignore; + ptr_ignore = ptr_ignore->next_ignore) + { + if ((strcmp (ptr_ignore->mask, mask) == 0) + && (weechat_strcasecmp (ptr_ignore->server, server) == 0) + && (weechat_strcasecmp (ptr_ignore->channel, channel) == 0)) + { + return ptr_ignore; + } + } + + /* ignore not found */ + return NULL; +} + +/* + * irc_ignore_search_by_number: search a ignore by number (first is #1) + */ + +struct t_irc_ignore * +irc_ignore_search_by_number (int number) +{ + struct t_irc_ignore *ptr_ignore; + int i; + + i = 1; + for (ptr_ignore = irc_ignore_list; ptr_ignore; + ptr_ignore = ptr_ignore->next_ignore) + { + if (i == number) + return ptr_ignore; + i++; + } + + /* ignore not found */ + return NULL; +} + +/* + * irc_ignore_new: add new ignore + */ + +struct t_irc_ignore * +irc_ignore_new (const char *mask, const char *server, const char *channel) +{ + struct t_irc_ignore *new_ignore; + regex_t *regex; + + if (!mask) + return NULL; + + regex = malloc (sizeof (*regex)); + if (!regex) + return NULL; + + if (regcomp (regex, mask, REG_NOSUB | REG_ICASE) != 0) + { + free (regex); + return NULL; + } + + new_ignore = malloc (sizeof (*new_ignore)); + if (new_ignore) + { + new_ignore->mask = strdup (mask); + new_ignore->regex_mask = regex; + new_ignore->server = (server) ? strdup (server) : strdup ("*"); + new_ignore->channel = (channel) ? strdup (channel) : strdup ("*"); + + /* add ignore to ignore list */ + new_ignore->prev_ignore = last_irc_ignore; + if (irc_ignore_list) + last_irc_ignore->next_ignore = new_ignore; + else + irc_ignore_list = new_ignore; + last_irc_ignore = new_ignore; + new_ignore->next_ignore = NULL; + } + + return new_ignore; +} + +/* + * irc_ignore_check: check if a message (from an IRC server) should be ignored + * or not + * return: 1 if message will be ignored + * 0 if message will be displayed (NOT ignored) + */ + +int +irc_ignore_check (struct t_irc_server *server, struct t_irc_channel *channel, + char *nick, char *host) +{ + struct t_irc_ignore *ptr_ignore; + int server_match, channel_match, regex_match; + + if (!server) + return 0; + + for (ptr_ignore = irc_ignore_list; ptr_ignore; + ptr_ignore = ptr_ignore->next_ignore) + { + server_match = 0; + channel_match = 0; + regex_match = 0; + + if (!server || (strcmp (ptr_ignore->server, "*") == 0)) + server_match = 1; + else + server_match = (weechat_strcasecmp (ptr_ignore->server, + server->name) == 0); + + if (!channel || (strcmp (ptr_ignore->channel, "*") == 0)) + channel_match = 1; + else + { + channel_match = (weechat_strcasecmp (ptr_ignore->channel, + channel->name) == 0); + } + + if (server_match && channel_match) + { + if (nick && (strcmp (ptr_ignore->mask, nick) == 0)) + return 1; + if (host && regexec (ptr_ignore->regex_mask, host, 0, NULL, 0) == 0) + return 1; + } + } + + return 0; +} + +/* + * irc_ignore_free: remove a ignore + */ + +void +irc_ignore_free (struct t_irc_ignore *ignore) +{ + weechat_hook_signal_send ("irc_ignore_removing", + WEECHAT_HOOK_SIGNAL_POINTER, ignore); + + /* free data */ + if (ignore->mask) + free (ignore->mask); + if (ignore->regex_mask) + { + regfree (ignore->regex_mask); + free (ignore->regex_mask); + } + if (ignore->server) + free (ignore->server); + if (ignore->channel) + free (ignore->channel); + + /* remove filter from filters list */ + if (ignore->prev_ignore) + ignore->prev_ignore->next_ignore = ignore->next_ignore; + if (ignore->next_ignore) + ignore->next_ignore->prev_ignore = ignore->prev_ignore; + if (irc_ignore_list == ignore) + irc_ignore_list = ignore->next_ignore; + if (last_irc_ignore == ignore) + last_irc_ignore = ignore->prev_ignore; + + free (ignore); + + weechat_hook_signal_send ("irc_ignore_removed", + WEECHAT_HOOK_SIGNAL_STRING, NULL); +} + +/* + * irc_ignore_free_all: remove all ignore + */ + +void +irc_ignore_free_all () +{ + while (irc_ignore_list) + { + irc_ignore_free (irc_ignore_list); + } +} + +/* + * irc_ignore_add_to_infolist: add a ignore in an infolist + * return 1 if ok, 0 if error + */ + +int +irc_ignore_add_to_infolist (struct t_infolist *infolist, + struct t_irc_ignore *ignore) +{ + struct t_infolist_item *ptr_item; + + if (!infolist || !ignore) + return 0; + + ptr_item = weechat_infolist_new_item (infolist); + if (!ptr_item) + return 0; + + if (!weechat_infolist_new_var_string (ptr_item, "mask", ignore->mask)) + return 0; + if (!weechat_infolist_new_var_string (ptr_item, "server", ignore->server)) + return 0; + if (!weechat_infolist_new_var_string (ptr_item, "channel", ignore->channel)) + return 0; + + return 1; +} diff --git a/src/plugins/irc/irc-ignore.h b/src/plugins/irc/irc-ignore.h new file mode 100644 index 000000000..ba9ac7c55 --- /dev/null +++ b/src/plugins/irc/irc-ignore.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2003-2008 by FlashCode + * 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 . + */ + + +#ifndef __WEECHAT_IRC_IGNORE_H +#define __WEECHAT_IRC_IGNORE_H 1 + +#include + +struct t_irc_server; +struct t_irc_channel; + +struct t_irc_ignore +{ + char *mask; /* nick / host mask */ + regex_t *regex_mask; /* regex for mask */ + char *server; /* server name */ + char *channel; /* channel name */ + struct t_irc_ignore *prev_ignore; /* link to previous ignore */ + struct t_irc_ignore *next_ignore; /* link to next ignore */ +}; + +extern struct t_irc_ignore *irc_ignore_list; + +extern int irc_ignore_valid (struct t_irc_ignore *ignore); +extern struct t_irc_ignore *irc_ignore_search (const char *mask, + const char *server, + const char *channel); +extern struct t_irc_ignore *irc_ignore_search_by_number (int number); +extern struct t_irc_ignore *irc_ignore_new (const char *mask, + const char *server, + const char *channel); +extern int irc_ignore_check (struct t_irc_server *server, + struct t_irc_channel *channel, + char *nick, char *host); +extern void irc_ignore_free (struct t_irc_ignore *ignore); +extern void irc_ignore_free_all (); +extern int irc_ignore_add_to_infolist (struct t_infolist *infolist, + struct t_irc_ignore *ignore); + +#endif /* irc-ignore.h */ diff --git a/src/plugins/irc/irc-info.c b/src/plugins/irc/irc-info.c index ec654a549..594d74e9e 100644 --- a/src/plugins/irc/irc-info.c +++ b/src/plugins/irc/irc-info.c @@ -26,6 +26,7 @@ #include "../weechat-plugin.h" #include "irc.h" #include "irc-channel.h" +#include "irc-ignore.h" #include "irc-nick.h" #include "irc-protocol.h" #include "irc-server.h" @@ -172,6 +173,7 @@ irc_info_get_infolist_cb (void *data, const char *infolist_name, struct t_irc_server *ptr_server; struct t_irc_channel *ptr_channel; struct t_irc_nick *ptr_nick; + struct t_irc_ignore *ptr_ignore; char *pos_comma, *server_name; /* make C compiler happy */ @@ -314,6 +316,40 @@ irc_info_get_infolist_cb (void *data, const char *infolist_name, } } } + else if (weechat_strcasecmp (infolist_name, "irc_ignore") == 0) + { + if (pointer && !irc_ignore_valid (pointer)) + return NULL; + + ptr_infolist = weechat_infolist_new (); + if (ptr_infolist) + { + if (pointer) + { + /* build list with only one ignore */ + if (!irc_ignore_add_to_infolist (ptr_infolist, pointer)) + { + weechat_infolist_free (ptr_infolist); + return NULL; + } + return ptr_infolist; + } + else + { + /* build list with all ignore */ + for (ptr_ignore = irc_ignore_list; ptr_ignore; + ptr_ignore = ptr_ignore->next_ignore) + { + if (!irc_ignore_add_to_infolist (ptr_infolist, ptr_ignore)) + { + weechat_infolist_free (ptr_infolist); + return NULL; + } + } + return ptr_infolist; + } + } + } return NULL; } @@ -340,4 +376,6 @@ irc_info_init () &irc_info_get_infolist_cb, NULL); weechat_hook_infolist ("irc_nick", N_("list of nicks for an IRC channel"), &irc_info_get_infolist_cb, NULL); + weechat_hook_infolist ("irc_ignore", N_("list of IRC ignore"), + &irc_info_get_infolist_cb, NULL); } diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 4e9a6bfd2..8ab2494b4 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -41,6 +41,7 @@ #include "irc-channel.h" #include "irc-nick.h" #include "irc-mode.h" +#include "irc-ignore.h" /* @@ -226,23 +227,26 @@ irc_protocol_cmd_invite (struct t_irc_server *server, const char *command, :nick!user@host INVITE mynick :#channel */ + IRC_PROTOCOL_GET_HOST; IRC_PROTOCOL_MIN_ARGS(4); IRC_PROTOCOL_CHECK_HOST; /* make C compiler happy */ (void) argv_eol; - weechat_printf_tags (server->buffer, - "irc_invite,notify_highlight", - _("%sYou have been invited to %s%s%s by " - "%s%s"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_CHANNEL, - (argv[3][0] == ':') ? argv[3] + 1 : argv[3], - IRC_COLOR_CHAT, - IRC_COLOR_CHAT_NICK, - irc_protocol_get_nick_from_host (argv[0])); - + if (!irc_ignore_check (server, NULL, nick, host)) + { + weechat_printf_tags (server->buffer, + "irc_invite,notify_highlight", + _("%sYou have been invited to %s%s%s by " + "%s%s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_CHANNEL, + (argv[3][0] == ':') ? argv[3] + 1 : argv[3], + IRC_COLOR_CHAT, + IRC_COLOR_CHAT_NICK, + nick); + } return WEECHAT_RC_OK; } @@ -262,7 +266,8 @@ irc_protocol_cmd_join (struct t_irc_server *server, const char *command, /* JOIN message looks like: :nick!user@host JOIN :#channel */ - + + IRC_PROTOCOL_GET_HOST; IRC_PROTOCOL_MIN_ARGS(3); IRC_PROTOCOL_CHECK_HOST; @@ -285,19 +290,22 @@ irc_protocol_cmd_join (struct t_irc_server *server, const char *command, } } - weechat_printf_tags (ptr_channel->buffer, - "irc_join", - _("%s%s%s %s(%s%s%s)%s has joined %s%s"), - weechat_prefix ("join"), - IRC_COLOR_CHAT_NICK, - irc_protocol_get_nick_from_host (argv[0]), - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT_HOST, - irc_protocol_get_address_from_host (argv[0]), - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT, - IRC_COLOR_CHAT_CHANNEL, - pos_channel); + if (!irc_ignore_check (server, ptr_channel, nick, host)) + { + weechat_printf_tags (ptr_channel->buffer, + "irc_join", + _("%s%s%s %s(%s%s%s)%s has joined %s%s"), + weechat_prefix ("join"), + IRC_COLOR_CHAT_NICK, + nick, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT_HOST, + address, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT, + IRC_COLOR_CHAT_CHANNEL, + pos_channel); + } /* remove topic and display channel creation date if joining new channel */ if (!ptr_channel->nicks) @@ -309,11 +317,9 @@ irc_protocol_cmd_join (struct t_irc_server *server, const char *command, } /* add nick in channel */ - ptr_nick = irc_nick_new (server, ptr_channel, - irc_protocol_get_nick_from_host (argv[0]), - 0, 0, 0, 0, 0, 0, 0); + ptr_nick = irc_nick_new (server, ptr_channel, nick, 0, 0, 0, 0, 0, 0, 0); if (ptr_nick) - ptr_nick->host = strdup (irc_protocol_get_address_from_host (argv[0])); + ptr_nick->host = strdup (address); return WEECHAT_RC_OK; } @@ -329,11 +335,12 @@ irc_protocol_cmd_kick (struct t_irc_server *server, const char *command, char *pos_comment; struct t_irc_channel *ptr_channel; struct t_irc_nick *ptr_nick; - + /* KICK message looks like: :nick1!user@host KICK #channel nick2 :kick reason */ + IRC_PROTOCOL_GET_HOST; IRC_PROTOCOL_MIN_ARGS(4); IRC_PROTOCOL_CHECK_HOST; @@ -351,40 +358,43 @@ irc_protocol_cmd_kick (struct t_irc_server *server, const char *command, return WEECHAT_RC_ERROR; } - if (pos_comment) + if (!irc_ignore_check (server, ptr_channel, nick, host)) { - weechat_printf_tags (ptr_channel->buffer, - "irc_kick", - _("%s%s%s%s has kicked %s%s%s from %s%s " - "%s(%s%s%s)"), - weechat_prefix ("quit"), - IRC_COLOR_CHAT_NICK, - irc_protocol_get_nick_from_host (argv[0]), - IRC_COLOR_CHAT, - IRC_COLOR_CHAT_NICK, - argv[3], - IRC_COLOR_CHAT, - IRC_COLOR_CHAT_CHANNEL, - argv[2], - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT, - pos_comment, - IRC_COLOR_CHAT_DELIMITERS); - } - else - { - weechat_printf_tags (ptr_channel->buffer, - "irc_kick", - _("%s%s%s%s has kicked %s%s%s from %s%s"), - weechat_prefix ("quit"), - IRC_COLOR_CHAT_NICK, - irc_protocol_get_nick_from_host (argv[0]), - IRC_COLOR_CHAT, - IRC_COLOR_CHAT_NICK, - argv[3], - IRC_COLOR_CHAT, - IRC_COLOR_CHAT_CHANNEL, - argv[2]); + if (pos_comment) + { + weechat_printf_tags (ptr_channel->buffer, + "irc_kick", + _("%s%s%s%s has kicked %s%s%s from %s%s " + "%s(%s%s%s)"), + weechat_prefix ("quit"), + IRC_COLOR_CHAT_NICK, + nick, + IRC_COLOR_CHAT, + IRC_COLOR_CHAT_NICK, + argv[3], + IRC_COLOR_CHAT, + IRC_COLOR_CHAT_CHANNEL, + argv[2], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT, + pos_comment, + IRC_COLOR_CHAT_DELIMITERS); + } + else + { + weechat_printf_tags (ptr_channel->buffer, + "irc_kick", + _("%s%s%s%s has kicked %s%s%s from %s%s"), + weechat_prefix ("quit"), + IRC_COLOR_CHAT_NICK, + nick, + IRC_COLOR_CHAT, + IRC_COLOR_CHAT_NICK, + argv[3], + IRC_COLOR_CHAT, + IRC_COLOR_CHAT_CHANNEL, + argv[2]); + } } if (strcmp (argv[3], server->nick) == 0) @@ -423,6 +433,7 @@ irc_protocol_cmd_kill (struct t_irc_server *server, const char *command, :nick1!user@host KILL mynick :kill reason */ + IRC_PROTOCOL_GET_HOST; IRC_PROTOCOL_MIN_ARGS(3); IRC_PROTOCOL_CHECK_HOST; @@ -432,27 +443,30 @@ irc_protocol_cmd_kill (struct t_irc_server *server, const char *command, for (ptr_channel = server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel) { - if (pos_comment) + if (!irc_ignore_check (server, ptr_channel, nick, host)) { - weechat_printf_tags (ptr_channel->buffer, - "irc_kill", - _("%sYou were killed by %s%s %s(%s%s%s)"), - weechat_prefix ("quit"), - IRC_COLOR_CHAT_NICK, - irc_protocol_get_nick_from_host (argv[0]), - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT, - pos_comment, - IRC_COLOR_CHAT_DELIMITERS); - } - else - { - weechat_printf_tags (ptr_channel->buffer, - "irc_kill", - _("%sYou were killed by %s%s"), - weechat_prefix ("quit"), - IRC_COLOR_CHAT_NICK, - irc_protocol_get_nick_from_host (argv[0])); + if (pos_comment) + { + weechat_printf_tags (ptr_channel->buffer, + "irc_kill", + _("%sYou were killed by %s%s %s(%s%s%s)"), + weechat_prefix ("quit"), + IRC_COLOR_CHAT_NICK, + nick, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT, + pos_comment, + IRC_COLOR_CHAT_DELIMITERS); + } + else + { + weechat_printf_tags (ptr_channel->buffer, + "irc_kill", + _("%sYou were killed by %s%s"), + weechat_prefix ("quit"), + IRC_COLOR_CHAT_NICK, + nick); + } } if (strcmp (argv[2], server->nick) == 0) @@ -489,6 +503,7 @@ irc_protocol_cmd_mode (struct t_irc_server *server, const char *command, :nick!user@host MODE #test +o nick */ + IRC_PROTOCOL_GET_HOST; IRC_PROTOCOL_MIN_ARGS(4); IRC_PROTOCOL_CHECK_HOST; @@ -502,34 +517,40 @@ irc_protocol_cmd_mode (struct t_irc_server *server, const char *command, irc_mode_channel_set (server, ptr_channel, pos_modes); irc_server_sendf (server, "MODE %s", ptr_channel->name); } - weechat_printf_tags ((ptr_channel) ? - ptr_channel->buffer : server->buffer, - "irc_mode", - _("%sMode %s%s %s[%s%s%s]%s by %s%s"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_CHANNEL, - ptr_channel->name, - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT, - pos_modes, - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT, - IRC_COLOR_CHAT_NICK, - irc_protocol_get_nick_from_host (argv[0])); + if (!irc_ignore_check (server, ptr_channel, nick, host)) + { + weechat_printf_tags ((ptr_channel) ? + ptr_channel->buffer : server->buffer, + "irc_mode", + _("%sMode %s%s %s[%s%s%s]%s by %s%s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_CHANNEL, + (ptr_channel) ? ptr_channel->name : argv[2], + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT, + pos_modes, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT, + IRC_COLOR_CHAT_NICK, + nick); + } } else { - weechat_printf_tags (server->buffer, - "irc_mode", - _("%sUser mode %s[%s%s%s]%s by %s%s"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT, - pos_modes, - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT, - IRC_COLOR_CHAT_NICK, - irc_protocol_get_nick_from_host (argv[0])); + if (!irc_ignore_check (server, NULL, nick, host)) + { + weechat_printf_tags (server->buffer, + "irc_mode", + _("%sUser mode %s[%s%s%s]%s by %s%s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT, + pos_modes, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT, + IRC_COLOR_CHAT_NICK, + nick); + } } irc_mode_user_set (server, pos_modes); @@ -546,23 +567,23 @@ irc_protocol_cmd_nick (struct t_irc_server *server, const char *command, { struct t_irc_channel *ptr_channel; struct t_irc_nick *ptr_nick; - char *old_nick, *new_nick; + char *new_nick; int nick_is_me; /* NICK message looks like: :oldnick!user@host NICK :newnick */ + IRC_PROTOCOL_GET_HOST; IRC_PROTOCOL_MIN_ARGS(3); IRC_PROTOCOL_CHECK_HOST; /* make C compiler happy */ (void) argv_eol; - old_nick = irc_protocol_get_nick_from_host (argv[0]); new_nick = (argv[2][0] == ':') ? argv[2] + 1 : argv[2]; - nick_is_me = (strcmp (old_nick, server->nick) == 0) ? 1 : 0; + nick_is_me = (strcmp (nick, server->nick) == 0) ? 1 : 0; for (ptr_channel = server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel) @@ -571,7 +592,7 @@ irc_protocol_cmd_nick (struct t_irc_server *server, const char *command, { case IRC_CHANNEL_TYPE_PRIVATE: /* rename private window if this is with "old nick" */ - if (weechat_strcasecmp (ptr_channel->name, old_nick) == 0) + if (weechat_strcasecmp (ptr_channel->name, nick) == 0) { free (ptr_channel->name); ptr_channel->name = strdup (new_nick); @@ -580,7 +601,7 @@ irc_protocol_cmd_nick (struct t_irc_server *server, const char *command, break; case IRC_CHANNEL_TYPE_CHANNEL: /* rename nick in nicklist if found */ - ptr_nick = irc_nick_search (ptr_channel, old_nick); + ptr_nick = irc_nick_search (ptr_channel, nick); if (ptr_nick) { /* temporary disable hotlist */ @@ -600,16 +621,19 @@ irc_protocol_cmd_nick (struct t_irc_server *server, const char *command, } else { - weechat_printf_tags (ptr_channel->buffer, - "irc_nick", - _("%s%s%s%s is now known as " - "%s%s"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_NICK, - old_nick, - IRC_COLOR_CHAT, - IRC_COLOR_CHAT_NICK, - new_nick); + if (!irc_ignore_check (server, ptr_channel, nick, host)) + { + weechat_printf_tags (ptr_channel->buffer, + "irc_nick", + _("%s%s%s%s is now known as " + "%s%s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_NICK, + nick, + IRC_COLOR_CHAT, + IRC_COLOR_CHAT_NICK, + new_nick); + } } /* enable hotlist */ @@ -633,7 +657,7 @@ int irc_protocol_cmd_notice (struct t_irc_server *server, const char *command, int argc, char **argv, char **argv_eol) { - char *nick, *host, *pos_args, *pos_end, *pos_usec, tags[128]; + char *pos_args, *pos_end, *pos_usec, tags[128]; struct timeval tv; long sec1, usec1, sec2, usec2, difftime; struct t_irc_channel *ptr_channel; @@ -643,20 +667,16 @@ irc_protocol_cmd_notice (struct t_irc_server *server, const char *command, :nick!user@host NOTICE mynick :notice text */ + IRC_PROTOCOL_GET_HOST; IRC_PROTOCOL_MIN_ARGS(3); - + if (argv[0][0] == ':') - { - nick = irc_protocol_get_nick_from_host (argv[0]); - host = irc_protocol_get_address_from_host (argv[0]); pos_args = (argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]; - } else - { - nick = NULL; - host = NULL; pos_args = (argv_eol[2][0] == ':') ? argv_eol[2] + 1 : argv_eol[2]; - } + + if (nick && irc_ignore_check (server, NULL, nick, host)) + return WEECHAT_RC_OK; if (nick && strncmp (pos_args, "\01VERSION", 8) == 0) { @@ -758,7 +778,7 @@ irc_protocol_cmd_notice (struct t_irc_server *server, const char *command, } } if (!ptr_channel->topic) - irc_channel_set_topic (ptr_channel, host); + irc_channel_set_topic (ptr_channel, address); weechat_printf_tags (ptr_channel->buffer, tags, @@ -769,7 +789,7 @@ irc_protocol_cmd_notice (struct t_irc_server *server, const char *command, } else { - if (host && host[0]) + if (address && address[0]) { weechat_printf_tags (server->buffer, tags, @@ -779,7 +799,7 @@ irc_protocol_cmd_notice (struct t_irc_server *server, const char *command, nick, IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_HOST, - host, + address, IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT, pos_args); @@ -821,7 +841,7 @@ int irc_protocol_cmd_part (struct t_irc_server *server, const char *command, int argc, char **argv, char **argv_eol) { - char *nick, *host, *pos_comment, *join_string; + char *pos_comment, *join_string; int join_length; struct t_irc_channel *ptr_channel; struct t_irc_nick *ptr_nick; @@ -830,12 +850,10 @@ irc_protocol_cmd_part (struct t_irc_server *server, const char *command, :nick!user@host PART #channel :part message */ + IRC_PROTOCOL_GET_HOST; IRC_PROTOCOL_MIN_ARGS(3); IRC_PROTOCOL_CHECK_HOST; - nick = irc_protocol_get_nick_from_host (argv[0]); - host = irc_protocol_get_address_from_host (argv[0]); - pos_comment = (argc > 3) ? ((argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]) : NULL; @@ -846,43 +864,46 @@ irc_protocol_cmd_part (struct t_irc_server *server, const char *command, if (ptr_nick) { /* display part message */ - if (pos_comment) + if (!irc_ignore_check (server, ptr_channel, nick, host)) { - weechat_printf_tags (ptr_channel->buffer, - "irc_part", - _("%s%s%s %s(%s%s%s)%s has left %s%s " - "%s(%s%s%s)"), - weechat_prefix ("quit"), - IRC_COLOR_CHAT_NICK, - nick, - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT_HOST, - host, - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT, - IRC_COLOR_CHAT_CHANNEL, - ptr_channel->name, - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT, - pos_comment, - IRC_COLOR_CHAT_DELIMITERS); - } - else - { - weechat_printf_tags (ptr_channel->buffer, - "irc_part", - _("%s%s%s %s(%s%s%s)%s has left " - "%s%s"), - weechat_prefix ("quit"), - IRC_COLOR_CHAT_NICK, - nick, - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT_HOST, - host, - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT, - IRC_COLOR_CHAT_CHANNEL, - ptr_channel->name); + if (pos_comment) + { + weechat_printf_tags (ptr_channel->buffer, + "irc_part", + _("%s%s%s %s(%s%s%s)%s has left %s%s " + "%s(%s%s%s)"), + weechat_prefix ("quit"), + IRC_COLOR_CHAT_NICK, + nick, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT_HOST, + address, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT, + IRC_COLOR_CHAT_CHANNEL, + ptr_channel->name, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT, + pos_comment, + IRC_COLOR_CHAT_DELIMITERS); + } + else + { + weechat_printf_tags (ptr_channel->buffer, + "irc_part", + _("%s%s%s %s(%s%s%s)%s has left " + "%s%s"), + weechat_prefix ("quit"), + IRC_COLOR_CHAT_NICK, + nick, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT_HOST, + address, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT, + IRC_COLOR_CHAT_CHANNEL, + ptr_channel->name); + } } /* part request was issued by local client ? */ @@ -1052,7 +1073,7 @@ int irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command, int argc, char **argv, char **argv_eol) { - char *nick, *host, *pos_args, *pos_end_01, *pos, *pos_message; + char *pos_args, *pos_end_01, *pos, *pos_message; char *dcc_args, *pos_file, *pos_addr, *pos_port, *pos_size, *pos_start_resume; /* for DCC */ struct t_infolist *infolist; struct t_infolist_item *item; @@ -1068,12 +1089,10 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command, :nick!user@host PRIVMSG mynick :\01DCC SEND file.txt 1488915698 50612 128\01 */ + IRC_PROTOCOL_GET_HOST; IRC_PROTOCOL_MIN_ARGS(4); IRC_PROTOCOL_CHECK_HOST; - nick = irc_protocol_get_nick_from_host (argv[0]); - host = irc_protocol_get_address_from_host (argv[0]); - pos_args = (argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]; /* receiver is a channel ? */ @@ -1084,85 +1103,97 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command, { if (strncmp (pos_args, "\01ACTION ", 8) == 0) { - pos_args += 8; - pos_end_01 = strchr (pos_args, '\01'); - if (pos_end_01) - pos_end_01[0] = '\0'; - - weechat_printf_tags (ptr_channel->buffer, - "irc_privmsg,irc_action,notify_message", - "%s%s%s %s%s", - weechat_prefix ("action"), - IRC_COLOR_CHAT_NICK, - nick, - IRC_COLOR_CHAT, - pos_args); - - irc_channel_add_nick_speaking (ptr_channel, nick); + if (!irc_ignore_check (server, ptr_channel, nick, host)) + { + pos_args += 8; + pos_end_01 = strchr (pos_args, '\01'); + if (pos_end_01) + pos_end_01[0] = '\0'; - if (pos_end_01) - pos_end_01[0] = '\01'; + weechat_printf_tags (ptr_channel->buffer, + "irc_privmsg,irc_action,notify_message", + "%s%s%s %s%s", + weechat_prefix ("action"), + IRC_COLOR_CHAT_NICK, + nick, + IRC_COLOR_CHAT, + pos_args); + + irc_channel_add_nick_speaking (ptr_channel, nick); + + if (pos_end_01) + pos_end_01[0] = '\01'; + } return WEECHAT_RC_OK; } if (strncmp (pos_args, "\01SOUND ", 7) == 0) { - pos_args += 7; - pos_end_01 = strchr (pos_args, '\01'); - if (pos_end_01) - pos_end_01[0] = '\0'; + if (!irc_ignore_check (server, ptr_channel, nick, host)) + { + pos_args += 7; + pos_end_01 = strchr (pos_args, '\01'); + if (pos_end_01) + pos_end_01[0] = '\0'; - weechat_printf_tags (ptr_channel->buffer, - "irc_privmsg,irc_ctcp", - _("%sReceived a CTCP %sSOUND%s \"%s\" " - "from %s%s"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_CHANNEL, - IRC_COLOR_CHAT, - pos_args, - IRC_COLOR_CHAT_NICK, - nick); + weechat_printf_tags (ptr_channel->buffer, + "irc_privmsg,irc_ctcp", + _("%sReceived a CTCP %sSOUND%s \"%s\" " + "from %s%s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_CHANNEL, + IRC_COLOR_CHAT, + pos_args, + IRC_COLOR_CHAT_NICK, + nick); - if (pos_end_01) - pos_end_01[0] = '\01'; + if (pos_end_01) + pos_end_01[0] = '\01'; + } return WEECHAT_RC_OK; } if (strncmp (pos_args, "\01PING", 5) == 0) { - pos_args += 5; - while (pos_args[0] == ' ') - pos_args++; - pos_end_01 = strchr (pos_args, '\01'); - if (pos_end_01) - pos_end_01[0] = '\0'; - else - pos_args = NULL; - if (pos_args && !pos_args[0]) - pos_args = NULL; - if (pos_args) - irc_server_sendf (server, "NOTICE %s :\01PING %s\01", - nick, pos_args); - else - irc_server_sendf (server, "NOTICE %s :\01PING\01", - nick); - weechat_printf_tags (ptr_channel->buffer, - "irc_privmsg,irc_ctcp", - _("%sCTCP %sPING%s received from %s%s"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_CHANNEL, - IRC_COLOR_CHAT, - IRC_COLOR_CHAT_NICK, - nick); - if (pos_end_01) - pos_end_01[0] = '\01'; + if (!irc_ignore_check (server, ptr_channel, nick, host)) + { + pos_args += 5; + while (pos_args[0] == ' ') + pos_args++; + pos_end_01 = strchr (pos_args, '\01'); + if (pos_end_01) + pos_end_01[0] = '\0'; + else + pos_args = NULL; + if (pos_args && !pos_args[0]) + pos_args = NULL; + if (pos_args) + irc_server_sendf (server, "NOTICE %s :\01PING %s\01", + nick, pos_args); + else + irc_server_sendf (server, "NOTICE %s :\01PING\01", + nick); + weechat_printf_tags (ptr_channel->buffer, + "irc_privmsg,irc_ctcp", + _("%sCTCP %sPING%s received from %s%s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_CHANNEL, + IRC_COLOR_CHAT, + IRC_COLOR_CHAT_NICK, + nick); + if (pos_end_01) + pos_end_01[0] = '\01'; + } return WEECHAT_RC_OK; } if (strncmp (pos_args, "\01VERSION", 8) == 0) { - irc_protocol_reply_version (server, ptr_channel, nick, - argv_eol[0], pos_args); + if (!irc_ignore_check (server, ptr_channel, nick, host)) + { + irc_protocol_reply_version (server, ptr_channel, nick, + argv_eol[0], pos_args); + } return WEECHAT_RC_OK; } @@ -1172,75 +1203,81 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command, if ((pos_args[0] == '\01') && pos_end_01 && (pos_end_01[1] == '\0')) { - pos_args++; - pos_end_01[0] = '\0'; - pos = strchr (pos_args, ' '); - if (pos) + if (!irc_ignore_check (server, ptr_channel, nick, host)) { - pos[0] = '\0'; - pos_message = pos + 1; - while (pos_message[0] == ' ') + pos_args++; + pos_end_01[0] = '\0'; + pos = strchr (pos_args, ' '); + if (pos) { - pos_message++; - } - if (!pos_message[0]) + pos[0] = '\0'; + pos_message = pos + 1; + while (pos_message[0] == ' ') + { + pos_message++; + } + if (!pos_message[0]) + pos_message = NULL; + } + else pos_message = NULL; - } - else - pos_message = NULL; - if (pos_message) - { - weechat_printf_tags (ptr_channel->buffer, - "irc_privmsg,irc_ctcp", - _("%sUnknown CTCP %s%s%s " - "received from %s%s%s: %s"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_CHANNEL, - pos_args, - IRC_COLOR_CHAT, - IRC_COLOR_CHAT_NICK, - nick, - IRC_COLOR_CHAT, - pos_message); - } - else - { - weechat_printf_tags (ptr_channel->buffer, - "irc_privmsg,irc_ctcp", - _("%sUnknown CTCP %s%s%s " - "received from %s%s"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_CHANNEL, - pos_args, - IRC_COLOR_CHAT, - IRC_COLOR_CHAT_NICK, - nick); - } - if (pos_end_01) - pos_end_01[0] = '\01'; - if (pos) - pos[0] = ' '; + if (pos_message) + { + weechat_printf_tags (ptr_channel->buffer, + "irc_privmsg,irc_ctcp", + _("%sUnknown CTCP %s%s%s " + "received from %s%s%s: %s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_CHANNEL, + pos_args, + IRC_COLOR_CHAT, + IRC_COLOR_CHAT_NICK, + nick, + IRC_COLOR_CHAT, + pos_message); + } + else + { + weechat_printf_tags (ptr_channel->buffer, + "irc_privmsg,irc_ctcp", + _("%sUnknown CTCP %s%s%s " + "received from %s%s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_CHANNEL, + pos_args, + IRC_COLOR_CHAT, + IRC_COLOR_CHAT_NICK, + nick); + } + if (pos_end_01) + pos_end_01[0] = '\01'; + if (pos) + pos[0] = ' '; - weechat_hook_signal_send ("irc_ctcp", - WEECHAT_HOOK_SIGNAL_STRING, - argv_eol[0]); + weechat_hook_signal_send ("irc_ctcp", + WEECHAT_HOOK_SIGNAL_STRING, + argv_eol[0]); + } return WEECHAT_RC_OK; } - + /* other message */ ptr_nick = irc_nick_search (ptr_channel, nick); - weechat_printf_tags (ptr_channel->buffer, - "irc_privmsg,notify_message", - "%s%s", - irc_nick_as_prefix (ptr_nick, - (ptr_nick) ? NULL : nick, - NULL), - pos_args); - - irc_channel_add_nick_speaking (ptr_channel, nick); + if (!irc_ignore_check (server, ptr_channel, nick, host)) + { + weechat_printf_tags (ptr_channel->buffer, + "irc_privmsg,notify_message", + "%s%s", + irc_nick_as_prefix (ptr_nick, + (ptr_nick) ? NULL : nick, + NULL), + pos_args); + + irc_channel_add_nick_speaking (ptr_channel, nick); + } } else { @@ -1257,8 +1294,11 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command, /* version asked by another user => answer with WeeChat version */ if (strncmp (pos_args, "\01VERSION", 8) == 0) { - irc_protocol_reply_version (server, NULL, nick, argv_eol[0], - pos_args); + if (!irc_ignore_check (server, NULL, nick, host)) + { + irc_protocol_reply_version (server, NULL, nick, argv_eol[0], + pos_args); + } return WEECHAT_RC_OK; } @@ -1266,37 +1306,40 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command, /* ping request from another user => answer */ if (strncmp (pos_args, "\01PING", 5) == 0) { - pos_args += 5; - while (pos_args[0] == ' ') + if (!irc_ignore_check (server, NULL, nick, host)) { - pos_args++; + pos_args += 5; + while (pos_args[0] == ' ') + { + pos_args++; + } + pos_end_01 = strchr (pos, '\01'); + if (pos_end_01) + pos_end_01[0] = '\0'; + else + pos_args = NULL; + if (pos_args && !pos_args[0]) + pos_args = NULL; + if (pos_args) + irc_server_sendf (server, "NOTICE %s :\01PING %s\01", + nick, pos_args); + else + irc_server_sendf (server, "NOTICE %s :\01PING\01", + nick); + weechat_printf_tags (server->buffer, + "irc_privmsg,irc_ctcp", + _("%sCTCP %sPING%s received from %s%s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_CHANNEL, + IRC_COLOR_CHAT, + IRC_COLOR_CHAT_NICK, + nick); + weechat_hook_signal_send ("irc_ctcp", + WEECHAT_HOOK_SIGNAL_STRING, + argv_eol[0]); + if (pos_end_01) + pos_end_01[0] = '\01'; } - pos_end_01 = strchr (pos, '\01'); - if (pos_end_01) - pos_end_01[0] = '\0'; - else - pos_args = NULL; - if (pos_args && !pos_args[0]) - pos_args = NULL; - if (pos_args) - irc_server_sendf (server, "NOTICE %s :\01PING %s\01", - nick, pos_args); - else - irc_server_sendf (server, "NOTICE %s :\01PING\01", - nick); - weechat_printf_tags (server->buffer, - "irc_privmsg,irc_ctcp", - _("%sCTCP %sPING%s received from %s%s"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_CHANNEL, - IRC_COLOR_CHAT, - IRC_COLOR_CHAT_NICK, - nick); - weechat_hook_signal_send ("irc_ctcp", - WEECHAT_HOOK_SIGNAL_STRING, - argv_eol[0]); - if (pos_end_01) - pos_end_01[0] = '\01'; return WEECHAT_RC_OK; } @@ -1304,124 +1347,128 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command, /* incoming DCC file */ if (strncmp (pos_args, "\01DCC SEND", 9) == 0) { - /* check if DCC SEND is ok, i.e. with 0x01 at end */ - pos_end_01 = strchr (pos_args + 1, '\01'); - if (!pos_end_01) + if (!irc_ignore_check (server, NULL, nick, host)) { - weechat_printf (server->buffer, - _("%s%s: cannot parse \"%s\" command"), - weechat_prefix ("error"), "irc", - "privmsg"); - return WEECHAT_RC_ERROR; - } - - dcc_args = weechat_strndup (pos_args + 9, pos_end_01 - pos_args - 9); - - if (!dcc_args) - { - weechat_printf (server->buffer, - _("%s%s: not enough memory for \"%s\" " - "command"), - weechat_prefix ("error"), "irc", - "privmsg"); - return WEECHAT_RC_ERROR; - } - - /* DCC filename */ - pos_file = dcc_args; - while (pos_file[0] == ' ') - { - pos_file++; - } - - /* look for file size */ - pos_size = strrchr (pos_file, ' '); - if (!pos_size) - { - weechat_printf (server->buffer, - _("%s%s: cannot parse \"%s\" command"), - weechat_prefix ("error"), "irc", - "privmsg"); - free (dcc_args); - return WEECHAT_RC_ERROR; - } - pos = pos_size; - pos_size++; - while (pos[0] == ' ') - { - pos--; - } - pos[1] = '\0'; - - /* look for DCC port */ - pos_port = strrchr (pos_file, ' '); - if (!pos_port) - { - weechat_printf (server->buffer, - _("%s%s: cannot parse \"%s\" command"), - weechat_prefix ("error"), "irc", - "privmsg"); - free (dcc_args); - return WEECHAT_RC_ERROR; - } - pos = pos_port; - pos_port++; - while (pos[0] == ' ') - { - pos--; - } - pos[1] = '\0'; - - /* look for DCC IP address */ - pos_addr = strrchr (pos_file, ' '); - if (!pos_addr) - { - weechat_printf (server->buffer, - _("%s%s: cannot parse \"%s\" command"), - weechat_prefix ("error"), "irc", - "privmsg"); - free (dcc_args); - return WEECHAT_RC_ERROR; - } - pos = pos_addr; - pos_addr++; - while (pos[0] == ' ') - { - pos--; - } - pos[1] = '\0'; - - /* add DCC file via xfer plugin */ - infolist = weechat_infolist_new (); - if (infolist) - { - item = weechat_infolist_new_item (infolist); - if (item) + /* check if DCC SEND is ok, i.e. with 0x01 at end */ + pos_end_01 = strchr (pos_args + 1, '\01'); + if (!pos_end_01) { - weechat_infolist_new_var_string (item, "plugin_name", weechat_plugin->name); - snprintf (plugin_id, sizeof (plugin_id), - "%x", (unsigned int)server); - weechat_infolist_new_var_string (item, "plugin_id", plugin_id); - weechat_infolist_new_var_string (item, "type", "file_recv"); - weechat_infolist_new_var_string (item, "protocol", "dcc"); - weechat_infolist_new_var_string (item, "remote_nick", nick); - weechat_infolist_new_var_string (item, "local_nick", server->nick); - weechat_infolist_new_var_string (item, "filename", pos_file); - weechat_infolist_new_var_string (item, "size", pos_size); - weechat_infolist_new_var_string (item, "address", pos_addr); - weechat_infolist_new_var_integer (item, "port", atoi (pos_port)); - weechat_hook_signal_send ("xfer_add", - WEECHAT_HOOK_SIGNAL_POINTER, - infolist); + weechat_printf (server->buffer, + _("%s%s: cannot parse \"%s\" command"), + weechat_prefix ("error"), "irc", + "privmsg"); + return WEECHAT_RC_ERROR; } - weechat_infolist_free (infolist); - } - - weechat_hook_signal_send ("irc_dcc", - WEECHAT_HOOK_SIGNAL_STRING, - argv_eol[0]); - free (dcc_args); + dcc_args = weechat_strndup (pos_args + 9, + pos_end_01 - pos_args - 9); + + if (!dcc_args) + { + weechat_printf (server->buffer, + _("%s%s: not enough memory for \"%s\" " + "command"), + weechat_prefix ("error"), "irc", + "privmsg"); + return WEECHAT_RC_ERROR; + } + + /* DCC filename */ + pos_file = dcc_args; + while (pos_file[0] == ' ') + { + pos_file++; + } + + /* look for file size */ + pos_size = strrchr (pos_file, ' '); + if (!pos_size) + { + weechat_printf (server->buffer, + _("%s%s: cannot parse \"%s\" command"), + weechat_prefix ("error"), "irc", + "privmsg"); + free (dcc_args); + return WEECHAT_RC_ERROR; + } + pos = pos_size; + pos_size++; + while (pos[0] == ' ') + { + pos--; + } + pos[1] = '\0'; + + /* look for DCC port */ + pos_port = strrchr (pos_file, ' '); + if (!pos_port) + { + weechat_printf (server->buffer, + _("%s%s: cannot parse \"%s\" command"), + weechat_prefix ("error"), "irc", + "privmsg"); + free (dcc_args); + return WEECHAT_RC_ERROR; + } + pos = pos_port; + pos_port++; + while (pos[0] == ' ') + { + pos--; + } + pos[1] = '\0'; + + /* look for DCC IP address */ + pos_addr = strrchr (pos_file, ' '); + if (!pos_addr) + { + weechat_printf (server->buffer, + _("%s%s: cannot parse \"%s\" command"), + weechat_prefix ("error"), "irc", + "privmsg"); + free (dcc_args); + return WEECHAT_RC_ERROR; + } + pos = pos_addr; + pos_addr++; + while (pos[0] == ' ') + { + pos--; + } + pos[1] = '\0'; + + /* add DCC file via xfer plugin */ + infolist = weechat_infolist_new (); + if (infolist) + { + item = weechat_infolist_new_item (infolist); + if (item) + { + weechat_infolist_new_var_string (item, "plugin_name", weechat_plugin->name); + snprintf (plugin_id, sizeof (plugin_id), + "%x", (unsigned int)server); + weechat_infolist_new_var_string (item, "plugin_id", plugin_id); + weechat_infolist_new_var_string (item, "type", "file_recv"); + weechat_infolist_new_var_string (item, "protocol", "dcc"); + weechat_infolist_new_var_string (item, "remote_nick", nick); + weechat_infolist_new_var_string (item, "local_nick", server->nick); + weechat_infolist_new_var_string (item, "filename", pos_file); + weechat_infolist_new_var_string (item, "size", pos_size); + weechat_infolist_new_var_string (item, "address", pos_addr); + weechat_infolist_new_var_integer (item, "port", atoi (pos_port)); + weechat_hook_signal_send ("xfer_add", + WEECHAT_HOOK_SIGNAL_POINTER, + infolist); + } + weechat_infolist_free (infolist); + } + + weechat_hook_signal_send ("irc_dcc", + WEECHAT_HOOK_SIGNAL_STRING, + argv_eol[0]); + + free (dcc_args); + } return WEECHAT_RC_OK; } @@ -1429,101 +1476,105 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command, /* incoming DCC RESUME (asked by receiver) */ if (strncmp (pos_args, "\01DCC RESUME", 11) == 0) { - /* check if DCC RESUME is ok, i.e. with 0x01 at end */ - pos_end_01 = strchr (pos_args + 1, '\01'); - if (!pos_end_01) + if (!irc_ignore_check (server, NULL, nick, host)) { - weechat_printf (server->buffer, - _("%s%s: cannot parse \"%s\" command"), - weechat_prefix ("error"), "irc", - "privmsg"); - return WEECHAT_RC_ERROR; - } - - dcc_args = weechat_strndup (pos_args + 11, pos_end_01 - pos_args - 11); - - if (!dcc_args) - { - weechat_printf (server->buffer, - _("%s%s: not enough memory for \"%s\" " - "command"), - weechat_prefix ("error"), "irc", - "privmsg"); - return WEECHAT_RC_ERROR; - } - - /* DCC filename */ - pos_file = dcc_args; - while (pos_file[0] == ' ') - { - pos_file++; - } - - /* look for resume start position */ - pos_start_resume = strrchr (pos_file, ' '); - if (!pos_start_resume) - { - weechat_printf (server->buffer, - _("%s%s: cannot parse \"%s\" command"), - weechat_prefix ("error"), "irc", - "privmsg"); - free (dcc_args); - return WEECHAT_RC_ERROR; - } - pos = pos_start_resume; - pos_start_resume++; - while (pos[0] == ' ') - { - pos--; - } - pos[1] = '\0'; - - /* look for DCC port */ - pos_port = strrchr (pos_file, ' '); - if (!pos_port) - { - weechat_printf (server->buffer, - _("%s%s: cannot parse \"%s\" command"), - weechat_prefix ("error"), "irc", - "privmsg"); - free (dcc_args); - return WEECHAT_RC_ERROR; - } - pos = pos_port; - pos_port++; - while (pos[0] == ' ') - { - pos--; - } - pos[1] = '\0'; - - /* accept resume via xfer plugin */ - infolist = weechat_infolist_new (); - if (infolist) - { - item = weechat_infolist_new_item (infolist); - if (item) + /* check if DCC RESUME is ok, i.e. with 0x01 at end */ + pos_end_01 = strchr (pos_args + 1, '\01'); + if (!pos_end_01) { - weechat_infolist_new_var_string (item, "plugin_name", weechat_plugin->name); - snprintf (plugin_id, sizeof (plugin_id), - "%x", (unsigned int)server); - weechat_infolist_new_var_string (item, "plugin_id", plugin_id); - weechat_infolist_new_var_string (item, "type", "file_recv"); - weechat_infolist_new_var_string (item, "filename", pos_file); - weechat_infolist_new_var_integer (item, "port", atoi (pos_port)); - weechat_infolist_new_var_string (item, "start_resume", pos_start_resume); - weechat_hook_signal_send ("xfer_accept_resume", - WEECHAT_HOOK_SIGNAL_POINTER, - infolist); + weechat_printf (server->buffer, + _("%s%s: cannot parse \"%s\" command"), + weechat_prefix ("error"), "irc", + "privmsg"); + return WEECHAT_RC_ERROR; } - weechat_infolist_free (infolist); - } - - weechat_hook_signal_send ("irc_dcc", - WEECHAT_HOOK_SIGNAL_STRING, - argv_eol[0]); - free (dcc_args); + dcc_args = weechat_strndup (pos_args + 11, + pos_end_01 - pos_args - 11); + + if (!dcc_args) + { + weechat_printf (server->buffer, + _("%s%s: not enough memory for \"%s\" " + "command"), + weechat_prefix ("error"), "irc", + "privmsg"); + return WEECHAT_RC_ERROR; + } + + /* DCC filename */ + pos_file = dcc_args; + while (pos_file[0] == ' ') + { + pos_file++; + } + + /* look for resume start position */ + pos_start_resume = strrchr (pos_file, ' '); + if (!pos_start_resume) + { + weechat_printf (server->buffer, + _("%s%s: cannot parse \"%s\" command"), + weechat_prefix ("error"), "irc", + "privmsg"); + free (dcc_args); + return WEECHAT_RC_ERROR; + } + pos = pos_start_resume; + pos_start_resume++; + while (pos[0] == ' ') + { + pos--; + } + pos[1] = '\0'; + + /* look for DCC port */ + pos_port = strrchr (pos_file, ' '); + if (!pos_port) + { + weechat_printf (server->buffer, + _("%s%s: cannot parse \"%s\" command"), + weechat_prefix ("error"), "irc", + "privmsg"); + free (dcc_args); + return WEECHAT_RC_ERROR; + } + pos = pos_port; + pos_port++; + while (pos[0] == ' ') + { + pos--; + } + pos[1] = '\0'; + + /* accept resume via xfer plugin */ + infolist = weechat_infolist_new (); + if (infolist) + { + item = weechat_infolist_new_item (infolist); + if (item) + { + weechat_infolist_new_var_string (item, "plugin_name", weechat_plugin->name); + snprintf (plugin_id, sizeof (plugin_id), + "%x", (unsigned int)server); + weechat_infolist_new_var_string (item, "plugin_id", plugin_id); + weechat_infolist_new_var_string (item, "type", "file_recv"); + weechat_infolist_new_var_string (item, "filename", pos_file); + weechat_infolist_new_var_integer (item, "port", atoi (pos_port)); + weechat_infolist_new_var_string (item, "start_resume", pos_start_resume); + weechat_hook_signal_send ("xfer_accept_resume", + WEECHAT_HOOK_SIGNAL_POINTER, + infolist); + } + weechat_infolist_free (infolist); + } + + weechat_hook_signal_send ("irc_dcc", + WEECHAT_HOOK_SIGNAL_STRING, + argv_eol[0]); + + free (dcc_args); + } return WEECHAT_RC_OK; } @@ -1531,101 +1582,105 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command, /* incoming DCC ACCEPT (resume accepted by sender) */ if (strncmp (pos_args, "\01DCC ACCEPT", 11) == 0) { - /* check if DCC ACCEPT is ok, i.e. with 0x01 at end */ - pos_end_01 = strchr (pos_args + 1, '\01'); - if (!pos_end_01) + if (!irc_ignore_check (server, NULL, nick, host)) { - weechat_printf (server->buffer, - _("%s%s: cannot parse \"%s\" command"), - weechat_prefix ("error"), "irc", - "privmsg"); - return WEECHAT_RC_ERROR; - } - - dcc_args = weechat_strndup (pos_args + 11, pos_end_01 - pos_args - 11); - - if (!dcc_args) - { - weechat_printf (server->buffer, - _("%s%s: not enough memory for \"%s\" " - "command"), - weechat_prefix ("error"), "irc", - "privmsg"); - return WEECHAT_RC_ERROR; - } - - /* DCC filename */ - pos_file = dcc_args; - while (pos_file[0] == ' ') - { - pos_file++; - } - - /* look for resume start position */ - pos_start_resume = strrchr (pos_file, ' '); - if (!pos_start_resume) - { - weechat_printf (server->buffer, - _("%s%s: cannot parse \"%s\" command"), - weechat_prefix ("error"), "irc", - "privmsg"); - free (dcc_args); - return WEECHAT_RC_ERROR; - } - pos = pos_start_resume; - pos_start_resume++; - while (pos[0] == ' ') - { - pos--; - } - pos[1] = '\0'; - - /* look for DCC port */ - pos_port = strrchr (pos_file, ' '); - if (!pos_port) - { - weechat_printf (server->buffer, - _("%s%s: cannot parse \"%s\" command"), - weechat_prefix ("error"), "irc", - "privmsg"); - free (dcc_args); - return WEECHAT_RC_ERROR; - } - pos = pos_port; - pos_port++; - while (pos[0] == ' ') - { - pos--; - } - pos[1] = '\0'; - - /* resume file via xfer plugin */ - infolist = weechat_infolist_new (); - if (infolist) - { - item = weechat_infolist_new_item (infolist); - if (item) + /* check if DCC ACCEPT is ok, i.e. with 0x01 at end */ + pos_end_01 = strchr (pos_args + 1, '\01'); + if (!pos_end_01) { - weechat_infolist_new_var_string (item, "plugin_name", weechat_plugin->name); - snprintf (plugin_id, sizeof (plugin_id), - "%x", (unsigned int)server); - weechat_infolist_new_var_string (item, "plugin_id", plugin_id); - weechat_infolist_new_var_string (item, "type", "file_recv"); - weechat_infolist_new_var_string (item, "filename", pos_file); - weechat_infolist_new_var_integer (item, "port", atoi (pos_port)); - weechat_infolist_new_var_string (item, "start_resume", pos_start_resume); - weechat_hook_signal_send ("xfer_start_resume", - WEECHAT_HOOK_SIGNAL_POINTER, - infolist); + weechat_printf (server->buffer, + _("%s%s: cannot parse \"%s\" command"), + weechat_prefix ("error"), "irc", + "privmsg"); + return WEECHAT_RC_ERROR; } - weechat_infolist_free (infolist); - } - - weechat_hook_signal_send ("irc_dcc", - WEECHAT_HOOK_SIGNAL_STRING, - argv_eol[0]); - free (dcc_args); + dcc_args = weechat_strndup (pos_args + 11, + pos_end_01 - pos_args - 11); + + if (!dcc_args) + { + weechat_printf (server->buffer, + _("%s%s: not enough memory for \"%s\" " + "command"), + weechat_prefix ("error"), "irc", + "privmsg"); + return WEECHAT_RC_ERROR; + } + + /* DCC filename */ + pos_file = dcc_args; + while (pos_file[0] == ' ') + { + pos_file++; + } + + /* look for resume start position */ + pos_start_resume = strrchr (pos_file, ' '); + if (!pos_start_resume) + { + weechat_printf (server->buffer, + _("%s%s: cannot parse \"%s\" command"), + weechat_prefix ("error"), "irc", + "privmsg"); + free (dcc_args); + return WEECHAT_RC_ERROR; + } + pos = pos_start_resume; + pos_start_resume++; + while (pos[0] == ' ') + { + pos--; + } + pos[1] = '\0'; + + /* look for DCC port */ + pos_port = strrchr (pos_file, ' '); + if (!pos_port) + { + weechat_printf (server->buffer, + _("%s%s: cannot parse \"%s\" command"), + weechat_prefix ("error"), "irc", + "privmsg"); + free (dcc_args); + return WEECHAT_RC_ERROR; + } + pos = pos_port; + pos_port++; + while (pos[0] == ' ') + { + pos--; + } + pos[1] = '\0'; + + /* resume file via xfer plugin */ + infolist = weechat_infolist_new (); + if (infolist) + { + item = weechat_infolist_new_item (infolist); + if (item) + { + weechat_infolist_new_var_string (item, "plugin_name", weechat_plugin->name); + snprintf (plugin_id, sizeof (plugin_id), + "%x", (unsigned int)server); + weechat_infolist_new_var_string (item, "plugin_id", plugin_id); + weechat_infolist_new_var_string (item, "type", "file_recv"); + weechat_infolist_new_var_string (item, "filename", pos_file); + weechat_infolist_new_var_integer (item, "port", atoi (pos_port)); + weechat_infolist_new_var_string (item, "start_resume", pos_start_resume); + weechat_hook_signal_send ("xfer_start_resume", + WEECHAT_HOOK_SIGNAL_POINTER, + infolist); + } + weechat_infolist_free (infolist); + } + + weechat_hook_signal_send ("irc_dcc", + WEECHAT_HOOK_SIGNAL_STRING, + argv_eol[0]); + + free (dcc_args); + } return WEECHAT_RC_OK; } @@ -1633,114 +1688,118 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command, /* incoming DCC CHAT */ if (strncmp (pos_args, "\01DCC CHAT", 9) == 0) { - /* check if DCC CHAT is ok, i.e. with 0x01 at end */ - pos_end_01 = strchr (pos_args + 1, '\01'); - if (!pos_end_01) + if (!irc_ignore_check (server, NULL, nick, host)) { - weechat_printf (server->buffer, - _("%s%s: cannot parse \"%s\" command"), - weechat_prefix ("error"), "irc", - "privmsg"); - return WEECHAT_RC_ERROR; - } - - dcc_args = weechat_strndup (pos_args + 9, pos_end_01 - pos_args - 9); - - if (!dcc_args) - { - weechat_printf (server->buffer, - _("%s%s: not enough memory for \"%s\" " - "command"), - weechat_prefix ("error"), "irc", - "privmsg"); - return WEECHAT_RC_ERROR; - } - - /* CHAT type */ - pos_file = dcc_args; - while (pos_file[0] == ' ') - { - pos_file++; - } - - /* DCC IP address */ - pos_addr = strchr (pos_file, ' '); - if (!pos_addr) - { - weechat_printf (server->buffer, - _("%s%s: cannot parse \"%s\" command"), - weechat_prefix ("error"), "irc", - "privmsg"); - free (dcc_args); - return WEECHAT_RC_ERROR; - } - pos_addr[0] = '\0'; - pos_addr++; - while (pos_addr[0] == ' ') - { - pos_addr++; - } - - /* look for DCC port */ - pos_port = strchr (pos_addr, ' '); - if (!pos_port) - { - weechat_printf (server->buffer, - _("%s%s: cannot parse \"%s\" command"), - weechat_prefix ("error"), "irc", - "privmsg"); - free (dcc_args); - return WEECHAT_RC_ERROR; - } - pos_port[0] = '\0'; - pos_port++; - while (pos_port[0] == ' ') - { - pos_port++; - } - - if (weechat_strcasecmp (pos_file, "chat") != 0) - { - weechat_printf (server->buffer, - _("%s%s: unknown DCC CHAT type " - "received from %s%s%s: \"%s\""), - weechat_prefix ("error"), "irc", - IRC_COLOR_CHAT_NICK, - nick, - IRC_COLOR_CHAT, - pos_file); - free (dcc_args); - return WEECHAT_RC_ERROR; - } - - /* add DCC chat via xfer plugin */ - infolist = weechat_infolist_new (); - if (infolist) - { - item = weechat_infolist_new_item (infolist); - if (item) + /* check if DCC CHAT is ok, i.e. with 0x01 at end */ + pos_end_01 = strchr (pos_args + 1, '\01'); + if (!pos_end_01) { - weechat_infolist_new_var_string (item, "plugin_name", weechat_plugin->name); - snprintf (plugin_id, sizeof (plugin_id), - "%x", (unsigned int)server); - weechat_infolist_new_var_string (item, "plugin_id", plugin_id); - weechat_infolist_new_var_string (item, "type", "chat_recv"); - weechat_infolist_new_var_string (item, "remote_nick", nick); - weechat_infolist_new_var_string (item, "local_nick", server->nick); - weechat_infolist_new_var_string (item, "address", pos_addr); - weechat_infolist_new_var_integer (item, "port", atoi (pos_port)); - weechat_hook_signal_send ("xfer_add", - WEECHAT_HOOK_SIGNAL_POINTER, - infolist); + weechat_printf (server->buffer, + _("%s%s: cannot parse \"%s\" command"), + weechat_prefix ("error"), "irc", + "privmsg"); + return WEECHAT_RC_ERROR; } - weechat_infolist_free (infolist); - } - - weechat_hook_signal_send ("irc_dcc", - WEECHAT_HOOK_SIGNAL_STRING, - argv_eol[0]); - free (dcc_args); + dcc_args = weechat_strndup (pos_args + 9, + pos_end_01 - pos_args - 9); + + if (!dcc_args) + { + weechat_printf (server->buffer, + _("%s%s: not enough memory for \"%s\" " + "command"), + weechat_prefix ("error"), "irc", + "privmsg"); + return WEECHAT_RC_ERROR; + } + + /* CHAT type */ + pos_file = dcc_args; + while (pos_file[0] == ' ') + { + pos_file++; + } + + /* DCC IP address */ + pos_addr = strchr (pos_file, ' '); + if (!pos_addr) + { + weechat_printf (server->buffer, + _("%s%s: cannot parse \"%s\" command"), + weechat_prefix ("error"), "irc", + "privmsg"); + free (dcc_args); + return WEECHAT_RC_ERROR; + } + pos_addr[0] = '\0'; + pos_addr++; + while (pos_addr[0] == ' ') + { + pos_addr++; + } + + /* look for DCC port */ + pos_port = strchr (pos_addr, ' '); + if (!pos_port) + { + weechat_printf (server->buffer, + _("%s%s: cannot parse \"%s\" command"), + weechat_prefix ("error"), "irc", + "privmsg"); + free (dcc_args); + return WEECHAT_RC_ERROR; + } + pos_port[0] = '\0'; + pos_port++; + while (pos_port[0] == ' ') + { + pos_port++; + } + + if (weechat_strcasecmp (pos_file, "chat") != 0) + { + weechat_printf (server->buffer, + _("%s%s: unknown DCC CHAT type " + "received from %s%s%s: \"%s\""), + weechat_prefix ("error"), "irc", + IRC_COLOR_CHAT_NICK, + nick, + IRC_COLOR_CHAT, + pos_file); + free (dcc_args); + return WEECHAT_RC_ERROR; + } + + /* add DCC chat via xfer plugin */ + infolist = weechat_infolist_new (); + if (infolist) + { + item = weechat_infolist_new_item (infolist); + if (item) + { + weechat_infolist_new_var_string (item, "plugin_name", weechat_plugin->name); + snprintf (plugin_id, sizeof (plugin_id), + "%x", (unsigned int)server); + weechat_infolist_new_var_string (item, "plugin_id", plugin_id); + weechat_infolist_new_var_string (item, "type", "chat_recv"); + weechat_infolist_new_var_string (item, "remote_nick", nick); + weechat_infolist_new_var_string (item, "local_nick", server->nick); + weechat_infolist_new_var_string (item, "address", pos_addr); + weechat_infolist_new_var_integer (item, "port", atoi (pos_port)); + weechat_hook_signal_send ("xfer_add", + WEECHAT_HOOK_SIGNAL_POINTER, + infolist); + } + weechat_infolist_free (infolist); + } + + weechat_hook_signal_send ("irc_dcc", + WEECHAT_HOOK_SIGNAL_STRING, + argv_eol[0]); + + free (dcc_args); + } return WEECHAT_RC_OK; } @@ -1750,110 +1809,8 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command, if (strncmp (pos_args, "\01ACTION ", 8) == 0) { - if (!ptr_channel) + if (!irc_ignore_check (server, ptr_channel, nick, host)) { - ptr_channel = irc_channel_new (server, - IRC_CHANNEL_TYPE_PRIVATE, - nick, 0); - if (!ptr_channel) - { - weechat_printf (server->buffer, - _("%s%s: cannot create new " - "private buffer \"%s\""), - weechat_prefix ("error"), "irc", - nick); - return WEECHAT_RC_ERROR; - } - } - if (!ptr_channel->topic) - irc_channel_set_topic (ptr_channel, host); - - pos_args += 8; - pos_end_01 = strchr (pos, '\01'); - if (pos_end_01) - pos_end_01[0] = '\0'; - - weechat_printf_tags (ptr_channel->buffer, - "irc_privmsg,irc_action,notify_private", - "%s%s%s %s%s", - weechat_prefix ("action"), - IRC_COLOR_CHAT_NICK, - nick, - IRC_COLOR_CHAT, - pos_args); - weechat_hook_signal_send ("irc_pv", - WEECHAT_HOOK_SIGNAL_STRING, - argv_eol[0]); - - if (pos_end_01) - pos_end_01[0] = '\01'; - } - else - { - /* unknown CTCP ? */ - pos_end_01 = strchr (pos_args + 1, '\01'); - if ((pos_args[0] == '\01') - && pos_end_01 && (pos_end_01[1] == '\0')) - { - pos_args++; - pos_end_01[0] = '\0'; - pos = strchr (pos_args, ' '); - if (pos) - { - pos[0] = '\0'; - pos_message = pos + 1; - while (pos_message[0] == ' ') - { - pos_message++; - } - if (!pos_message[0]) - pos_message = NULL; - } - else - pos_message = NULL; - - if (pos_message) - { - weechat_printf_tags (server->buffer, - "irc_privmsg,irc_ctcp", - _("%sUnknown CTCP %s%s%s " - "received from %s%s%s: %s"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_CHANNEL, - pos_args, - IRC_COLOR_CHAT, - IRC_COLOR_CHAT_NICK, - nick, - IRC_COLOR_CHAT, - pos_message); - } - else - { - weechat_printf_tags (server->buffer, - "irc_privmsg,irc_ctcp", - _("%sUnknown CTCP %s%s%s " - "received from %s%s"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_CHANNEL, - pos_args, - IRC_COLOR_CHAT, - IRC_COLOR_CHAT_NICK, - nick); - } - if (pos_end_01) - pos_end_01[0] = '\01'; - if (pos) - pos[0] = ' '; - - weechat_hook_signal_send ("irc_ctcp", - WEECHAT_HOOK_SIGNAL_STRING, - argv_eol[0]); - - return WEECHAT_RC_OK; - } - else - { - /* private message */ if (!ptr_channel) { ptr_channel = irc_channel_new (server, @@ -1864,24 +1821,133 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command, weechat_printf (server->buffer, _("%s%s: cannot create new " "private buffer \"%s\""), - weechat_prefix ("error"), - "irc", nick); + weechat_prefix ("error"), "irc", + nick); return WEECHAT_RC_ERROR; } } - irc_channel_set_topic (ptr_channel, host); + if (!ptr_channel->topic) + irc_channel_set_topic (ptr_channel, address); + + pos_args += 8; + pos_end_01 = strchr (pos, '\01'); + if (pos_end_01) + pos_end_01[0] = '\0'; weechat_printf_tags (ptr_channel->buffer, - "irc_privmsg,notify_private", - "%s%s", - irc_nick_as_prefix (NULL, - nick, - IRC_COLOR_CHAT_NICK_OTHER), + "irc_privmsg,irc_action,notify_private", + "%s%s%s %s%s", + weechat_prefix ("action"), + IRC_COLOR_CHAT_NICK, + nick, + IRC_COLOR_CHAT, pos_args); - weechat_hook_signal_send ("irc_pv", WEECHAT_HOOK_SIGNAL_STRING, argv_eol[0]); + + if (pos_end_01) + pos_end_01[0] = '\01'; + } + } + else + { + /* unknown CTCP ? */ + pos_end_01 = strchr (pos_args + 1, '\01'); + if ((pos_args[0] == '\01') + && pos_end_01 && (pos_end_01[1] == '\0')) + { + if (!irc_ignore_check (server, ptr_channel, nick, host)) + { + pos_args++; + pos_end_01[0] = '\0'; + pos = strchr (pos_args, ' '); + if (pos) + { + pos[0] = '\0'; + pos_message = pos + 1; + while (pos_message[0] == ' ') + { + pos_message++; + } + if (!pos_message[0]) + pos_message = NULL; + } + else + pos_message = NULL; + + if (pos_message) + { + weechat_printf_tags (server->buffer, + "irc_privmsg,irc_ctcp", + _("%sUnknown CTCP %s%s%s " + "received from %s%s%s: %s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_CHANNEL, + pos_args, + IRC_COLOR_CHAT, + IRC_COLOR_CHAT_NICK, + nick, + IRC_COLOR_CHAT, + pos_message); + } + else + { + weechat_printf_tags (server->buffer, + "irc_privmsg,irc_ctcp", + _("%sUnknown CTCP %s%s%s " + "received from %s%s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_CHANNEL, + pos_args, + IRC_COLOR_CHAT, + IRC_COLOR_CHAT_NICK, + nick); + } + if (pos_end_01) + pos_end_01[0] = '\01'; + if (pos) + pos[0] = ' '; + + weechat_hook_signal_send ("irc_ctcp", + WEECHAT_HOOK_SIGNAL_STRING, + argv_eol[0]); + } + } + else + { + /* private message */ + if (!irc_ignore_check (server, ptr_channel, nick, host)) + { + if (!ptr_channel) + { + ptr_channel = irc_channel_new (server, + IRC_CHANNEL_TYPE_PRIVATE, + nick, 0); + if (!ptr_channel) + { + weechat_printf (server->buffer, + _("%s%s: cannot create new " + "private buffer \"%s\""), + weechat_prefix ("error"), + "irc", nick); + return WEECHAT_RC_ERROR; + } + } + irc_channel_set_topic (ptr_channel, address); + + weechat_printf_tags (ptr_channel->buffer, + "irc_privmsg,notify_private", + "%s%s", + irc_nick_as_prefix (NULL, + nick, + IRC_COLOR_CHAT_NICK_OTHER), + pos_args); + + weechat_hook_signal_send ("irc_pv", + WEECHAT_HOOK_SIGNAL_STRING, + argv_eol[0]); + } } } } @@ -1897,7 +1963,7 @@ int irc_protocol_cmd_quit (struct t_irc_server *server, const char *command, int argc, char **argv, char **argv_eol) { - char *nick, *host, *pos_comment; + char *pos_comment; struct t_irc_channel *ptr_channel; struct t_irc_nick *ptr_nick; @@ -1905,12 +1971,10 @@ irc_protocol_cmd_quit (struct t_irc_server *server, const char *command, :nick!user@host QUIT :quit message */ + IRC_PROTOCOL_GET_HOST; IRC_PROTOCOL_MIN_ARGS(2); IRC_PROTOCOL_CHECK_HOST; - nick = irc_protocol_get_nick_from_host (argv[0]); - host = irc_protocol_get_address_from_host (argv[0]); - pos_comment = (argc > 2) ? ((argv_eol[2][0] == ':') ? argv_eol[2] + 1 : argv_eol[2]) : NULL; @@ -1926,38 +1990,43 @@ irc_protocol_cmd_quit (struct t_irc_server *server, const char *command, { if (ptr_nick) irc_nick_free (ptr_channel, ptr_nick); - if (pos_comment && pos_comment[0]) + + /* display quit message */ + if (!irc_ignore_check (server, ptr_channel, nick, host)) { - weechat_printf_tags (ptr_channel->buffer, - "irc_quit", - _("%s%s%s %s(%s%s%s)%s has quit " - "%s(%s%s%s)"), - weechat_prefix ("quit"), - IRC_COLOR_CHAT_NICK, - nick, - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT_HOST, - host, - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT, - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT, - pos_comment, - IRC_COLOR_CHAT_DELIMITERS); - } - else - { - weechat_printf_tags (ptr_channel->buffer, - "irc_quit", - _("%s%s%s %s(%s%s%s)%s has quit"), - weechat_prefix ("quit"), - IRC_COLOR_CHAT_NICK, - nick, - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT_HOST, - host, - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT); + if (pos_comment && pos_comment[0]) + { + weechat_printf_tags (ptr_channel->buffer, + "irc_quit", + _("%s%s%s %s(%s%s%s)%s has quit " + "%s(%s%s%s)"), + weechat_prefix ("quit"), + IRC_COLOR_CHAT_NICK, + nick, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT_HOST, + address, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT, + pos_comment, + IRC_COLOR_CHAT_DELIMITERS); + } + else + { + weechat_printf_tags (ptr_channel->buffer, + "irc_quit", + _("%s%s%s %s(%s%s%s)%s has quit"), + weechat_prefix ("quit"), + IRC_COLOR_CHAT_NICK, + nick, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT_HOST, + address, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT); + } } } } @@ -2050,6 +2119,7 @@ irc_protocol_cmd_topic (struct t_irc_server *server, const char *command, :nick!user@host TOPIC #channel :new topic for channel */ + IRC_PROTOCOL_GET_HOST; IRC_PROTOCOL_MIN_ARGS(3); if (!irc_channel_is_channel (argv[2])) @@ -2065,38 +2135,41 @@ irc_protocol_cmd_topic (struct t_irc_server *server, const char *command, ptr_channel = irc_channel_search (server, argv[2]); buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer; - - if (pos_topic && pos_topic[0]) + + if (!irc_ignore_check (server, ptr_channel, nick, host)) { - topic_color = irc_color_decode (pos_topic, - weechat_config_boolean (irc_config_network_colors_receive)); - weechat_printf_tags (buffer, - "irc_topic", - _("%s%s%s%s has changed topic for %s%s%s to: " - "\"%s%s\""), - weechat_prefix ("network"), - IRC_COLOR_CHAT_NICK, - irc_protocol_get_nick_from_host (argv[0]), - IRC_COLOR_CHAT, - IRC_COLOR_CHAT_CHANNEL, - argv[2], - IRC_COLOR_CHAT, - (topic_color) ? topic_color : pos_topic, - IRC_COLOR_CHAT); - if (topic_color) - free (topic_color); - } - else - { - weechat_printf_tags (buffer, - "irc_topic", - _("%s%s%s%s has unset topic for %s%s"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_NICK, - irc_protocol_get_nick_from_host (argv[0]), - IRC_COLOR_CHAT, - IRC_COLOR_CHAT_CHANNEL, - argv[2]); + if (pos_topic && pos_topic[0]) + { + topic_color = irc_color_decode (pos_topic, + weechat_config_boolean (irc_config_network_colors_receive)); + weechat_printf_tags (buffer, + "irc_topic", + _("%s%s%s%s has changed topic for %s%s%s to: " + "\"%s%s\""), + weechat_prefix ("network"), + IRC_COLOR_CHAT_NICK, + nick, + IRC_COLOR_CHAT, + IRC_COLOR_CHAT_CHANNEL, + argv[2], + IRC_COLOR_CHAT, + (topic_color) ? topic_color : pos_topic, + IRC_COLOR_CHAT); + if (topic_color) + free (topic_color); + } + else + { + weechat_printf_tags (buffer, + "irc_topic", + _("%s%s%s%s has unset topic for %s%s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_NICK, + nick, + IRC_COLOR_CHAT, + IRC_COLOR_CHAT_CHANNEL, + argv[2]); + } } if (ptr_channel) @@ -2117,20 +2190,24 @@ irc_protocol_cmd_wallops (struct t_irc_server *server, const char *command, :nick!user@host WALLOPS :message from admin */ + IRC_PROTOCOL_GET_HOST; IRC_PROTOCOL_MIN_ARGS(3); - weechat_printf_tags (server->buffer, - "irc_wallops", - _("%sWallops from %s%s %s(%s%s%s)%s: %s"), - weechat_prefix ("network"), - IRC_COLOR_CHAT_NICK, - irc_protocol_get_nick_from_host (argv[0]), - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT_HOST, - irc_protocol_get_address_from_host (argv[0]), - IRC_COLOR_CHAT_DELIMITERS, - IRC_COLOR_CHAT, - (argv_eol[2][0] == ':') ? argv_eol[2] + 1 : argv_eol[2]); + if (!irc_ignore_check (server, NULL, nick, host)) + { + weechat_printf_tags (server->buffer, + "irc_wallops", + _("%sWallops from %s%s %s(%s%s%s)%s: %s"), + weechat_prefix ("network"), + IRC_COLOR_CHAT_NICK, + nick, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT_HOST, + address, + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT, + (argv_eol[2][0] == ':') ? argv_eol[2] + 1 : argv_eol[2]); + } return WEECHAT_RC_OK; } diff --git a/src/plugins/irc/irc-protocol.h b/src/plugins/irc/irc-protocol.h index 49e68196e..c19773164 100644 --- a/src/plugins/irc/irc-protocol.h +++ b/src/plugins/irc/irc-protocol.h @@ -20,6 +20,20 @@ #ifndef __WEECHAT_IRC_PROTOCOL_H #define __WEECHAT_IRC_PROTOCOL_H 1 +#define IRC_PROTOCOL_GET_HOST \ + char *nick, *address, *host; \ + if (argv[0][0] == ':') \ + { \ + nick = irc_protocol_get_nick_from_host (argv[0]); \ + address = irc_protocol_get_address_from_host (argv[0]); \ + host = argv[0] + 1; \ + } \ + else \ + { \ + nick = NULL; \ + address = NULL; \ + host = NULL; \ + } #define IRC_PROTOCOL_MIN_ARGS(__min_args) \ if (argc < __min_args) \ { \