summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2018-06-14 21:57:27 +0200
committerSébastien Helleu <flashcode@flashtux.org>2018-06-14 21:57:27 +0200
commit744ded04bd0cb447ef87a6f9911ca616f1c4f887 (patch)
tree87bed31987f94301a014dbe3a1dddcb8eb6b2aec
parentda507ca85f475e639647eaf9adaa8c8b4723b575 (diff)
downloadweechat-744ded04bd0cb447ef87a6f9911ca616f1c4f887.zip
relay: add filtering on protocol in info "relay_client_count" (issue #1206)
-rw-r--r--ChangeLog.adoc1
-rw-r--r--doc/de/autogen/plugin_api/infos.adoc2
-rw-r--r--doc/en/autogen/plugin_api/infos.adoc2
-rw-r--r--doc/fr/autogen/plugin_api/infos.adoc2
-rw-r--r--doc/it/autogen/plugin_api/infos.adoc2
-rw-r--r--doc/ja/autogen/plugin_api/infos.adoc2
-rw-r--r--doc/pl/autogen/plugin_api/infos.adoc2
-rw-r--r--po/cs.po8
-rw-r--r--po/de.po8
-rw-r--r--po/es.po7
-rw-r--r--po/fr.po14
-rw-r--r--po/hu.po7
-rw-r--r--po/it.po7
-rw-r--r--po/ja.po8
-rw-r--r--po/pl.po8
-rw-r--r--po/pt.po8
-rw-r--r--po/pt_BR.po7
-rw-r--r--po/ru.po7
-rw-r--r--po/tr.po7
-rw-r--r--po/weechat.pot7
-rw-r--r--src/plugins/relay/relay-info.c76
21 files changed, 128 insertions, 64 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc
index 97f224fa2..e1638260c 100644
--- a/ChangeLog.adoc
+++ b/ChangeLog.adoc
@@ -32,6 +32,7 @@ New features::
* irc: display current nick on connected servers in output of /server list|listfull (issue #1193)
* irc: add option "-server" in command /list (issue #1165)
* irc: add indexed ban list, add completion for /unban and /unquiet (issue #597, task #11374, task #10876)
+ * relay: add filtering on protocol in info "relay_client_count"
* trigger: hide password in command "/msg nickserv set password"
* xfer: add option xfer.network.send_ack (issue #1171)
diff --git a/doc/de/autogen/plugin_api/infos.adoc b/doc/de/autogen/plugin_api/infos.adoc
index 4b0590bdf..0aa5b744c 100644
--- a/doc/de/autogen/plugin_api/infos.adoc
+++ b/doc/de/autogen/plugin_api/infos.adoc
@@ -66,7 +66,7 @@
| python | python_version | Version des verwendeten Interpreters | -
-| relay | relay_client_count | Anzahl an Clients für Relay | Statusname (optional): connecting, waiting_auth, connected, auth_failed, disconnected
+| relay | relay_client_count | Anzahl an Clients für Relay | protocol,status (both are optional, for each argument "*" means all; protocols: irc, weechat; statuses: connecting, waiting_auth, connected, auth_failed, disconnected)
| ruby | ruby_eval | Evaluierung des Quelltextes | Quelltext welcher ausgeführt werden soll
diff --git a/doc/en/autogen/plugin_api/infos.adoc b/doc/en/autogen/plugin_api/infos.adoc
index aad9efc4e..7c57786f8 100644
--- a/doc/en/autogen/plugin_api/infos.adoc
+++ b/doc/en/autogen/plugin_api/infos.adoc
@@ -66,7 +66,7 @@
| python | python_version | version of the interpreter used | -
-| relay | relay_client_count | number of clients for relay | status name (optional): connecting, waiting_auth, connected, auth_failed, disconnected
+| relay | relay_client_count | number of clients for relay | protocol,status (both are optional, for each argument "*" means all; protocols: irc, weechat; statuses: connecting, waiting_auth, connected, auth_failed, disconnected)
| ruby | ruby_eval | evaluation of source code | source code to execute
diff --git a/doc/fr/autogen/plugin_api/infos.adoc b/doc/fr/autogen/plugin_api/infos.adoc
index d9c793653..6d839647c 100644
--- a/doc/fr/autogen/plugin_api/infos.adoc
+++ b/doc/fr/autogen/plugin_api/infos.adoc
@@ -66,7 +66,7 @@
| python | python_version | version de l'interpréteur utilisé | -
-| relay | relay_client_count | nombre de clients pour le relai | nom du statut (optionnel) : connecting, waiting_auth, connected, auth_failed, disconnected
+| relay | relay_client_count | nombre de clients pour le relai | protocole,statut (les deux sont optionnels, pour chaque paramètre "*" signifie tous ; protocoles : irc, weechat ; statuts : connecting, waiting_auth, connected, auth_failed, disconnected)
| ruby | ruby_eval | évaluation de code source | code source à exécuter
diff --git a/doc/it/autogen/plugin_api/infos.adoc b/doc/it/autogen/plugin_api/infos.adoc
index be5d2496f..7b604a3d8 100644
--- a/doc/it/autogen/plugin_api/infos.adoc
+++ b/doc/it/autogen/plugin_api/infos.adoc
@@ -66,7 +66,7 @@
| python | python_version | version of the interpreter used | -
-| relay | relay_client_count | number of clients for relay | status name (optional): connecting, waiting_auth, connected, auth_failed, disconnected
+| relay | relay_client_count | number of clients for relay | protocol,status (both are optional, for each argument "*" means all; protocols: irc, weechat; statuses: connecting, waiting_auth, connected, auth_failed, disconnected)
| ruby | ruby_eval | evaluation of source code | source code to execute
diff --git a/doc/ja/autogen/plugin_api/infos.adoc b/doc/ja/autogen/plugin_api/infos.adoc
index e0521304d..b76e615ca 100644
--- a/doc/ja/autogen/plugin_api/infos.adoc
+++ b/doc/ja/autogen/plugin_api/infos.adoc
@@ -66,7 +66,7 @@
| python | python_version | 使用中のインタプリタのバージョン | -
-| relay | relay_client_count | 中継するクライアントのリスト | 状態名 (任意): connecting、waiting_auth、connected、auth_failed、disconnected
+| relay | relay_client_count | 中継するクライアントのリスト | protocol,status (both are optional, for each argument "*" means all; protocols: irc, weechat; statuses: connecting, waiting_auth, connected, auth_failed, disconnected)
| ruby | ruby_eval | ソースコードの評価 | 実行するソースコード
diff --git a/doc/pl/autogen/plugin_api/infos.adoc b/doc/pl/autogen/plugin_api/infos.adoc
index 756811af7..9328b8f57 100644
--- a/doc/pl/autogen/plugin_api/infos.adoc
+++ b/doc/pl/autogen/plugin_api/infos.adoc
@@ -66,7 +66,7 @@
| python | python_version | wersja użytego interpretera | -
-| relay | relay_client_count | liczba podłączonych klientów | nazwa statusu (opcjonalne): łączenie, oczekiwanie na uwierzytelnienie, połączono, uwierzytelnienie nieudane, rozłączono
+| relay | relay_client_count | liczba podłączonych klientów | protocol,status (both are optional, for each argument "*" means all; protocols: irc, weechat; statuses: connecting, waiting_auth, connected, auth_failed, disconnected)
| ruby | ruby_eval | wykonywanie kodu źródłowego | kod źródłowy do wykonania
diff --git a/po/cs.po b/po/cs.po
index b1f8536cb..e0c337702 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2018-06-14 21:40+0200\n"
+"POT-Creation-Date: 2018-06-14 21:51+0200\n"
"PO-Revision-Date: 2018-03-31 15:36+0200\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -10995,9 +10995,11 @@ msgid "number of clients for relay"
msgstr "Klienti pro přenos:"
#. TRANSLATORS: please do not translate the status names, they must be used in English
+#, fuzzy
msgid ""
-"status name (optional): connecting, waiting_auth, connected, auth_failed, "
-"disconnected"
+"protocol,status (both are optional, for each argument \"*\" means all; "
+"protocols: irc, weechat; statuses: connecting, waiting_auth, connected, "
+"auth_failed, disconnected)"
msgstr ""
"jména stavů (volitelné): connecting, waiting_auth, connected, auth_failed, "
"disconnected"
diff --git a/po/de.po b/po/de.po
index ba2c93638..3b771f9e2 100644
--- a/po/de.po
+++ b/po/de.po
@@ -24,7 +24,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2018-06-14 21:40+0200\n"
+"POT-Creation-Date: 2018-06-14 21:51+0200\n"
"PO-Revision-Date: 2018-06-02 19:45+0200\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <kde-i18n-de@kde.org>\n"
@@ -12881,9 +12881,11 @@ msgid "number of clients for relay"
msgstr "Anzahl an Clients für Relay"
#. TRANSLATORS: please do not translate the status names, they must be used in English
+#, fuzzy
msgid ""
-"status name (optional): connecting, waiting_auth, connected, auth_failed, "
-"disconnected"
+"protocol,status (both are optional, for each argument \"*\" means all; "
+"protocols: irc, weechat; statuses: connecting, waiting_auth, connected, "
+"auth_failed, disconnected)"
msgstr ""
"Statusname (optional): connecting, waiting_auth, connected, auth_failed, "
"disconnected"
diff --git a/po/es.po b/po/es.po
index 433ee64fb..9e5a4474b 100644
--- a/po/es.po
+++ b/po/es.po
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2018-06-14 21:40+0200\n"
+"POT-Creation-Date: 2018-06-14 21:51+0200\n"
"PO-Revision-Date: 2018-03-31 15:36+0200\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -11356,8 +11356,9 @@ msgstr "Lista de clientes a retransmitir"
#. TRANSLATORS: please do not translate the status names, they must be used in English
msgid ""
-"status name (optional): connecting, waiting_auth, connected, auth_failed, "
-"disconnected"
+"protocol,status (both are optional, for each argument \"*\" means all; "
+"protocols: irc, weechat; statuses: connecting, waiting_auth, connected, "
+"auth_failed, disconnected)"
msgstr ""
msgid "list of relay clients"
diff --git a/po/fr.po b/po/fr.po
index 7d8ee9763..23a5fd69c 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2018-06-14 21:40+0200\n"
-"PO-Revision-Date: 2018-06-14 21:44+0200\n"
+"POT-Creation-Date: 2018-06-14 21:51+0200\n"
+"PO-Revision-Date: 2018-06-14 21:51+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@@ -12605,11 +12605,13 @@ msgstr "nombre de clients pour le relai"
#. TRANSLATORS: please do not translate the status names, they must be used in English
msgid ""
-"status name (optional): connecting, waiting_auth, connected, auth_failed, "
-"disconnected"
+"protocol,status (both are optional, for each argument \"*\" means all; "
+"protocols: irc, weechat; statuses: connecting, waiting_auth, connected, "
+"auth_failed, disconnected)"
msgstr ""
-"nom du statut (optionnel) : connecting, waiting_auth, connected, "
-"auth_failed, disconnected"
+"protocole,statut (les deux sont optionnels, pour chaque paramètre \"*\" "
+"signifie tous ; protocoles : irc, weechat ; statuts : connecting, "
+"waiting_auth, connected, auth_failed, disconnected)"
msgid "list of relay clients"
msgstr "liste des clients pour le relai"
diff --git a/po/hu.po b/po/hu.po
index 9b6b07b86..4fc3bbcc5 100644
--- a/po/hu.po
+++ b/po/hu.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2018-06-14 21:40+0200\n"
+"POT-Creation-Date: 2018-06-14 21:51+0200\n"
"PO-Revision-Date: 2018-03-31 15:36+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -10345,8 +10345,9 @@ msgstr "Nincs szerver.\n"
#. TRANSLATORS: please do not translate the status names, they must be used in English
msgid ""
-"status name (optional): connecting, waiting_auth, connected, auth_failed, "
-"disconnected"
+"protocol,status (both are optional, for each argument \"*\" means all; "
+"protocols: irc, weechat; statuses: connecting, waiting_auth, connected, "
+"auth_failed, disconnected)"
msgstr ""
#, fuzzy
diff --git a/po/it.po b/po/it.po
index 7726c1946..1577559ec 100644
--- a/po/it.po
+++ b/po/it.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2018-06-14 21:40+0200\n"
+"POT-Creation-Date: 2018-06-14 21:51+0200\n"
"PO-Revision-Date: 2018-03-31 15:36+0200\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -11562,8 +11562,9 @@ msgstr "Elenco dei client per il relay"
#. TRANSLATORS: please do not translate the status names, they must be used in English
msgid ""
-"status name (optional): connecting, waiting_auth, connected, auth_failed, "
-"disconnected"
+"protocol,status (both are optional, for each argument \"*\" means all; "
+"protocols: irc, weechat; statuses: connecting, waiting_auth, connected, "
+"auth_failed, disconnected)"
msgstr ""
msgid "list of relay clients"
diff --git a/po/ja.po b/po/ja.po
index fd7d7ee39..b1af6ad7c 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2018-06-14 21:40+0200\n"
+"POT-Creation-Date: 2018-06-14 21:51+0200\n"
"PO-Revision-Date: 2018-06-11 09:00+0900\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
@@ -12135,9 +12135,11 @@ msgid "number of clients for relay"
msgstr "中継するクライアントのリスト"
#. TRANSLATORS: please do not translate the status names, they must be used in English
+#, fuzzy
msgid ""
-"status name (optional): connecting, waiting_auth, connected, auth_failed, "
-"disconnected"
+"protocol,status (both are optional, for each argument \"*\" means all; "
+"protocols: irc, weechat; statuses: connecting, waiting_auth, connected, "
+"auth_failed, disconnected)"
msgstr ""
"状態名 (任意): connecting、waiting_auth、connected、auth_failed、disconnected"
diff --git a/po/pl.po b/po/pl.po
index 8af943fdf..fcf200eeb 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2018-06-14 21:40+0200\n"
+"POT-Creation-Date: 2018-06-14 21:51+0200\n"
"PO-Revision-Date: 2018-03-31 15:36+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
"Language-Team: Polish <>\n"
@@ -12347,9 +12347,11 @@ msgid "number of clients for relay"
msgstr "liczba podłączonych klientów"
#. TRANSLATORS: please do not translate the status names, they must be used in English
+#, fuzzy
msgid ""
-"status name (optional): connecting, waiting_auth, connected, auth_failed, "
-"disconnected"
+"protocol,status (both are optional, for each argument \"*\" means all; "
+"protocols: irc, weechat; statuses: connecting, waiting_auth, connected, "
+"auth_failed, disconnected)"
msgstr ""
"nazwa statusu (opcjonalne): łączenie, oczekiwanie na uwierzytelnienie, "
"połączono, uwierzytelnienie nieudane, rozłączono"
diff --git a/po/pt.po b/po/pt.po
index 86e1782ee..b9982389f 100644
--- a/po/pt.po
+++ b/po/pt.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2018-06-14 21:40+0200\n"
+"POT-Creation-Date: 2018-06-14 21:51+0200\n"
"PO-Revision-Date: 2018-03-31 15:36+0200\n"
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
"Language-Team: Portuguese <>\n"
@@ -12020,9 +12020,11 @@ msgid "number of clients for relay"
msgstr "número de cliente para reencaminhar"
#. TRANSLATORS: please do not translate the status names, they must be used in English
+#, fuzzy
msgid ""
-"status name (optional): connecting, waiting_auth, connected, auth_failed, "
-"disconnected"
+"protocol,status (both are optional, for each argument \"*\" means all; "
+"protocols: irc, weechat; statuses: connecting, waiting_auth, connected, "
+"auth_failed, disconnected)"
msgstr ""
"nome de estado (opcional): connecting, waiting_auth, connected, auth_failed, "
"disconnected"
diff --git a/po/pt_BR.po b/po/pt_BR.po
index ee8ebb292..91498f150 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2018-06-14 21:40+0200\n"
+"POT-Creation-Date: 2018-06-14 21:51+0200\n"
"PO-Revision-Date: 2018-03-31 15:37+0200\n"
"Last-Translator: Eduardo Elias <camponez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -10803,8 +10803,9 @@ msgstr "numero de clientes para o relay"
#. TRANSLATORS: please do not translate the status names, they must be used in English
msgid ""
-"status name (optional): connecting, waiting_auth, connected, auth_failed, "
-"disconnected"
+"protocol,status (both are optional, for each argument \"*\" means all; "
+"protocols: irc, weechat; statuses: connecting, waiting_auth, connected, "
+"auth_failed, disconnected)"
msgstr ""
msgid "list of relay clients"
diff --git a/po/ru.po b/po/ru.po
index b4703b534..95961b6c2 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2018-06-14 21:40+0200\n"
+"POT-Creation-Date: 2018-06-14 21:51+0200\n"
"PO-Revision-Date: 2018-03-31 15:37+0200\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -10379,8 +10379,9 @@ msgstr "Нет сервера.\n"
#. TRANSLATORS: please do not translate the status names, they must be used in English
msgid ""
-"status name (optional): connecting, waiting_auth, connected, auth_failed, "
-"disconnected"
+"protocol,status (both are optional, for each argument \"*\" means all; "
+"protocols: irc, weechat; statuses: connecting, waiting_auth, connected, "
+"auth_failed, disconnected)"
msgstr ""
#, fuzzy
diff --git a/po/tr.po b/po/tr.po
index cd546f9ee..6929d13dd 100644
--- a/po/tr.po
+++ b/po/tr.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2018-06-14 21:40+0200\n"
+"POT-Creation-Date: 2018-06-14 21:51+0200\n"
"PO-Revision-Date: 2017-06-26 23:33+0200\n"
"Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -9428,8 +9428,9 @@ msgstr ""
#. TRANSLATORS: please do not translate the status names, they must be used in English
msgid ""
-"status name (optional): connecting, waiting_auth, connected, auth_failed, "
-"disconnected"
+"protocol,status (both are optional, for each argument \"*\" means all; "
+"protocols: irc, weechat; statuses: connecting, waiting_auth, connected, "
+"auth_failed, disconnected)"
msgstr ""
msgid "list of relay clients"
diff --git a/po/weechat.pot b/po/weechat.pot
index bc29f9d24..a67687804 100644
--- a/po/weechat.pot
+++ b/po/weechat.pot
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2018-06-14 21:40+0200\n"
+"POT-Creation-Date: 2018-06-14 21:51+0200\n"
"PO-Revision-Date: 2014-08-16 10:27+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -9293,8 +9293,9 @@ msgstr ""
#. TRANSLATORS: please do not translate the status names, they must be used in English
msgid ""
-"status name (optional): connecting, waiting_auth, connected, auth_failed, "
-"disconnected"
+"protocol,status (both are optional, for each argument \"*\" means all; "
+"protocols: irc, weechat; statuses: connecting, waiting_auth, connected, "
+"auth_failed, disconnected)"
msgstr ""
msgid "list of relay clients"
diff --git a/src/plugins/relay/relay-info.c b/src/plugins/relay/relay-info.c
index d669d4af4..e6e0338d5 100644
--- a/src/plugins/relay/relay-info.c
+++ b/src/plugins/relay/relay-info.c
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
#include "../weechat-plugin.h"
#include "relay.h"
@@ -37,7 +38,9 @@ relay_info_info_relay_client_count_cb (const void *pointer, void *data,
const char *arguments)
{
static char str_count[32];
- int count, status;
+ const char *ptr_count;
+ char **items;
+ int count, protocol, status, num_items;
struct t_relay_client *ptr_client;
/* make C compiler happy */
@@ -45,25 +48,65 @@ relay_info_info_relay_client_count_cb (const void *pointer, void *data,
(void) data;
(void) info_name;
- str_count[0] = '\0';
- count = relay_client_count;
- if (arguments && arguments[0])
+ items = NULL;
+ ptr_count = NULL;
+ count = 0;
+ protocol = -1;
+ status = -1;
+
+ items = weechat_string_split (arguments, ",", 0, 0, &num_items);
+ if (num_items > 2)
+ goto end;
+
+ if (num_items == 1)
{
- status = relay_client_status_search (arguments);
- if (status < 0)
- return NULL;
- count = 0;
- for (ptr_client = relay_clients; ptr_client;
- ptr_client = ptr_client->next_client)
+ /* one argument: try to guess if it's a protocol or a status */
+ if (strcmp (items[0], "*") != 0)
{
- if ((int)ptr_client->status == status)
- count++;
+ protocol = relay_protocol_search (items[0]);
+ if (protocol < 0)
+ {
+ status = relay_client_status_search (items[0]);
+ if (status < 0)
+ goto end;
+ }
}
}
+ else if (num_items == 2)
+ {
+ /* two arguments: protocol,status */
+ if (strcmp (items[0], "*") != 0)
+ {
+ protocol = relay_protocol_search (items[0]);
+ if (protocol < 0)
+ goto end;
+ }
+ if (strcmp (items[1], "*") != 0)
+ {
+ status = relay_client_status_search (items[1]);
+ if (status < 0)
+ goto end;
+ }
+ }
+
+ for (ptr_client = relay_clients; ptr_client;
+ ptr_client = ptr_client->next_client)
+ {
+ if ((protocol >= 0) && ((int)ptr_client->protocol != protocol))
+ continue;
+ if ((status >= 0) && ((int)ptr_client->status != status))
+ continue;
+ count++;
+ }
+
snprintf (str_count, sizeof (str_count), "%d", count);
- return str_count;
+ ptr_count = str_count;
- return NULL;
+end:
+ if (items)
+ weechat_string_free_split (items);
+
+ return ptr_count;
}
/*
@@ -131,8 +174,9 @@ relay_info_init ()
"relay_client_count",
N_("number of clients for relay"),
/* TRANSLATORS: please do not translate the status names, they must be used in English */
- N_("status name (optional): connecting, waiting_auth, "
- "connected, auth_failed, disconnected"),
+ N_("protocol,status (both are optional, for each argument \"*\" "
+ "means all; protocols: irc, weechat; statuses: connecting, "
+ "waiting_auth, connected, auth_failed, disconnected)"),
&relay_info_info_relay_client_count_cb, NULL, NULL);
/* infolist hooks */