relay: add filtering on protocol in info "relay_client_count" (issue #1206)

v2.8-utf8proc
Sébastien Helleu 2018-06-14 21:57:27 +02:00
parent da507ca85f
commit 744ded04bd
21 changed files with 129 additions and 65 deletions

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 | ソースコードの評価 | 実行するソースコード

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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;
}
}
snprintf (str_count, sizeof (str_count), "%d", count);
return str_count;
return NULL;
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);
ptr_count = str_count;
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 */