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
master
Sébastien Helleu 2020-04-12 17:46:46 +02:00
parent 07505bb53c
commit 7ddc815726
20 changed files with 197 additions and 66 deletions

View File

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

View File

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

View File

@ -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,18 +12645,22 @@ 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
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"

View File

@ -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,17 +11072,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: 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
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"

View File

@ -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,17 +12375,21 @@ 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"

View File

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

View File

@ -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,17 +11267,21 @@ 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
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"

View File

@ -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,18 +11881,22 @@ 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
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 との認証に失敗"

View File

@ -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,18 +12098,22 @@ 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
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"

View File

@ -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,17 +11700,21 @@ 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
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"

View File

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

View File

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

View File

@ -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,17 +9213,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 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
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 ""

View File

@ -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,17 +9074,21 @@ 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
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 ""

View File

@ -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);
}
@ -1903,6 +1904,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.
*/

View File

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

View File

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

View File

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

View File

@ -266,6 +266,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.
*/

View File

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