diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2020-04-12 17:46:46 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2020-04-12 17:46:46 +0200 |
commit | 7ddc815726da0f471cbd92896da383bc8bed81f4 (patch) | |
tree | 1f55443f261d3c4834705a6b9e3f8bd721267a80 | |
parent | 07505bb53cbb7c159eaeb52699121903f3001602 (diff) | |
download | weechat-7ddc815726da0f471cbd92896da383bc8bed81f4.zip |
relay: actually use the client status "waiting_auth" in irc and weechat protocols (closes #1358)
Now the status "waiting_auth" is used and displayed in the relay buffer.
When a client connects, there are now 2 messages (except for irc protocol if
there's no password required):
relay: new client on port 9000: 1/weechat/1.2.3.4 (waiting auth)
relay: client 1/weechat/1.2.3.4 authenticated
If the authentication fails, the messages are:
relay: new client on port 9000: 1/weechat/1.2.3.4 (waiting auth)
=!= relay: authentication failed with client 1/weechat/1.2.3.4
-rw-r--r-- | ChangeLog.adoc | 1 | ||||
-rw-r--r-- | po/cs.po | 10 | ||||
-rw-r--r-- | po/de.po | 14 | ||||
-rw-r--r-- | po/es.po | 10 | ||||
-rw-r--r-- | po/fr.po | 16 | ||||
-rw-r--r-- | po/hu.po | 10 | ||||
-rw-r--r-- | po/it.po | 10 | ||||
-rw-r--r-- | po/ja.po | 14 | ||||
-rw-r--r-- | po/pl.po | 14 | ||||
-rw-r--r-- | po/pt.po | 10 | ||||
-rw-r--r-- | po/pt_BR.po | 10 | ||||
-rw-r--r-- | po/ru.po | 10 | ||||
-rw-r--r-- | po/tr.po | 10 | ||||
-rw-r--r-- | po/weechat.pot | 10 | ||||
-rw-r--r-- | src/plugins/relay/irc/relay-irc.c | 13 | ||||
-rw-r--r-- | src/plugins/relay/irc/relay-irc.h | 2 | ||||
-rw-r--r-- | src/plugins/relay/relay-client.c | 81 | ||||
-rw-r--r-- | src/plugins/relay/weechat/relay-weechat-protocol.c | 1 | ||||
-rw-r--r-- | src/plugins/relay/weechat/relay-weechat.c | 15 | ||||
-rw-r--r-- | src/plugins/relay/weechat/relay-weechat.h | 2 |
20 files changed, 197 insertions, 66 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 8328d5323..c5f29afd1 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -29,6 +29,7 @@ Bug fixes:: * core: fix memory leak in calculation of expression on FreeBSD (issue #1469) * core: fix resize of a bar when its size is 0 (automatic) (issue #1470) * python: fix crash when invalid UTF-8 string is in a WeeChat hashtable converted to a Python dict (issue #1463) + * relay: actually use the client status "waiting_auth" in irc and weechat protocols (issue #1358) Documentation:: @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2020-04-12 08:46+0200\n" +"POT-Creation-Date: 2020-04-12 17:27+0200\n" "PO-Revision-Date: 2020-03-08 14:22+0100\n" "Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -10743,17 +10743,21 @@ msgstr "" "ssl_cert_key)" #, fuzzy, c-format -msgid "%s: new client on path %s: %s%s%s" +msgid "%s: new client on path %s: %s%s%s (%s)" msgstr "%s%s: nedostatek paměti pro poslouchání na portu" #, fuzzy, c-format -msgid "%s: new client on port %s: %s%s%s" +msgid "%s: new client on port %s: %s%s%s (%s)" msgstr "%s%s: nedostatek paměti pro poslouchání na portu" #, c-format msgid "%s%s: not enough memory for new client" msgstr "%s%s: nedostatek paměti pro nového klienta" +#, c-format +msgid "%s: client %s%s%s authenticated" +msgstr "" + #, fuzzy, c-format msgid "%s%s: authentication failed with client %s%s%s" msgstr "%s%s: schopnost klienta, server podporuje: %s" @@ -24,7 +24,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2020-04-12 08:46+0200\n" +"POT-Creation-Date: 2020-04-12 17:27+0200\n" "PO-Revision-Date: 2020-04-03 20:03+0200\n" "Last-Translator: Nils Görs <weechatter@arcor.de>\n" "Language-Team: German <kde-i18n-de@kde.org>\n" @@ -12645,12 +12645,12 @@ msgstr "" "%s%s: Warnung: kein SSL Zertifikat/Schlüssel gefunden (Einstellung relay." "network.ssl_cert_key)" -#, c-format -msgid "%s: new client on path %s: %s%s%s" +#, fuzzy, c-format +msgid "%s: new client on path %s: %s%s%s (%s)" msgstr "%s: neuer Client auf Pfad %s: %s%s%s" -#, c-format -msgid "%s: new client on port %s: %s%s%s" +#, fuzzy, c-format +msgid "%s: new client on port %s: %s%s%s (%s)" msgstr "%s: neuer Client an Port %s: %s%s%s" #, c-format @@ -12658,6 +12658,10 @@ msgid "%s%s: not enough memory for new client" msgstr "%s%s: Nicht genug Speicher für neuen Client" #, c-format +msgid "%s: client %s%s%s authenticated" +msgstr "" + +#, c-format msgid "%s%s: authentication failed with client %s%s%s" msgstr "%s%s: Authentifizierung mit Client %s%s%s fehlgeschlagen" @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2020-04-12 08:46+0200\n" +"POT-Creation-Date: 2020-04-12 17:27+0200\n" "PO-Revision-Date: 2020-03-08 14:22+0100\n" "Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -11072,11 +11072,11 @@ msgid "" msgstr "" #, fuzzy, c-format -msgid "%s: new client on path %s: %s%s%s" +msgid "%s: new client on path %s: %s%s%s (%s)" msgstr "%s: nuevo cliente en puerto %d: %s%s%s" #, fuzzy, c-format -msgid "%s: new client on port %s: %s%s%s" +msgid "%s: new client on port %s: %s%s%s (%s)" msgstr "%s: nuevo cliente en puerto %d: %s%s%s" #, c-format @@ -11084,6 +11084,10 @@ msgid "%s%s: not enough memory for new client" msgstr "%s%s: no hay memoria suficiente para el nuevo cliente" #, c-format +msgid "%s: client %s%s%s authenticated" +msgstr "" + +#, c-format msgid "%s%s: authentication failed with client %s%s%s" msgstr "%s%s: la autenticación falló con el cliente %s%s%s" @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2020-04-12 08:46+0200\n" -"PO-Revision-Date: 2020-04-12 08:46+0200\n" +"POT-Creation-Date: 2020-04-12 17:27+0200\n" +"PO-Revision-Date: 2020-04-12 17:28+0200\n" "Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language: fr\n" @@ -12375,18 +12375,22 @@ msgstr "" "ssl_cert_key)" #, c-format -msgid "%s: new client on path %s: %s%s%s" -msgstr "%s : nouveau client sur le chemin %s : %s%s%s" +msgid "%s: new client on path %s: %s%s%s (%s)" +msgstr "%s : nouveau client sur le chemin %s : %s%s%s (%s)" #, c-format -msgid "%s: new client on port %s: %s%s%s" -msgstr "%s : nouveau client sur le port %s : %s%s%s" +msgid "%s: new client on port %s: %s%s%s (%s)" +msgstr "%s : nouveau client sur le port %s : %s%s%s (%s)" #, c-format msgid "%s%s: not enough memory for new client" msgstr "%s%s : pas assez de mémoire pour un nouveau client" #, c-format +msgid "%s: client %s%s%s authenticated" +msgstr "%s : client %s%s%s authentifié" + +#, c-format msgid "%s%s: authentication failed with client %s%s%s" msgstr "%s%s : l'authentification a échoué avec le client %s%s%s" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2020-04-12 08:46+0200\n" +"POT-Creation-Date: 2020-04-12 17:27+0200\n" "PO-Revision-Date: 2020-03-08 14:22+0100\n" "Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -10106,17 +10106,21 @@ msgid "" msgstr "" #, fuzzy, c-format -msgid "%s: new client on path %s: %s%s%s" +msgid "%s: new client on path %s: %s%s%s (%s)" msgstr "%s nem sikerült a csatornát létrehozni\n" #, fuzzy, c-format -msgid "%s: new client on port %s: %s%s%s" +msgid "%s: new client on port %s: %s%s%s (%s)" msgstr "%s nem sikerült a csatornát létrehozni\n" #, fuzzy, c-format msgid "%s%s: not enough memory for new client" msgstr "%s nincs elegendő memória új DCC számára\n" +#, c-format +msgid "%s: client %s%s%s authenticated" +msgstr "" + #, fuzzy, c-format msgid "%s%s: authentication failed with client %s%s%s" msgstr "Nem sikerült a(z) \"%s\" naplófájlt írni\n" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2020-04-12 08:46+0200\n" +"POT-Creation-Date: 2020-04-12 17:27+0200\n" "PO-Revision-Date: 2020-03-08 14:22+0100\n" "Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -11267,11 +11267,11 @@ msgstr "" "network.ssl_cert_key)" #, fuzzy, c-format -msgid "%s: new client on path %s: %s%s%s" +msgid "%s: new client on path %s: %s%s%s (%s)" msgstr "%s: nuovo client sulla porta %d: %s%s%s" #, fuzzy, c-format -msgid "%s: new client on port %s: %s%s%s" +msgid "%s: new client on port %s: %s%s%s (%s)" msgstr "%s: nuovo client sulla porta %d: %s%s%s" #, c-format @@ -11279,6 +11279,10 @@ msgid "%s%s: not enough memory for new client" msgstr "%s%s: memoria insufficiente per il nuovo client" #, c-format +msgid "%s: client %s%s%s authenticated" +msgstr "" + +#, c-format msgid "%s%s: authentication failed with client %s%s%s" msgstr "%s%s: autenticazione con il client %s%s%s fallita" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2020-04-12 08:46+0200\n" +"POT-Creation-Date: 2020-04-12 17:27+0200\n" "PO-Revision-Date: 2020-03-08 14:22+0100\n" "Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n" "Language-Team: Japanese <https://github.com/l/weechat/tree/master/" @@ -11881,12 +11881,12 @@ msgstr "" "%s%s: 警告: SSL 証明書/鍵が見つかりません (オプション relay.network." "ssl_cert_key)" -#, c-format -msgid "%s: new client on path %s: %s%s%s" +#, fuzzy, c-format +msgid "%s: new client on path %s: %s%s%s (%s)" msgstr "%s: パス %s に新規クライアントが接続中: %s%s%s" -#, c-format -msgid "%s: new client on port %s: %s%s%s" +#, fuzzy, c-format +msgid "%s: new client on port %s: %s%s%s (%s)" msgstr "%s: ポート %s に新規クライアントが接続中: %s%s%s" #, c-format @@ -11894,6 +11894,10 @@ msgid "%s%s: not enough memory for new client" msgstr "%s%s: 新しいクライアント用のメモリ不足" #, c-format +msgid "%s: client %s%s%s authenticated" +msgstr "" + +#, c-format msgid "%s%s: authentication failed with client %s%s%s" msgstr "%s%s: クライアント %s%s%s との認証に失敗" @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2020-04-12 08:46+0200\n" +"POT-Creation-Date: 2020-04-12 17:27+0200\n" "PO-Revision-Date: 2020-04-05 13:44+0200\n" "Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n" "Language-Team: Polish <kde-i18n-doc@kde.org>\n" @@ -12098,12 +12098,12 @@ msgstr "" "%s%s: ostrzeżenie: nie znaleziono certyfikatu/klucza SSL (opcja relay." "network.ssl_cert_key)" -#, c-format -msgid "%s: new client on path %s: %s%s%s" +#, fuzzy, c-format +msgid "%s: new client on path %s: %s%s%s (%s)" msgstr "%s: nowy klient na ścieżce %s: %s%s%s" -#, c-format -msgid "%s: new client on port %s: %s%s%s" +#, fuzzy, c-format +msgid "%s: new client on port %s: %s%s%s (%s)" msgstr "%s: nowy klient na porcie %s: %s%s%s" #, c-format @@ -12111,6 +12111,10 @@ msgid "%s%s: not enough memory for new client" msgstr "%s%s: za mało pamięci dla nowego klienta" #, c-format +msgid "%s: client %s%s%s authenticated" +msgstr "" + +#, c-format msgid "%s%s: authentication failed with client %s%s%s" msgstr "%s%s: uwierzytelnianie nie powiodło się z klientem %s%s%s" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2020-04-12 08:46+0200\n" +"POT-Creation-Date: 2020-04-12 17:27+0200\n" "PO-Revision-Date: 2020-03-08 14:22+0100\n" "Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n" "Language-Team: Portuguese <>\n" @@ -11700,11 +11700,11 @@ msgstr "" "network.ssl_cert_key)" #, fuzzy, c-format -msgid "%s: new client on path %s: %s%s%s" +msgid "%s: new client on path %s: %s%s%s (%s)" msgstr "%s: novo cliente na porta %d: %s%s%s" #, fuzzy, c-format -msgid "%s: new client on port %s: %s%s%s" +msgid "%s: new client on port %s: %s%s%s (%s)" msgstr "%s: novo cliente na porta %d: %s%s%s" #, c-format @@ -11712,6 +11712,10 @@ msgid "%s%s: not enough memory for new client" msgstr "%s%s: memória insuficiente para o novo cliente" #, c-format +msgid "%s: client %s%s%s authenticated" +msgstr "" + +#, c-format msgid "%s%s: authentication failed with client %s%s%s" msgstr "%s%s: falha de autenticação com o cliente %s%s%s" diff --git a/po/pt_BR.po b/po/pt_BR.po index e80d7322b..143012ea4 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: 2020-04-12 08:46+0200\n" +"POT-Creation-Date: 2020-04-12 17:27+0200\n" "PO-Revision-Date: 2019-11-03 08:38+0100\n" "Last-Translator: Eduardo Elias <camponez@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -10555,17 +10555,21 @@ msgid "" msgstr "" #, fuzzy, c-format -msgid "%s: new client on path %s: %s%s%s" +msgid "%s: new client on path %s: %s%s%s (%s)" msgstr "%s%s: não foi possível aceitar o cliente na porta %d (%s.%s)" #, fuzzy, c-format -msgid "%s: new client on port %s: %s%s%s" +msgid "%s: new client on port %s: %s%s%s (%s)" msgstr "%s%s: não foi possível aceitar o cliente na porta %d (%s.%s)" #, c-format msgid "%s%s: not enough memory for new client" msgstr "%s%s: memória insuficiente para novo cliente" +#, c-format +msgid "%s: client %s%s%s authenticated" +msgstr "" + #, fuzzy, c-format msgid "%s%s: authentication failed with client %s%s%s" msgstr "%s%s: falha na autenticação com cliente %s%s%s (%s.%s)" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2020-04-12 08:46+0200\n" +"POT-Creation-Date: 2020-04-12 17:27+0200\n" "PO-Revision-Date: 2020-03-08 14:22+0100\n" "Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -10142,17 +10142,21 @@ msgid "" msgstr "" #, fuzzy, c-format -msgid "%s: new client on path %s: %s%s%s" +msgid "%s: new client on path %s: %s%s%s (%s)" msgstr "%s невозможно создать сокет\n" #, fuzzy, c-format -msgid "%s: new client on port %s: %s%s%s" +msgid "%s: new client on port %s: %s%s%s (%s)" msgstr "%s невозможно создать сокет\n" #, fuzzy, c-format msgid "%s%s: not enough memory for new client" msgstr "%s недостаточно памяти для нового DCC\n" +#, c-format +msgid "%s: client %s%s%s authenticated" +msgstr "" + #, fuzzy, c-format msgid "%s%s: authentication failed with client %s%s%s" msgstr "Не могу записать лог-файл \"%s\"\n" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2020-04-12 08:46+0200\n" +"POT-Creation-Date: 2020-04-12 17:27+0200\n" "PO-Revision-Date: 2019-11-03 08:38+0100\n" "Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -9213,11 +9213,11 @@ msgid "" msgstr "" #, fuzzy, c-format -msgid "%s: new client on path %s: %s%s%s" +msgid "%s: new client on path %s: %s%s%s (%s)" msgstr "%s Artık %s%s%s olarak biliniyorsunuz" #, fuzzy, c-format -msgid "%s: new client on port %s: %s%s%s" +msgid "%s: new client on port %s: %s%s%s (%s)" msgstr "%s hata: %s%s%s%s" #, c-format @@ -9225,6 +9225,10 @@ msgid "%s%s: not enough memory for new client" msgstr "" #, c-format +msgid "%s: client %s%s%s authenticated" +msgstr "" + +#, c-format msgid "%s%s: authentication failed with client %s%s%s" msgstr "" diff --git a/po/weechat.pot b/po/weechat.pot index 4bec51c0d..b49a191ea 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: 2020-04-12 08:46+0200\n" +"POT-Creation-Date: 2020-04-12 17:27+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" @@ -9074,11 +9074,11 @@ msgid "" msgstr "" #, c-format -msgid "%s: new client on path %s: %s%s%s" +msgid "%s: new client on path %s: %s%s%s (%s)" msgstr "" #, c-format -msgid "%s: new client on port %s: %s%s%s" +msgid "%s: new client on port %s: %s%s%s (%s)" msgstr "" #, c-format @@ -9086,6 +9086,10 @@ msgid "%s%s: not enough memory for new client" msgstr "" #, c-format +msgid "%s: client %s%s%s authenticated" +msgstr "" + +#, c-format msgid "%s%s: authentication failed with client %s%s%s" msgstr "" diff --git a/src/plugins/relay/irc/relay-irc.c b/src/plugins/relay/irc/relay-irc.c index fea36430c..81f493c78 100644 --- a/src/plugins/relay/irc/relay-irc.c +++ b/src/plugins/relay/irc/relay-irc.c @@ -1430,6 +1430,7 @@ relay_irc_recv (struct t_relay_client *client, const char *data) weechat_hook_signal_send ("relay_client_auth_ok", WEECHAT_HOOK_SIGNAL_POINTER, client); + relay_client_set_status (client, RELAY_STATUS_CONNECTED); } free (password); } @@ -1904,6 +1905,18 @@ relay_irc_alloc_with_infolist (struct t_relay_client *client, } /* + * Returns the client initial status: it can be "waiting_auth" or "connected", + * depending if a password is expected or not. + */ + +enum t_relay_status +relay_irc_get_initial_status (struct t_relay_client *client) +{ + return (RELAY_IRC_DATA(client, password_ok)) ? + RELAY_STATUS_CONNECTED : RELAY_STATUS_WAITING_AUTH; +} + +/* * Frees relay data specific to IRC protocol. */ diff --git a/src/plugins/relay/irc/relay-irc.h b/src/plugins/relay/irc/relay-irc.h index b0de0e786..095fc6691 100644 --- a/src/plugins/relay/irc/relay-irc.h +++ b/src/plugins/relay/irc/relay-irc.h @@ -21,6 +21,7 @@ #define WEECHAT_PLUGIN_RELAY_IRC_H struct t_relay_client; +enum t_relay_status; #define RELAY_IRC_DATA(client, var) \ (((struct t_relay_irc_data *)client->protocol_data)->var) @@ -69,6 +70,7 @@ extern void relay_irc_close_connection (struct t_relay_client *client); extern void relay_irc_alloc (struct t_relay_client *client); extern void relay_irc_alloc_with_infolist (struct t_relay_client *client, struct t_infolist *infolist); +extern enum t_relay_status relay_irc_get_initial_status (struct t_relay_client *client); extern void relay_irc_free (struct t_relay_client *client); extern int relay_irc_add_to_infolist (struct t_infolist_item *item, struct t_relay_client *client); diff --git a/src/plugins/relay/relay-client.c b/src/plugins/relay/relay-client.c index bc339254d..28c336220 100644 --- a/src/plugins/relay/relay-client.c +++ b/src/plugins/relay/relay-client.c @@ -253,7 +253,21 @@ relay_client_handshake_timer_cb (const void *pointer, void *data, weechat_unhook (client->hook_timer_handshake); client->hook_timer_handshake = NULL; client->gnutls_handshake_ok = 1; - relay_client_set_status (client, RELAY_STATUS_CONNECTED); + switch (client->protocol) + { + case RELAY_PROTOCOL_WEECHAT: + relay_client_set_status ( + client, + relay_weechat_get_initial_status (client)); + break; + case RELAY_PROTOCOL_IRC: + relay_client_set_status ( + client, + relay_irc_get_initial_status (client)); + break; + case RELAY_NUM_PROTOCOLS: + break; + } return WEECHAT_RC_OK; } @@ -577,8 +591,15 @@ relay_client_recv_cb (const void *pointer, void *data, int fd) client = (struct t_relay_client *)pointer; - if (client->status != RELAY_STATUS_CONNECTED) + /* + * data can be received only during authentication + * or if connected (authentication was OK) + */ + if ((client->status != RELAY_STATUS_WAITING_AUTH) + && (client->status != RELAY_STATUS_CONNECTED)) + { return WEECHAT_RC_OK; + } #ifdef HAVE_GNUTLS if (client->ssl) @@ -1248,7 +1269,7 @@ relay_client_new (int sock, const char *address, struct t_relay_server *server) new_client->address = strdup ((address && address[0]) ? address : "local"); new_client->real_ip = NULL; - new_client->status = RELAY_STATUS_CONNECTED; + new_client->status = RELAY_STATUS_CONNECTING; new_client->protocol = server->protocol; new_client->protocol_string = (server->protocol_string) ? strdup (server->protocol_string) : NULL; new_client->protocol_args = (server->protocol_args) ? strdup (server->protocol_args) : NULL; @@ -1336,9 +1357,19 @@ relay_client_new (int sock, const char *address, struct t_relay_server *server) { case RELAY_PROTOCOL_WEECHAT: relay_weechat_alloc (new_client); + if (!new_client->ssl) + { + new_client->status = + relay_weechat_get_initial_status (new_client); + } break; case RELAY_PROTOCOL_IRC: relay_irc_alloc (new_client); + if (!new_client->ssl) + { + new_client->status = + relay_irc_get_initial_status (new_client); + } break; case RELAY_NUM_PROTOCOLS: break; @@ -1357,23 +1388,27 @@ relay_client_new (int sock, const char *address, struct t_relay_server *server) if (server->unix_socket) { - weechat_printf_date_tags (NULL, 0, "relay_client", - _("%s: new client on path %s: %s%s%s"), - RELAY_PLUGIN_NAME, - server->path, - RELAY_COLOR_CHAT_CLIENT, - new_client->desc, - RELAY_COLOR_CHAT); + weechat_printf_date_tags ( + NULL, 0, "relay_client", + _("%s: new client on path %s: %s%s%s (%s)"), + RELAY_PLUGIN_NAME, + server->path, + RELAY_COLOR_CHAT_CLIENT, + new_client->desc, + RELAY_COLOR_CHAT, + _(relay_client_status_string[new_client->status])); } else { - weechat_printf_date_tags (NULL, 0, "relay_client", - _("%s: new client on port %s: %s%s%s"), - RELAY_PLUGIN_NAME, - server->path, - RELAY_COLOR_CHAT_CLIENT, - new_client->desc, - RELAY_COLOR_CHAT); + weechat_printf_date_tags ( + NULL, 0, "relay_client", + _("%s: new client on port %s: %s%s%s (%s)"), + RELAY_PLUGIN_NAME, + server->path, + RELAY_COLOR_CHAT_CLIENT, + new_client->desc, + RELAY_COLOR_CHAT, + _(relay_client_status_string[new_client->status])); } new_client->hook_fd = weechat_hook_fd (new_client->sock, @@ -1511,7 +1546,17 @@ relay_client_set_status (struct t_relay_client *client, client->status = status; - if (RELAY_CLIENT_HAS_ENDED(client)) + if (client->status == RELAY_STATUS_CONNECTED) + { + weechat_printf_date_tags ( + NULL, 0, "relay_client", + _("%s: client %s%s%s authenticated"), + RELAY_PLUGIN_NAME, + RELAY_COLOR_CHAT_CLIENT, + client->desc, + RELAY_COLOR_CHAT); + } + else if (RELAY_CLIENT_HAS_ENDED(client)) { client->end_time = time (NULL); diff --git a/src/plugins/relay/weechat/relay-weechat-protocol.c b/src/plugins/relay/weechat/relay-weechat-protocol.c index 0c897a6d3..205029f66 100644 --- a/src/plugins/relay/weechat/relay-weechat-protocol.c +++ b/src/plugins/relay/weechat/relay-weechat-protocol.c @@ -418,6 +418,7 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(init) weechat_hook_signal_send ("relay_client_auth_ok", WEECHAT_HOOK_SIGNAL_POINTER, client); + relay_client_set_status (client, RELAY_STATUS_CONNECTED); } else { diff --git a/src/plugins/relay/weechat/relay-weechat.c b/src/plugins/relay/weechat/relay-weechat.c index 5373bcb61..8f05c4872 100644 --- a/src/plugins/relay/weechat/relay-weechat.c +++ b/src/plugins/relay/weechat/relay-weechat.c @@ -267,6 +267,21 @@ relay_weechat_alloc_with_infolist (struct t_relay_client *client, } /* + * Returns the client initial status: it is always "waiting_auth" for weechat + * protocol because we always expect the "init" command, even without any + * password. + */ + +enum t_relay_status +relay_weechat_get_initial_status (struct t_relay_client *client) +{ + /* make C compiler happy */ + (void) client; + + return RELAY_STATUS_WAITING_AUTH; +} + +/* * Frees relay data specific to WeeChat protocol. */ diff --git a/src/plugins/relay/weechat/relay-weechat.h b/src/plugins/relay/weechat/relay-weechat.h index 11f4762f2..62f2fc40a 100644 --- a/src/plugins/relay/weechat/relay-weechat.h +++ b/src/plugins/relay/weechat/relay-weechat.h @@ -21,6 +21,7 @@ #define WEECHAT_PLUGIN_RELAY_WEECHAT_H struct t_relay_client; +enum t_relay_status; #define RELAY_WEECHAT_DATA(client, var) \ (((struct t_relay_weechat_data *)client->protocol_data)->var) @@ -62,6 +63,7 @@ extern void relay_weechat_close_connection (struct t_relay_client *client); extern void relay_weechat_alloc (struct t_relay_client *client); extern void relay_weechat_alloc_with_infolist (struct t_relay_client *client, struct t_infolist *infolist); +extern enum t_relay_status relay_weechat_get_initial_status (struct t_relay_client *client); extern void relay_weechat_free (struct t_relay_client *client); extern int relay_weechat_add_to_infolist (struct t_infolist_item *item, struct t_relay_client *client); |