From db4f20c1f1de3619b6cdd1ea32dd552653b493d9 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Fri, 28 Aug 2009 11:36:51 +0200 Subject: [PATCH] Add 2 new completions (irc_server_channels and irc_server_privates), improve completion of command /invite --- doc/en/autogen/plugin_api/completions.txt | 8 ++- doc/fr/autogen/plugin_api/completions.txt | 8 ++- po/cs.po | 14 +++- po/de.po | 14 +++- po/es.po | 14 +++- po/fr.po | 18 +++-- po/hu.po | 14 +++- po/pl.po | 16 ++++- po/ru.po | 14 +++- po/weechat.pot | 12 +++- src/plugins/irc/irc-command.c | 2 +- src/plugins/irc/irc-completion.c | 84 ++++++++++++++++++++++- 12 files changed, 183 insertions(+), 35 deletions(-) diff --git a/doc/en/autogen/plugin_api/completions.txt b/doc/en/autogen/plugin_api/completions.txt index 2c234ea79..fa95b4ff6 100644 --- a/doc/en/autogen/plugin_api/completions.txt +++ b/doc/en/autogen/plugin_api/completions.txt @@ -11,20 +11,24 @@ | irc | irc_channel_topic | topic of current IRC channel -| irc | irc_channels | IRC channels (on all servers) +| irc | irc_channels | channels on all IRC servers | irc | irc_ignores_numbers | numbers for defined ignores | irc | irc_msg_part | default part message for IRC channel -| irc | irc_privates | IRC privates (on all servers) +| irc | irc_privates | privates on all IRC servers | irc | irc_server | current IRC server +| irc | irc_server_channels | channels on current IRC server + | irc | irc_server_nick | nick on current IRC server | irc | irc_server_nicks | nicks on all channels of current IRC server +| irc | irc_server_privates | privates on current IRC server + | irc | irc_servers | IRC servers (internal names) | irc | nick | nicks of current IRC channel diff --git a/doc/fr/autogen/plugin_api/completions.txt b/doc/fr/autogen/plugin_api/completions.txt index 30265d4b7..7b0dc8404 100644 --- a/doc/fr/autogen/plugin_api/completions.txt +++ b/doc/fr/autogen/plugin_api/completions.txt @@ -11,20 +11,24 @@ | irc | irc_channel_topic | titre du canal IRC courant -| irc | irc_channels | canaux IRC (sur tous les serveurs) +| irc | irc_channels | canaux sur tous les serveurs IRC | irc | irc_ignores_numbers | numéros pour les ignores définis | irc | irc_msg_part | message de fin par défaut pour le canal IRC -| irc | irc_privates | canaux IRC (sur tous les serveurs) +| irc | irc_privates | privés sur tous les serveurs IRC | irc | irc_server | serveur IRC courant +| irc | irc_server_channels | canaux sur le serveur IRC courant + | irc | irc_server_nick | pseudo sur le serveur IRC courant | irc | irc_server_nicks | pseudos sur tous les canaux du serveur IRC courant +| irc | irc_server_privates | privés sur le serveur IRC courant + | irc | irc_servers | serveurs IRC (noms internes) | irc | nick | pseudos du canal IRC courant diff --git a/po/cs.po b/po/cs.po index 0f174e745..89f4cdf2d 100644 --- a/po/cs.po +++ b/po/cs.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2009-08-28 10:05+0200\n" +"POT-Creation-Date: 2009-08-28 10:18+0200\n" "PO-Revision-Date: 2009-05-11 13:02+0200\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" @@ -3627,6 +3627,14 @@ msgstr "připojit se k serveru/serverům" msgid "nick on current IRC server" msgstr "připojit se k serveru/serverům" +#, fuzzy +msgid "channels on current IRC server" +msgstr "seznam uživatelů přihlášených k serveru" + +#, fuzzy +msgid "privates on current IRC server" +msgstr "seznam uživatelů přihlášených k serveru" + #, fuzzy msgid "nicks on all channels of current IRC server" msgstr "seznam uživatelů přihlášených k serveru" @@ -3651,11 +3659,11 @@ msgid "topic of current IRC channel" msgstr "seznam uživatelů na kanálu" #, fuzzy -msgid "IRC channels (on all servers)" +msgid "channels on all IRC servers" msgstr "seznam uživatelů přihlášených k serveru" #, fuzzy -msgid "IRC privates (on all servers)" +msgid "privates on all IRC servers" msgstr "seznam uživatelů přihlášených k serveru" #, fuzzy diff --git a/po/de.po b/po/de.po index 9c642f0ae..400e189c7 100644 --- a/po/de.po +++ b/po/de.po @@ -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: 2009-08-28 10:05+0200\n" +"POT-Creation-Date: 2009-08-28 10:18+0200\n" "PO-Revision-Date: 2009-05-11 13:02+0200\n" "Last-Translator: Thomas Schuetz \n" "Language-Team: weechat-dev \n" @@ -3603,6 +3603,14 @@ msgstr "mit Server verbinden" msgid "nick on current IRC server" msgstr "mit Server verbinden" +#, fuzzy +msgid "channels on current IRC server" +msgstr "Channels, die bei Verbindung zum Server zu betreten sind" + +#, fuzzy +msgid "privates on current IRC server" +msgstr "Channels, die bei Verbindung zum Server zu betreten sind" + #, fuzzy msgid "nicks on all channels of current IRC server" msgstr "Channels, die bei Verbindung zum Server zu betreten sind" @@ -3627,11 +3635,11 @@ msgid "topic of current IRC channel" msgstr "Liste von Nicks im Channel" #, fuzzy -msgid "IRC channels (on all servers)" +msgid "channels on all IRC servers" msgstr "Channels, die bei Verbindung zum Server zu betreten sind" #, fuzzy -msgid "IRC privates (on all servers)" +msgid "privates on all IRC servers" msgstr "Channels, die bei Verbindung zum Server zu betreten sind" #, fuzzy diff --git a/po/es.po b/po/es.po index ec3b72367..62810ddbe 100644 --- a/po/es.po +++ b/po/es.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2009-08-28 10:05+0200\n" +"POT-Creation-Date: 2009-08-28 10:18+0200\n" "PO-Revision-Date: 2009-08-23 04:03-0300\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" @@ -3578,6 +3578,14 @@ msgstr "conectarse a un servidor" msgid "nick on current IRC server" msgstr "conectarse a un servidor" +#, fuzzy +msgid "channels on current IRC server" +msgstr "lista de canales a unirse cuando se conecte a un servidor" + +#, fuzzy +msgid "privates on current IRC server" +msgstr "lista de canales a unirse cuando se conecte a un servidor" + #, fuzzy msgid "nicks on all channels of current IRC server" msgstr "lista de canales a unirse cuando se conecte a un servidor" @@ -3602,11 +3610,11 @@ msgid "topic of current IRC channel" msgstr "lista de usuarios en el canal" #, fuzzy -msgid "IRC channels (on all servers)" +msgid "channels on all IRC servers" msgstr "lista de canales a unirse cuando se conecte a un servidor" #, fuzzy -msgid "IRC privates (on all servers)" +msgid "privates on all IRC servers" msgstr "lista de canales a unirse cuando se conecte a un servidor" #, fuzzy diff --git a/po/fr.po b/po/fr.po index 22aea40ef..71319f180 100644 --- a/po/fr.po +++ b/po/fr.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2009-08-28 10:05+0200\n" -"PO-Revision-Date: 2009-08-28 10:05+0200\n" +"POT-Creation-Date: 2009-08-28 10:18+0200\n" +"PO-Revision-Date: 2009-08-28 10:22+0200\n" "Last-Translator: FlashCode \n" "Language-Team: weechat-dev \n" "MIME-Version: 1.0\n" @@ -3784,6 +3784,12 @@ msgstr "serveur IRC courant" msgid "nick on current IRC server" msgstr "pseudo sur le serveur IRC courant" +msgid "channels on current IRC server" +msgstr "canaux sur le serveur IRC courant" + +msgid "privates on current IRC server" +msgstr "privés sur le serveur IRC courant" + msgid "nicks on all channels of current IRC server" msgstr "pseudos sur tous les canaux du serveur IRC courant" @@ -3802,11 +3808,11 @@ msgstr "pseudos et noms d'hôtes du canal IRC courant" msgid "topic of current IRC channel" msgstr "titre du canal IRC courant" -msgid "IRC channels (on all servers)" -msgstr "canaux IRC (sur tous les serveurs)" +msgid "channels on all IRC servers" +msgstr "canaux sur tous les serveurs IRC" -msgid "IRC privates (on all servers)" -msgstr "canaux IRC (sur tous les serveurs)" +msgid "privates on all IRC servers" +msgstr "privés sur tous les serveurs IRC" msgid "default part message for IRC channel" msgstr "message de fin par défaut pour le canal IRC" diff --git a/po/hu.po b/po/hu.po index 006461454..86224a5dc 100644 --- a/po/hu.po +++ b/po/hu.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2009-08-28 10:05+0200\n" +"POT-Creation-Date: 2009-08-28 10:18+0200\n" "PO-Revision-Date: 2009-05-11 13:02+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -3643,6 +3643,14 @@ msgstr "csatlakozás a szerver(ek)hez" msgid "nick on current IRC server" msgstr "csatlakozás a szerver(ek)hez" +#, fuzzy +msgid "channels on current IRC server" +msgstr "szobák listája ahová be akarunk lépni csatlakozás után" + +#, fuzzy +msgid "privates on current IRC server" +msgstr "szobák listája ahová be akarunk lépni csatlakozás után" + #, fuzzy msgid "nicks on all channels of current IRC server" msgstr "szobák listája ahová be akarunk lépni csatlakozás után" @@ -3667,11 +3675,11 @@ msgid "topic of current IRC channel" msgstr "felhasználók listája a szobában" #, fuzzy -msgid "IRC channels (on all servers)" +msgid "channels on all IRC servers" msgstr "szobák listája ahová be akarunk lépni csatlakozás után" #, fuzzy -msgid "IRC privates (on all servers)" +msgid "privates on all IRC servers" msgstr "szobák listája ahová be akarunk lépni csatlakozás után" #, fuzzy diff --git a/po/pl.po b/po/pl.po index 7c295cedd..c1264a47c 100644 --- a/po/pl.po +++ b/po/pl.po @@ -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: 2009-08-28 10:05+0200\n" +"POT-Creation-Date: 2009-08-28 10:18+0200\n" "PO-Revision-Date: 2009-08-17 11:08+0100\n" "Last-Translator: Krzysztof Korościk \n" "Language-Team: Polish\n" @@ -3743,6 +3743,14 @@ msgstr "obecny serwer IRC" msgid "nick on current IRC server" msgstr "użytkownicy obecnego serwera IRC" +#, fuzzy +msgid "channels on current IRC server" +msgstr "kanały IRC (na wszystkich serwerach)" + +#, fuzzy +msgid "privates on current IRC server" +msgstr "rozmowy prywatne (na wszystkich serwerach)" + msgid "nicks on all channels of current IRC server" msgstr "użytkownicy na wszystkich kanałach obecnego serwera IRC" @@ -3761,10 +3769,12 @@ msgstr "użytkownicy i hosty obecnego kanału IRC" msgid "topic of current IRC channel" msgstr "temat obecnego kanału IRC" -msgid "IRC channels (on all servers)" +#, fuzzy +msgid "channels on all IRC servers" msgstr "kanały IRC (na wszystkich serwerach)" -msgid "IRC privates (on all servers)" +#, fuzzy +msgid "privates on all IRC servers" msgstr "rozmowy prywatne (na wszystkich serwerach)" msgid "default part message for IRC channel" diff --git a/po/ru.po b/po/ru.po index 814ab7dd2..34957b7e9 100644 --- a/po/ru.po +++ b/po/ru.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2009-08-28 10:05+0200\n" +"POT-Creation-Date: 2009-08-28 10:18+0200\n" "PO-Revision-Date: 2009-05-11 13:02+0200\n" "Last-Translator: Pavel Shevchuk \n" "Language-Team: weechat-dev \n" @@ -3635,6 +3635,14 @@ msgstr "подключиться к серверу(-ам)" msgid "nick on current IRC server" msgstr "подключиться к серверу(-ам)" +#, fuzzy +msgid "channels on current IRC server" +msgstr "Список каналов, на которые заходить при соединении с сервером" + +#, fuzzy +msgid "privates on current IRC server" +msgstr "Список каналов, на которые заходить при соединении с сервером" + #, fuzzy msgid "nicks on all channels of current IRC server" msgstr "Список каналов, на которые заходить при соединении с сервером" @@ -3659,11 +3667,11 @@ msgid "topic of current IRC channel" msgstr "список ников на канале" #, fuzzy -msgid "IRC channels (on all servers)" +msgid "channels on all IRC servers" msgstr "Список каналов, на которые заходить при соединении с сервером" #, fuzzy -msgid "IRC privates (on all servers)" +msgid "privates on all IRC servers" msgstr "Список каналов, на которые заходить при соединении с сервером" #, fuzzy diff --git a/po/weechat.pot b/po/weechat.pot index 427004148..3dbe1776f 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: 2009-08-28 10:05+0200\n" +"POT-Creation-Date: 2009-08-28 10:18+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -3100,6 +3100,12 @@ msgstr "" msgid "nick on current IRC server" msgstr "" +msgid "channels on current IRC server" +msgstr "" + +msgid "privates on current IRC server" +msgstr "" + msgid "nicks on all channels of current IRC server" msgstr "" @@ -3118,10 +3124,10 @@ msgstr "" msgid "topic of current IRC channel" msgstr "" -msgid "IRC channels (on all servers)" +msgid "channels on all IRC servers" msgstr "" -msgid "IRC privates (on all servers)" +msgid "privates on all IRC servers" msgstr "" msgid "default part message for IRC channel" diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c index 8c2cfb60d..1463a1fd8 100644 --- a/src/plugins/irc/irc-command.c +++ b/src/plugins/irc/irc-command.c @@ -3822,7 +3822,7 @@ irc_command_init () N_("nickname channel"), N_("nickname: nick to invite\n" " channel: channel to invite"), - "%(nicks) %(irc_channel)", &irc_command_invite, NULL); + "%(nicks) %(irc_server_channels)", &irc_command_invite, NULL); weechat_hook_command ("ison", N_("check if a nickname is currently on IRC"), N_("nickname [nickname ...]"), diff --git a/src/plugins/irc/irc-completion.c b/src/plugins/irc/irc-completion.c index 4146f810b..ad6139b3c 100644 --- a/src/plugins/irc/irc-completion.c +++ b/src/plugins/irc/irc-completion.c @@ -84,6 +84,76 @@ irc_completion_server_nick_cb (void *data, const char *completion_item, return WEECHAT_RC_OK; } +/* + * irc_completion_server_channels_cb: callback for completion with channels + * of current server + */ + +int +irc_completion_server_channels_cb (void *data, const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + struct t_irc_channel *ptr_channel; + + IRC_GET_SERVER(buffer); + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + if (ptr_server) + { + for (ptr_channel = ptr_server->channels; ptr_channel; + ptr_channel = ptr_channel->next_channel) + { + if (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL) + { + weechat_hook_completion_list_add (completion, ptr_channel->name, + 0, WEECHAT_LIST_POS_SORT); + } + } + } + + return WEECHAT_RC_OK; +} + +/* + * irc_completion_server_privates_cb: callback for completion with privates + * of current server + */ + +int +irc_completion_server_privates_cb (void *data, const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + struct t_irc_channel *ptr_channel; + + IRC_GET_SERVER(buffer); + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + if (ptr_server) + { + for (ptr_channel = ptr_server->channels; ptr_channel; + ptr_channel = ptr_channel->next_channel) + { + if (ptr_channel->type == IRC_CHANNEL_TYPE_PRIVATE) + { + weechat_hook_completion_list_add (completion, ptr_channel->name, + 0, WEECHAT_LIST_POS_SORT); + } + } + } + + return WEECHAT_RC_OK; +} + /* * irc_completion_server_nicks_cb: callback for completion with nicks * of current server @@ -368,6 +438,7 @@ irc_completion_channel_topic_cb (void *data, const char *completion_item, /* * irc_completion_channels_cb: callback for completion with channels + * of all servers */ int @@ -401,7 +472,8 @@ irc_completion_channels_cb (void *data, const char *completion_item, } /* - * irc_completion_privates_cb: callback for completion with channels + * irc_completion_privates_cb: callback for completion with privates + * of all servers */ int @@ -501,6 +573,12 @@ irc_completion_init () weechat_hook_completion ("irc_server_nick", N_("nick on current IRC server"), &irc_completion_server_nick_cb, NULL); + weechat_hook_completion ("irc_server_channels", + N_("channels on current IRC server"), + &irc_completion_server_channels_cb, NULL); + weechat_hook_completion ("irc_server_privates", + N_("privates on current IRC server"), + &irc_completion_server_privates_cb, NULL); weechat_hook_completion ("irc_server_nicks", N_("nicks on all channels of current IRC server"), &irc_completion_server_nicks_cb, NULL); @@ -520,10 +598,10 @@ irc_completion_init () N_("topic of current IRC channel"), &irc_completion_channel_topic_cb, NULL); weechat_hook_completion ("irc_channels", - N_("IRC channels (on all servers)"), + N_("channels on all IRC servers"), &irc_completion_channels_cb, NULL); weechat_hook_completion ("irc_privates", - N_("IRC privates (on all servers)"), + N_("privates on all IRC servers"), &irc_completion_privates_cb, NULL); weechat_hook_completion ("irc_msg_part", N_("default part message for IRC channel"),