diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2010-03-19 19:28:19 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2010-03-19 19:28:19 +0100 |
commit | bc3fa9fd4cddd24d066b60f11c08d3c8e5ff1e61 (patch) | |
tree | 7f70801298fb4301f4ff98933cda2bcaf4d18e62 | |
parent | 568d913c5895e356672320a4a6694570ed0b87c2 (diff) | |
download | weechat-bc3fa9fd4cddd24d066b60f11c08d3c8e5ff1e61.zip |
Move /away command from irc plugin to core
-rw-r--r-- | doc/en/autogen/user/irc_commands.txt | 9 | ||||
-rw-r--r-- | doc/en/autogen/user/weechat_commands.txt | 9 | ||||
-rw-r--r-- | doc/fr/autogen/user/irc_commands.txt | 9 | ||||
-rw-r--r-- | doc/fr/autogen/user/weechat_commands.txt | 9 | ||||
-rw-r--r-- | doc/it/autogen/user/irc_commands.txt | 9 | ||||
-rw-r--r-- | doc/it/autogen/user/weechat_commands.txt | 9 | ||||
-rw-r--r-- | po/cs.po | 30 | ||||
-rw-r--r-- | po/de.po | 30 | ||||
-rw-r--r-- | po/es.po | 32 | ||||
-rw-r--r-- | po/fr.po | 30 | ||||
-rw-r--r-- | po/hu.po | 30 | ||||
-rw-r--r-- | po/it.po | 30 | ||||
-rw-r--r-- | po/pl.po | 30 | ||||
-rw-r--r-- | po/ru.po | 28 | ||||
-rw-r--r-- | po/weechat.pot | 24 | ||||
-rw-r--r-- | src/core/wee-command.c | 14 | ||||
-rw-r--r-- | src/core/wee-command.h | 19 | ||||
-rw-r--r-- | src/plugins/irc/irc-buffer.c | 2 | ||||
-rw-r--r-- | src/plugins/irc/irc-buffer.h | 18 | ||||
-rw-r--r-- | src/plugins/irc/irc-command.c | 179 | ||||
-rw-r--r-- | src/plugins/irc/irc-completion.c | 18 | ||||
-rw-r--r-- | src/plugins/irc/irc-input.c | 6 | ||||
-rw-r--r-- | src/plugins/irc/irc.h | 18 |
23 files changed, 323 insertions, 269 deletions
diff --git a/doc/en/autogen/user/irc_commands.txt b/doc/en/autogen/user/irc_commands.txt index f9ec99157..bd86471fb 100644 --- a/doc/en/autogen/user/irc_commands.txt +++ b/doc/en/autogen/user/irc_commands.txt @@ -41,15 +41,6 @@ /allserv away I'm away ........................................ -• *`/away`* `[-all] [message]`:: - -........................................ - toggle away status - - -all: toggle away status on all connected servers - message: message for away (if no message is given, away status is removed) -........................................ - • *`/ban`* `[channel] [nickname [nickname ...]]`:: ........................................ diff --git a/doc/en/autogen/user/weechat_commands.txt b/doc/en/autogen/user/weechat_commands.txt index 5916e5a37..edb762dac 100644 --- a/doc/en/autogen/user/weechat_commands.txt +++ b/doc/en/autogen/user/weechat_commands.txt @@ -1,3 +1,12 @@ +• *`/away`* `[-all] [message]`:: + +........................................ + toggle away status + + -all: toggle away status on all connected servers + message: message for away (if no message is given, away status is removed) +........................................ + • *`/bar`* `[add barname type[,cond1,cond2,...] position size separator item1,item2,...] | [default] | [del barname|-all] | [set barname option value] | [hide|show|toggle barname] | [scroll barname buffer scroll_value] | [list] | [listfull] | [listitems]`:: ........................................ diff --git a/doc/fr/autogen/user/irc_commands.txt b/doc/fr/autogen/user/irc_commands.txt index b565e3975..df6e5b67c 100644 --- a/doc/fr/autogen/user/irc_commands.txt +++ b/doc/fr/autogen/user/irc_commands.txt @@ -41,15 +41,6 @@ /allserv away Je suis absent ........................................ -• *`/away`* `[-all] [message]`:: - -........................................ - basculer le statut absent - - -all: basculer le statut absent sur tous les serveurs connectés - message: message pour l'absence (si pas de message donné, le statut d'absence est supprimé) -........................................ - • *`/ban`* `[canal] [pseudo [pseudo ...]]`:: ........................................ diff --git a/doc/fr/autogen/user/weechat_commands.txt b/doc/fr/autogen/user/weechat_commands.txt index f2f57b39d..e4f03bd90 100644 --- a/doc/fr/autogen/user/weechat_commands.txt +++ b/doc/fr/autogen/user/weechat_commands.txt @@ -1,3 +1,12 @@ +• *`/away`* `[-all] [message]`:: + +........................................ + basculer le statut absent + + -all: basculer le statut absent sur tous les serveurs connectés + message: message pour l'absence (si pas de message donné, le statut d'absence est supprimé) +........................................ + • *`/bar`* `[add nombarre type[,cond1,cond2,...] position taille separateur objet1,objet2,...] | [default] | [del nombarre|-all] | [set nombarre option valeur] | [hide|show|toggle nombarre] | [scroll nombarre tampon valeur_scroll] | [list] | [listfull] | [listitems]`:: ........................................ diff --git a/doc/it/autogen/user/irc_commands.txt b/doc/it/autogen/user/irc_commands.txt index 2f6b8f53f..81b550c7f 100644 --- a/doc/it/autogen/user/irc_commands.txt +++ b/doc/it/autogen/user/irc_commands.txt @@ -41,15 +41,6 @@ /allserv away sono assente ........................................ -• *`/away`* `[-all] [messaggio]`:: - -........................................ - attiva/disattiva lo stato di assenza - - -all: attiva/disattiva lo stato di assenza su tutti i server connessi - messaggio: messaggio di assenza (se non specificato, lo stato di assenza viene rimosso) -........................................ - • *`/ban`* `[canale] [nick [nick ...]]`:: ........................................ diff --git a/doc/it/autogen/user/weechat_commands.txt b/doc/it/autogen/user/weechat_commands.txt index ce238f246..1fe7d9707 100644 --- a/doc/it/autogen/user/weechat_commands.txt +++ b/doc/it/autogen/user/weechat_commands.txt @@ -1,3 +1,12 @@ +• *`/away`* `[-all] [messaggio]`:: + +........................................ + attiva/disattiva lo stato di assenza + + -all: attiva/disattiva lo stato di assenza su tutti i server connessi + messaggio: messaggio di assenza (se non specificato, lo stato di assenza viene rimosso) +........................................ + • *`/bar`* `[add nome_barra tipo[,cond1,cond2,...] posizione dimensione separatore elemento1,elemento2,...] | [default] | [del nome_barra|-all] | [set nome_barra opzione valore] | [hide|show|toggle nome_barra] | [scroll nome_barra buffer scroll_value] | [list] | [listfull] | [listitems]`:: ........................................ @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-03-14 16:43+0100\n" +"POT-Creation-Date: 2010-03-19 13:59+0100\n" "PO-Revision-Date: 2010-03-05 10:43+0100\n" "Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -714,6 +714,20 @@ msgstr "" "%sChyba: nemohu spojit okna, není zde další okno se stejnou velikostí poblíž " "aktuálního okna" +msgid "toggle away status" +msgstr "přepnout status nepřítomnosti" + +msgid "[-all] [message]" +msgstr "[-all] [zpráva]" + +msgid "" +" -all: toggle away status on all connected servers\n" +"message: message for away (if no message is given, away status is removed)" +msgstr "" +" -all: přepnout status nečinnosti na všech připojených serverech\n" +"zpráva: zpráva pro nepřítomnost (pokud není zadána je status nepřítomnosti " +"odebrán)" + msgid "manage bars" msgstr "řídit pole" @@ -3098,20 +3112,6 @@ msgstr "" " nastavit pryč na věech serverech:\n" " /allserv away I'm away" -msgid "toggle away status" -msgstr "přepnout status nepřítomnosti" - -msgid "[-all] [message]" -msgstr "[-all] [zpráva]" - -msgid "" -" -all: toggle away status on all connected servers\n" -"message: message for away (if no message is given, away status is removed)" -msgstr "" -" -all: přepnout status nečinnosti na všech připojených serverech\n" -"zpráva: zpráva pro nepřítomnost (pokud není zadána je status nepřítomnosti " -"odebrán)" - msgid "ban nicks or hosts" msgstr "zakázat přezdívky nebo hosty" @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-03-14 16:43+0100\n" +"POT-Creation-Date: 2010-03-19 13:59+0100\n" "PO-Revision-Date: 2010-03-04 10:19+0100\n" "Last-Translator: Nils G <weechatter@arcor.de>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -728,6 +728,20 @@ msgstr "" "%sFehler: kann Fenster nicht vereinigen, es ist kein Fenster mit der " "gleichen Größe in der Nähe des aktuellen Fensters." +msgid "toggle away status" +msgstr "Abwesenheitszustand ein-/ausschalten" + +msgid "[-all] [message]" +msgstr "[-all] [Nachricht]" + +msgid "" +" -all: toggle away status on all connected servers\n" +"message: message for away (if no message is given, away status is removed)" +msgstr "" +" -all: Abwesenheitszustand auf allen Servern ändern\n" +"Nachricht: Abwesenheitsnachricht (ohne eine Nachricht wird der " +"Abwesenheitszustand deaktivieren)" + msgid "manage bars" msgstr "Infobars verwalten" @@ -3226,20 +3240,6 @@ msgstr "" " Setzt den Status, auf allen Servern,auf abwesend:\n" " /allserv away I'm away" -msgid "toggle away status" -msgstr "Abwesenheitszustand ein-/ausschalten" - -msgid "[-all] [message]" -msgstr "[-all] [Nachricht]" - -msgid "" -" -all: toggle away status on all connected servers\n" -"message: message for away (if no message is given, away status is removed)" -msgstr "" -" -all: Abwesenheitszustand auf allen Servern ändern\n" -"Nachricht: Abwesenheitsnachricht (ohne eine Nachricht wird der " -"Abwesenheitszustand deaktivieren)" - msgid "ban nicks or hosts" msgstr "Nicknamen oder Hosts sperren/verbannen" @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-03-14 16:43+0100\n" +"POT-Creation-Date: 2010-03-19 13:59+0100\n" "PO-Revision-Date: 2010-02-23 10:43+0100\n" "Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -712,6 +712,21 @@ msgstr "" "%sError: no puede unir las ventanas, no hay ninguna otra ventana con el " "mismo tamaño de la actual." +msgid "toggle away status" +msgstr "activa/desactiva el estado ausente" + +msgid "[-all] [message]" +msgstr "[-all] [mensaje]" + +msgid "" +" -all: toggle away status on all connected servers\n" +"message: message for away (if no message is given, away status is removed)" +msgstr "" +" -all: activa/desactiva el estado ausente en todos los servidores " +"conectados\n" +"mensaje: mensaje de ausencia (si no se da ningún mensaje, se remueve el " +"estado ausente)" + msgid "manage bars" msgstr "gestionar las barras" @@ -3126,21 +3141,6 @@ msgstr "" " poner ausente en todos los servidores:\n" " /allserv away Estoy ausente" -msgid "toggle away status" -msgstr "activa/desactiva el estado ausente" - -msgid "[-all] [message]" -msgstr "[-all] [mensaje]" - -msgid "" -" -all: toggle away status on all connected servers\n" -"message: message for away (if no message is given, away status is removed)" -msgstr "" -" -all: activa/desactiva el estado ausente en todos los servidores " -"conectados\n" -"mensaje: mensaje de ausencia (si no se da ningún mensaje, se remueve el " -"estado ausente)" - msgid "ban nicks or hosts" msgstr "veta apodos o hosts" @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-03-14 16:43+0100\n" +"POT-Creation-Date: 2010-03-19 13:59+0100\n" "PO-Revision-Date: 2010-03-14 16:44+0100\n" "Last-Translator: FlashCode <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -712,6 +712,20 @@ msgstr "" "%sErreur: impossible de fusionner les fenêtres, aucun autre fenêtre avec la " "même taille à coté de la fenêtre actuelle" +msgid "toggle away status" +msgstr "basculer le statut absent" + +msgid "[-all] [message]" +msgstr "[-all] [message]" + +msgid "" +" -all: toggle away status on all connected servers\n" +"message: message for away (if no message is given, away status is removed)" +msgstr "" +" -all: basculer le statut absent sur tous les serveurs connectés\n" +"message: message pour l'absence (si pas de message donné, le statut " +"d'absence est supprimé)" + msgid "manage bars" msgstr "gestion des barres" @@ -3177,20 +3191,6 @@ msgstr "" " positionner l'absence sur tous les serveurs :\n" " /allserv away Je suis absent" -msgid "toggle away status" -msgstr "basculer le statut absent" - -msgid "[-all] [message]" -msgstr "[-all] [message]" - -msgid "" -" -all: toggle away status on all connected servers\n" -"message: message for away (if no message is given, away status is removed)" -msgstr "" -" -all: basculer le statut absent sur tous les serveurs connectés\n" -"message: message pour l'absence (si pas de message donné, le statut " -"d'absence est supprimé)" - msgid "ban nicks or hosts" msgstr "bannit des pseudos ou hôtes" @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-03-14 16:43+0100\n" +"POT-Creation-Date: 2010-03-19 13:59+0100\n" "PO-Revision-Date: 2010-02-23 10:43+0100\n" "Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -767,6 +767,20 @@ msgstr "" "%s nem sikerült az ablakokat összefésülni: nincs a közelben azonos méretű " "ablak.\n" +msgid "toggle away status" +msgstr "távolléti státusz váltása" + +msgid "[-all] [message]" +msgstr "[-all] [üzenet]" + +msgid "" +" -all: toggle away status on all connected servers\n" +"message: message for away (if no message is given, away status is removed)" +msgstr "" +" -all: távolléti státusz váltása minden csatlakoztatott szerveren\n" +" üzenet: távolléti üzenet (ha nincs üzenet megadva, a távolléti státusz " +"eltávolítása)" + #, fuzzy msgid "manage bars" msgstr "pufferek kezelése" @@ -2974,20 +2988,6 @@ msgid "" " /allserv away I'm away" msgstr "" -msgid "toggle away status" -msgstr "távolléti státusz váltása" - -msgid "[-all] [message]" -msgstr "[-all] [üzenet]" - -msgid "" -" -all: toggle away status on all connected servers\n" -"message: message for away (if no message is given, away status is removed)" -msgstr "" -" -all: távolléti státusz váltása minden csatlakoztatott szerveren\n" -" üzenet: távolléti üzenet (ha nincs üzenet megadva, a távolléti státusz " -"eltávolítása)" - #, fuzzy msgid "ban nicks or hosts" msgstr "név vagy gép letiltása" @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Weechat 0.3.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-03-14 16:43+0100\n" +"POT-Creation-Date: 2010-03-19 13:59+0100\n" "PO-Revision-Date: 2010-02-23 10:43+0100\n" "Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -711,6 +711,20 @@ msgstr "" "%sErrore: impossibile unire le finestre, non c'è un'altra finestra della " "stessa dimensione vicino quella corrente" +msgid "toggle away status" +msgstr "attiva/disattiva lo stato di assenza" + +msgid "[-all] [message]" +msgstr "[-all] [messaggio]" + +msgid "" +" -all: toggle away status on all connected servers\n" +"message: message for away (if no message is given, away status is removed)" +msgstr "" +" -all: attiva/disattiva lo stato di assenza su tutti i server connessi\n" +"messaggio: messaggio di assenza (se non specificato, lo stato di assenza " +"viene rimosso)" + msgid "manage bars" msgstr "gestione barre" @@ -3129,20 +3143,6 @@ msgstr "" " imposta l'assenza su tutti i server:\n" " /allserv away sono assente" -msgid "toggle away status" -msgstr "attiva/disattiva lo stato di assenza" - -msgid "[-all] [message]" -msgstr "[-all] [messaggio]" - -msgid "" -" -all: toggle away status on all connected servers\n" -"message: message for away (if no message is given, away status is removed)" -msgstr "" -" -all: attiva/disattiva lo stato di assenza su tutti i server connessi\n" -"messaggio: messaggio di assenza (se non specificato, lo stato di assenza " -"viene rimosso)" - msgid "ban nicks or hosts" msgstr "banna nick oppure host" @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-03-14 16:43+0100\n" +"POT-Creation-Date: 2010-03-19 13:59+0100\n" "PO-Revision-Date: 2010-02-23 10:43+0100\n" "Last-Translator: Krzysztof Koroscik <soltys@szluug.org>\n" "Language-Team: Polish\n" @@ -726,6 +726,20 @@ msgstr "" "%sBłąd: nie można scalić okien, nie ma innego okna o takim samym rozmiarze w " "pobliżu obecnego" +msgid "toggle away status" +msgstr "zmienia status nieobecności" + +msgid "[-all] [message]" +msgstr "[-all] [wiadomość]" + +msgid "" +" -all: toggle away status on all connected servers\n" +"message: message for away (if no message is given, away status is removed)" +msgstr "" +" -all: zmienia stan nieobecnośći na wszystkich połączonych serwerach\n" +"wiadomość: powód nieobecnośći (jeśli nie podano wiadomości status " +"nieobecności zostaje usunięty)" + msgid "manage bars" msgstr "zarządzaj paskami" @@ -3132,20 +3146,6 @@ msgstr "" " ustawia stan nieobecności na wszystkich serwerach:\n" " /allserv away Jestem nieobecny" -msgid "toggle away status" -msgstr "zmienia status nieobecności" - -msgid "[-all] [message]" -msgstr "[-all] [wiadomość]" - -msgid "" -" -all: toggle away status on all connected servers\n" -"message: message for away (if no message is given, away status is removed)" -msgstr "" -" -all: zmienia stan nieobecnośći na wszystkich połączonych serwerach\n" -"wiadomość: powód nieobecnośći (jeśli nie podano wiadomości status " -"nieobecności zostaje usunięty)" - msgid "ban nicks or hosts" msgstr "banuje nick albo host" @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-03-14 16:43+0100\n" +"POT-Creation-Date: 2010-03-19 13:59+0100\n" "PO-Revision-Date: 2010-02-23 10:43+0100\n" "Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -769,6 +769,19 @@ msgstr "" "%s не могу объединить окна, есть другое окно такого-же размера рядом с " "текущим.\n" +msgid "toggle away status" +msgstr "переключает статус \"отошёл\"" + +msgid "[-all] [message]" +msgstr "[-all] [сообщение]" + +msgid "" +" -all: toggle away status on all connected servers\n" +"message: message for away (if no message is given, away status is removed)" +msgstr "" +" -all: включить режим \"отсутствую\" на всех подключенных серверах\n" +"сообщение: причина отсутствия (если сообщения нет - статус снимается)" + #, fuzzy msgid "manage bars" msgstr "управление буферами" @@ -2987,19 +3000,6 @@ msgid "" " /allserv away I'm away" msgstr "" -msgid "toggle away status" -msgstr "переключает статус \"отошёл\"" - -msgid "[-all] [message]" -msgstr "[-all] [сообщение]" - -msgid "" -" -all: toggle away status on all connected servers\n" -"message: message for away (if no message is given, away status is removed)" -msgstr "" -" -all: включить режим \"отсутствую\" на всех подключенных серверах\n" -"сообщение: причина отсутствия (если сообщения нет - статус снимается)" - #, fuzzy msgid "ban nicks or hosts" msgstr "банит ник или хост" diff --git a/po/weechat.pot b/po/weechat.pot index 01ef2f22c..a191ed5d4 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: 2010-03-14 16:43+0100\n" +"POT-Creation-Date: 2010-03-19 13:59+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -678,6 +678,17 @@ msgid "" "current one" msgstr "" +msgid "toggle away status" +msgstr "" + +msgid "[-all] [message]" +msgstr "" + +msgid "" +" -all: toggle away status on all connected servers\n" +"message: message for away (if no message is given, away status is removed)" +msgstr "" + msgid "manage bars" msgstr "" @@ -2604,17 +2615,6 @@ msgid "" " /allserv away I'm away" msgstr "" -msgid "toggle away status" -msgstr "" - -msgid "[-all] [message]" -msgstr "" - -msgid "" -" -all: toggle away status on all connected servers\n" -"message: message for away (if no message is given, away status is removed)" -msgstr "" - msgid "ban nicks or hosts" msgstr "" diff --git a/src/core/wee-command.c b/src/core/wee-command.c index a4b28b31d..974a2e4b4 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -63,6 +63,12 @@ /* + * command_away: toggle away status + */ + +COMMAND_EMPTY(away) + +/* * command_bar_list: list bars */ @@ -4066,6 +4072,14 @@ command_window (void *data, struct t_gui_buffer *buffer, void command_init () { + hook_command (NULL, "away", + N_("toggle away status"), + N_("[-all] [message]"), + N_(" -all: toggle away status on all connected " + "servers\n" + "message: message for away (if no message is " + "given, away status is removed)"), + "-all", &command_away, NULL); hook_command (NULL, "bar", N_("manage bars"), N_("[add barname type[,cond1,cond2,...] position size " diff --git a/src/core/wee-command.h b/src/core/wee-command.h index b689add38..0b72f5ee7 100644 --- a/src/core/wee-command.h +++ b/src/core/wee-command.h @@ -20,6 +20,25 @@ #ifndef __WEECHAT_COMMAND_H #define __WEECHAT_COMMAND_H 1 +/* + * This macro is used to create an "empty" command in WeeChat core: + * command does nothing, but plugins or scripts can catch it when it + * is used by user, with weechat_hook_command_run("/xxx", ...) + * where "xxx" is command name. + */ +#define COMMAND_EMPTY(__command) \ + int \ + command_##__command (void *data, struct t_gui_buffer *buffer, \ + int argc, char **argv, char **argv_eol) \ + { \ + (void) data; \ + (void) buffer; \ + (void) argc; \ + (void) argv; \ + (void) argv_eol; \ + return WEECHAT_RC_OK; \ + } + struct t_gui_buffer; extern int command_reload (void *data, struct t_gui_buffer *buffer, diff --git a/src/plugins/irc/irc-buffer.c b/src/plugins/irc/irc-buffer.c index 04f77b186..8a8bd044e 100644 --- a/src/plugins/irc/irc-buffer.c +++ b/src/plugins/irc/irc-buffer.c @@ -116,7 +116,7 @@ irc_buffer_close_cb (void *data, struct t_gui_buffer *buffer) { struct t_irc_channel *next_channel; - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); /* make C compiler happy */ (void) data; diff --git a/src/plugins/irc/irc-buffer.h b/src/plugins/irc/irc-buffer.h index ab1c4a2b5..0f4c5da88 100644 --- a/src/plugins/irc/irc-buffer.h +++ b/src/plugins/irc/irc-buffer.h @@ -20,6 +20,24 @@ #ifndef __WEECHAT_IRC_BUFFER_H #define __WEECHAT_IRC_BUFFER_H 1 +#define IRC_BUFFER_GET_SERVER(__buffer) \ + struct t_weechat_plugin *buffer_plugin = NULL; \ + struct t_irc_server *ptr_server = NULL; \ + buffer_plugin = weechat_buffer_get_pointer (__buffer, "plugin"); \ + if (buffer_plugin == weechat_irc_plugin) \ + irc_buffer_get_server_channel (__buffer, &ptr_server, NULL); + +#define IRC_BUFFER_GET_SERVER_CHANNEL(__buffer) \ + struct t_weechat_plugin *buffer_plugin = NULL; \ + struct t_irc_server *ptr_server = NULL; \ + struct t_irc_channel *ptr_channel = NULL; \ + buffer_plugin = weechat_buffer_get_pointer (__buffer, "plugin"); \ + if (buffer_plugin == weechat_irc_plugin) \ + { \ + irc_buffer_get_server_channel (__buffer, &ptr_server, \ + &ptr_channel); \ + } + #define IRC_BUFFER_RAW_NAME "irc_raw" #define IRC_BUFFER_RAW_PREFIX_RECV "-->" #define IRC_BUFFER_RAW_PREFIX_RECV_MOD "==>" diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c index 653f879d1..f1ff4225d 100644 --- a/src/plugins/irc/irc-command.c +++ b/src/plugins/irc/irc-command.c @@ -84,7 +84,7 @@ int irc_command_admin (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); IRC_COMMAND_CHECK_SERVER("admin", 1); /* make C compiler happy */ @@ -188,7 +188,7 @@ irc_command_allchan (void *data, struct t_gui_buffer *buffer, int argc, int i, current_server; const char *ptr_exclude_channels, *ptr_command; - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); /* make C compiler happy */ (void) data; @@ -513,7 +513,7 @@ int irc_command_away (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); /* make C compiler happy */ (void) data; @@ -535,13 +535,41 @@ irc_command_away (void *data, struct t_gui_buffer *buffer, int argc, } else { - IRC_COMMAND_CHECK_SERVER("away", 0); - - weechat_buffer_set (NULL, "hotlist", "-"); - irc_command_away_server (ptr_server, argv_eol[1], 1); - weechat_buffer_set (NULL, "hotlist", "+"); + if (ptr_server) + { + weechat_buffer_set (NULL, "hotlist", "-"); + irc_command_away_server (ptr_server, argv_eol[1], 1); + weechat_buffer_set (NULL, "hotlist", "+"); + } + } + + return WEECHAT_RC_OK; +} + +/* + * irc_command_run_away: catch command /away when it is run + */ + +int +irc_command_run_away (void *data, struct t_gui_buffer *buffer, + const char *command) +{ + int argc; + char **argv, **argv_eol; + + argv = weechat_string_split (command, " ", 0, 0, &argc); + argv_eol = weechat_string_split (command, " ", 1, 0, NULL); + + if (argv && argv_eol) + { + irc_command_away (data, buffer, argc, argv, argv_eol); } + if (argv) + weechat_string_free_split (argv); + if (argv_eol) + weechat_string_free_split (argv_eol); + return WEECHAT_RC_OK; } @@ -556,7 +584,7 @@ irc_command_ban (void *data, struct t_gui_buffer *buffer, int argc, char *pos_channel; int pos_args; - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); IRC_COMMAND_CHECK_SERVER("ban", 1); /* make C compiler happy */ @@ -669,7 +697,7 @@ irc_command_connect (void *data, struct t_gui_buffer *buffer, int argc, int i, nb_connect, connect_ok, all_servers, no_join; char *name; - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); /* make C compiler happy */ (void) data; @@ -774,7 +802,7 @@ irc_command_ctcp (void *data, struct t_gui_buffer *buffer, int argc, char *pos, *irc_cmd, str_time[512]; struct timeval tv; - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); IRC_COMMAND_CHECK_SERVER("ctcp", 1); /* make C compiler happy */ @@ -853,7 +881,7 @@ irc_command_cycle (void *data, struct t_gui_buffer *buffer, int argc, char **channels; int i, num_channels; - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); IRC_COMMAND_CHECK_SERVER("cycle", 1); /* make C compiler happy */ @@ -959,7 +987,7 @@ irc_command_dcc (void *data, struct t_gui_buffer *buffer, int argc, struct t_infolist_item *item; char plugin_id[128], str_address[128], charset_modifier[256]; - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); IRC_COMMAND_CHECK_SERVER("dcc", 1); /* make C compiler happy */ @@ -1065,7 +1093,7 @@ int irc_command_dehalfop (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); IRC_COMMAND_CHECK_SERVER("dehalfop", 1); /* make C compiler happy */ @@ -1106,7 +1134,7 @@ int irc_command_deop (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); IRC_COMMAND_CHECK_SERVER("deop", 1); /* make C compiler happy */ @@ -1147,7 +1175,7 @@ int irc_command_devoice (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); IRC_COMMAND_CHECK_SERVER("devoice", 1); /* make C compiler happy */ @@ -1188,7 +1216,7 @@ int irc_command_die (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); IRC_COMMAND_CHECK_SERVER("die", 1); /* make C compiler happy */ @@ -1280,7 +1308,7 @@ irc_command_disconnect (void *data, struct t_gui_buffer *buffer, int argc, { int i, disconnect_ok; - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); /* make C compiler happy */ (void) data; @@ -1342,7 +1370,7 @@ int irc_command_halfop (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); IRC_COMMAND_CHECK_SERVER("halfop", 1); /* make C compiler happy */ @@ -1571,7 +1599,7 @@ int irc_command_info (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); IRC_COMMAND_CHECK_SERVER("info", 1); /* make C compiler happy */ @@ -1600,7 +1628,7 @@ int irc_command_invite (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); IRC_COMMAND_CHECK_SERVER("invite", 1); /* make C compiler happy */ @@ -1643,7 +1671,7 @@ int irc_command_ison (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); IRC_COMMAND_CHECK_SERVER("ison", 1); /* make C compiler happy */ @@ -1690,7 +1718,7 @@ int irc_command_join (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); IRC_COMMAND_CHECK_SERVER("join", 1); /* make C compiler happy */ @@ -1725,7 +1753,7 @@ irc_command_kick (void *data, struct t_gui_buffer *buffer, int argc, { char *pos_channel, *pos_nick, *pos_comment; - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); IRC_COMMAND_CHECK_SERVER("kick", 1); /* make C compiler happy */ @@ -1799,7 +1827,7 @@ irc_command_kickban (void *data, struct t_gui_buffer *buffer, int argc, char *pos_channel, *pos_nick, *nick_only, *pos_comment, *pos, *mask; int length; - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); IRC_COMMAND_CHECK_SERVER("kickban", 1); /* make C compiler happy */ @@ -1909,7 +1937,7 @@ int irc_command_kill (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); IRC_COMMAND_CHECK_SERVER("kill", 1); /* make C compiler happy */ @@ -1937,7 +1965,7 @@ int irc_command_links (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); IRC_COMMAND_CHECK_SERVER("links", 1); /* make C compiler happy */ @@ -1966,7 +1994,7 @@ irc_command_list (void *data, struct t_gui_buffer *buffer, int argc, char buf[512]; int ret; - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); IRC_COMMAND_CHECK_SERVER("list", 1); /* make C compiler happy */ @@ -2027,7 +2055,7 @@ int irc_command_lusers (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); IRC_COMMAND_CHECK_SERVER("lusers", 1); /* make C compiler happy */ @@ -2053,7 +2081,7 @@ int irc_command_map (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); IRC_COMMAND_CHECK_SERVER("map", 1); /* make C compiler happy */ @@ -2079,7 +2107,7 @@ int irc_command_me (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); IRC_COMMAND_CHECK_SERVER("me", 1); /* make C compiler happy */ @@ -2133,7 +2161,7 @@ int irc_command_mode (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); IRC_COMMAND_CHECK_SERVER("mode", 1); /* make C compiler happy */ @@ -2177,7 +2205,7 @@ int irc_command_motd (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); IRC_COMMAND_CHECK_SERVER("motd", 1); /* make C compiler happy */ @@ -2209,7 +2237,7 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc, struct t_irc_nick *ptr_nick; char *string; - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); /* make C compiler happy */ (void) data; @@ -2367,7 +2395,7 @@ int irc_command_names (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); IRC_COMMAND_CHECK_SERVER("names", 1); /* make C compiler happy */ @@ -2427,7 +2455,7 @@ int irc_command_nick (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); IRC_COMMAND_CHECK_SERVER("nick", 0); /* make C compiler happy */ @@ -2474,7 +2502,7 @@ irc_command_notice (void *data, struct t_gui_buffer *buffer, int argc, int arg_nick, arg_text; struct t_irc_channel *ptr_channel; - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); /* make C compiler happy */ (void) data; @@ -2528,7 +2556,7 @@ int irc_command_op (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); IRC_COMMAND_CHECK_SERVER("op", 1); /* make C compiler happy */ @@ -2569,7 +2597,7 @@ int irc_command_oper (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); IRC_COMMAND_CHECK_SERVER("oper", 1); /* make C compiler happy */ @@ -2633,7 +2661,7 @@ irc_command_part (void *data, struct t_gui_buffer *buffer, int argc, { char *channel_name, *pos_args; - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); IRC_COMMAND_CHECK_SERVER("part", 1); /* make C compiler happy */ @@ -2695,7 +2723,7 @@ int irc_command_ping (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); IRC_COMMAND_CHECK_SERVER("ping", 1); /* make C compiler happy */ @@ -2723,7 +2751,7 @@ int irc_command_pong (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); IRC_COMMAND_CHECK_SERVER("pong", 0); /* make C compiler happy */ @@ -2754,7 +2782,7 @@ irc_command_query (void *data, struct t_gui_buffer *buffer, int argc, char *string; int arg_nick, arg_text; - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); /* make C compiler happy */ (void) data; @@ -2822,7 +2850,7 @@ int irc_command_quote (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); /* make C compiler happy */ (void) data; @@ -2897,7 +2925,7 @@ irc_command_reconnect (void *data, struct t_gui_buffer *buffer, int argc, { int i, nb_reconnect, reconnect_ok, all_servers, no_join; - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); /* make C compiler happy */ (void) data; @@ -2972,7 +3000,7 @@ int irc_command_rehash (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); IRC_COMMAND_CHECK_SERVER("rehash", 1); /* make C compiler happy */ @@ -2998,7 +3026,7 @@ int irc_command_restart (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); IRC_COMMAND_CHECK_SERVER("restart", 1); /* make C compiler happy */ @@ -3020,7 +3048,7 @@ int irc_command_sajoin (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); IRC_COMMAND_CHECK_SERVER("sajoin", 1); /* make C compiler happy */ @@ -3047,7 +3075,7 @@ int irc_command_samode (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); IRC_COMMAND_CHECK_SERVER("samode", 1); /* make C compiler happy */ @@ -3074,7 +3102,7 @@ int irc_command_sanick (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); IRC_COMMAND_CHECK_SERVER("sanick", 1); /* make C compiler happy */ @@ -3101,7 +3129,7 @@ int irc_command_sapart (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); IRC_COMMAND_CHECK_SERVER("sapart", 1); /* make C compiler happy */ @@ -3128,7 +3156,7 @@ int irc_command_saquit (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); IRC_COMMAND_CHECK_SERVER("saquit", 1); /* make C compiler happy */ @@ -3159,7 +3187,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc, struct t_irc_server *ptr_server2, *server_found, *new_server; char *server_name; - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); /* make C compiler happy */ (void) data; @@ -3500,7 +3528,7 @@ int irc_command_service (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); IRC_COMMAND_CHECK_SERVER("service", 1); /* make C compiler happy */ @@ -3528,7 +3556,7 @@ int irc_command_servlist (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); IRC_COMMAND_CHECK_SERVER("servlist", 1); /* make C compiler happy */ @@ -3557,7 +3585,7 @@ int irc_command_squery (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); IRC_COMMAND_CHECK_SERVER("squery", 1); /* make C compiler happy */ @@ -3592,7 +3620,7 @@ int irc_command_squit (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); IRC_COMMAND_CHECK_SERVER("squit", 1); /* make C compiler happy */ @@ -3617,7 +3645,7 @@ int irc_command_stats (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); IRC_COMMAND_CHECK_SERVER("stats", 1); /* make C compiler happy */ @@ -3644,7 +3672,7 @@ int irc_command_summon (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); IRC_COMMAND_CHECK_SERVER("summon", 1); /* make C compiler happy */ @@ -3672,7 +3700,7 @@ int irc_command_time (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); IRC_COMMAND_CHECK_SERVER("time", 1); /* make C compiler happy */ @@ -3700,7 +3728,7 @@ irc_command_topic (void *data, struct t_gui_buffer *buffer, int argc, { char *channel_name, *new_topic, *new_topic_color; - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); IRC_COMMAND_CHECK_SERVER("topic", 1); /* make C compiler happy */ @@ -3769,7 +3797,7 @@ int irc_command_trace (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); IRC_COMMAND_CHECK_SERVER("trace", 1); /* make C compiler happy */ @@ -3798,7 +3826,7 @@ irc_command_unban (void *data, struct t_gui_buffer *buffer, int argc, char *pos_channel; int pos_args; - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); IRC_COMMAND_CHECK_SERVER("unban", 1); /* make C compiler happy */ @@ -3862,7 +3890,7 @@ int irc_command_userhost (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); IRC_COMMAND_CHECK_SERVER("userhost", 1); /* make C compiler happy */ @@ -3890,7 +3918,7 @@ int irc_command_users (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); IRC_COMMAND_CHECK_SERVER("users", 1); /* make C compiler happy */ @@ -3916,7 +3944,7 @@ int irc_command_version (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); IRC_COMMAND_CHECK_SERVER("version", 1); /* make C compiler happy */ @@ -3954,7 +3982,7 @@ int irc_command_voice (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); IRC_COMMAND_CHECK_SERVER("voice", 1); /* make C compiler happy */ @@ -3995,7 +4023,7 @@ int irc_command_wallops (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); IRC_COMMAND_CHECK_SERVER("wallops", 1); /* make C compiler happy */ @@ -4023,7 +4051,7 @@ int irc_command_who (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); IRC_COMMAND_CHECK_SERVER("who", 1); /* make C compiler happy */ @@ -4049,7 +4077,7 @@ int irc_command_whois (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); IRC_COMMAND_CHECK_SERVER("whois", 1); /* make C compiler happy */ @@ -4086,7 +4114,7 @@ int irc_command_whowas (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); IRC_COMMAND_CHECK_SERVER("whowas", 1); /* make C compiler happy */ @@ -4155,14 +4183,7 @@ irc_command_init () " set away on all servers:\n" " /allserv away I'm away"), NULL, &irc_command_allserv, NULL); - weechat_hook_command ("away", - N_("toggle away status"), - N_("[-all] [message]"), - N_(" -all: toggle away status on all connected " - "servers\n" - "message: message for away (if no message is " - "given, away status is removed)"), - "-all", &irc_command_away, NULL); + weechat_hook_command_run ("/away", &irc_command_run_away, NULL); weechat_hook_command ("ban", N_("ban nicks or hosts"), N_("[channel] [nickname [nickname ...]]"), diff --git a/src/plugins/irc/irc-completion.c b/src/plugins/irc/irc-completion.c index 7ad1cec81..7358cdb5c 100644 --- a/src/plugins/irc/irc-completion.c +++ b/src/plugins/irc/irc-completion.c @@ -44,7 +44,7 @@ irc_completion_server_cb (void *data, const char *completion_item, struct t_gui_buffer *buffer, struct t_gui_completion *completion) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); /* make C compiler happy */ (void) data; @@ -69,7 +69,7 @@ irc_completion_server_nick_cb (void *data, const char *completion_item, struct t_gui_buffer *buffer, struct t_gui_completion *completion) { - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); /* make C compiler happy */ (void) data; @@ -96,7 +96,7 @@ irc_completion_server_channels_cb (void *data, const char *completion_item, { struct t_irc_channel *ptr_channel; - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); /* make C compiler happy */ (void) data; @@ -131,7 +131,7 @@ irc_completion_server_privates_cb (void *data, const char *completion_item, { struct t_irc_channel *ptr_channel; - IRC_GET_SERVER(buffer); + IRC_BUFFER_GET_SERVER(buffer); /* make C compiler happy */ (void) data; @@ -167,7 +167,7 @@ irc_completion_server_nicks_cb (void *data, const char *completion_item, struct t_irc_channel *ptr_channel2; struct t_irc_nick *ptr_nick; - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); /* make C compiler happy */ (void) data; @@ -232,7 +232,7 @@ irc_completion_channel_cb (void *data, const char *completion_item, struct t_gui_buffer *buffer, struct t_gui_completion *completion) { - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); /* make C compiler happy */ (void) data; @@ -289,7 +289,7 @@ irc_completion_channel_nicks_cb (void *data, const char *completion_item, { struct t_irc_nick *ptr_nick; - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); /* make C compiler happy */ (void) data; @@ -357,7 +357,7 @@ irc_completion_channel_nicks_hosts_cb (void *data, const char *completion_item, char *buf; int length; - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); /* make C compiler happy */ (void) data; @@ -417,7 +417,7 @@ irc_completion_channel_topic_cb (void *data, const char *completion_item, { char *topic_color; - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); /* make C compiler happy */ (void) data; diff --git a/src/plugins/irc/irc-input.c b/src/plugins/irc/irc-input.c index caa1767dd..185730939 100644 --- a/src/plugins/irc/irc-input.c +++ b/src/plugins/irc/irc-input.c @@ -47,7 +47,7 @@ irc_input_user_message_display (struct t_gui_buffer *buffer, const char *text) text_decoded = irc_color_decode (text, weechat_config_boolean (irc_config_network_colors_send)); - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); if (ptr_channel) { @@ -82,7 +82,7 @@ irc_input_send_user_message (struct t_gui_buffer *buffer, char *text) int max_length; char *pos, *pos_max, *last_space, *pos_next, *next, saved_char; - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); if (!ptr_server || !ptr_channel || !text || !text[0]) return; @@ -147,7 +147,7 @@ irc_input_data_cb (void *data, struct t_gui_buffer *buffer, const char *ptr_data; char *data_with_colors, *msg; - IRC_GET_SERVER_CHANNEL(buffer); + IRC_BUFFER_GET_SERVER_CHANNEL(buffer); /* make C compiler happy */ (void) data; diff --git a/src/plugins/irc/irc.h b/src/plugins/irc/irc.h index 029715c7f..a9f43aedc 100644 --- a/src/plugins/irc/irc.h +++ b/src/plugins/irc/irc.h @@ -23,24 +23,6 @@ #define weechat_plugin weechat_irc_plugin #define IRC_PLUGIN_NAME "irc" -#define IRC_GET_SERVER(__buffer) \ - struct t_weechat_plugin *buffer_plugin = NULL; \ - struct t_irc_server *ptr_server = NULL; \ - buffer_plugin = weechat_buffer_get_pointer (__buffer, "plugin"); \ - if (buffer_plugin == weechat_irc_plugin) \ - irc_buffer_get_server_channel (__buffer, &ptr_server, NULL); - -#define IRC_GET_SERVER_CHANNEL(__buffer) \ - struct t_weechat_plugin *buffer_plugin = NULL; \ - struct t_irc_server *ptr_server = NULL; \ - struct t_irc_channel *ptr_channel = NULL; \ - buffer_plugin = weechat_buffer_get_pointer (__buffer, "plugin"); \ - if (buffer_plugin == weechat_irc_plugin) \ - { \ - irc_buffer_get_server_channel (__buffer, &ptr_server, \ - &ptr_channel); \ - } - #define IRC_COLOR_CHAT weechat_color("chat") #define IRC_COLOR_CHAT_CHANNEL weechat_color("chat_channel") #define IRC_COLOR_CHAT_DELIMITERS weechat_color("chat_delimiters") |