summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2024-03-26 08:04:49 +0100
committerSébastien Helleu <flashcode@flashtux.org>2024-03-26 08:04:49 +0100
commit2f5936bc9f8e297792a663d153267d1a6821107b (patch)
tree18c72d569ff93be60ca4bd6d4e56f5975a4fbc23
parent3db4dd27904e87ca2fd7a4d81bd4842115d6b6b6 (diff)
downloadweechat-2f5936bc9f8e297792a663d153267d1a6821107b.zip
relay: set the last IRC client disconnection time only after a successful connection (closes #2103)
-rw-r--r--ChangeLog.adoc1
-rw-r--r--src/plugins/relay/relay-client.c16
2 files changed, 14 insertions, 3 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc
index 3cb6a8c18..48a976f20 100644
--- a/ChangeLog.adoc
+++ b/ChangeLog.adoc
@@ -58,6 +58,7 @@ Bug fixes::
* irc: fix random date displayed when a received message contains tags but no "time" (issue #2064)
* lua: fix freeze on call to "debug.debug" (issue #1906, issue #1907)
* python: fix truncation of unsigned long long integer returned by function string_parse_size
+ * relay: set the last IRC client disconnection time only after a successful connection (issue #2103)
* script: always display list of scripts when searching scripts with `/script search` (issue #2077)
* script: fix default mouse keys (issue #2076)
* scripts: fix crash on script unload when a hook is created in a buffer close callback (issue #2067)
diff --git a/src/plugins/relay/relay-client.c b/src/plugins/relay/relay-client.c
index 84078a577..dc510e32a 100644
--- a/src/plugins/relay/relay-client.c
+++ b/src/plugins/relay/relay-client.c
@@ -1795,6 +1795,9 @@ relay_client_set_status (struct t_relay_client *client,
enum t_relay_status status)
{
struct t_relay_server *ptr_server;
+ int old_status;
+
+ old_status = client->status;
/*
* IMPORTANT: if changes are made in this function or sub-functions called,
@@ -1820,9 +1823,16 @@ relay_client_set_status (struct t_relay_client *client,
{
client->end_time = time (NULL);
- ptr_server = relay_server_search (client->protocol_string);
- if (ptr_server)
- ptr_server->last_client_disconnect = client->end_time;
+ if (old_status == RELAY_STATUS_CONNECTED)
+ {
+ /*
+ * set the last client disconnect time
+ * (only if the client was connected)
+ */
+ ptr_server = relay_server_search (client->protocol_string);
+ if (ptr_server)
+ ptr_server->last_client_disconnect = client->end_time;
+ }
relay_client_outqueue_free_all (client);