diff --git a/CHANGELOG.md b/CHANGELOG.md index 828ad81f7..e2f47bae1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,6 +69,7 @@ - relay/api: fix read of one buffer line - relay/api: automatically disconnect when the command `/upgrade` is executed on the remote - relay/api: disconnect from remote in case of error when sending data +- relay/api: disconnect cleanly when the remote is quitting ([#2168](https://github.com/weechat/weechat/issues/2168)) - relay: fix websocket permessage-deflate extension when the client doesn't send the max window bits parameters ([#1549](https://github.com/weechat/weechat/issues/1549)) - relay: fix allocation and reinit of field "client_context_takeover" in websocket deflate structure ([#1549](https://github.com/weechat/weechat/issues/1549)) - spell: improve error displayed when a word can not be added to the dictionary ([#2144](https://github.com/weechat/weechat/issues/2144)) diff --git a/src/plugins/relay/api/remote/relay-remote-event.c b/src/plugins/relay/api/remote/relay-remote-event.c index dc9e4c410..927f6340c 100644 --- a/src/plugins/relay/api/remote/relay-remote-event.c +++ b/src/plugins/relay/api/remote/relay-remote-event.c @@ -1170,6 +1170,16 @@ RELAY_REMOTE_EVENT_CALLBACK(upgrade) return WEECHAT_RC_OK; } +/* + * Callback for event "quit". + */ + +RELAY_REMOTE_EVENT_CALLBACK(quit) +{ + relay_remote_network_disconnect (event->remote); + return WEECHAT_RC_OK; +} + /* * Synchronizes with remote. */ @@ -1227,6 +1237,7 @@ relay_remote_event_recv (struct t_relay_remote *remote, const char *data) { "nicklist_group_*", &relay_remote_event_cb_nick_group }, { "nicklist_nick_*", &relay_remote_event_cb_nick }, { "upgrade*", &relay_remote_event_cb_upgrade }, + { "quit", &relay_remote_event_cb_quit }, { NULL, NULL }, }; t_relay_remote_event_func *callback; diff --git a/tests/unit/plugins/relay/api/remote/test-relay-remote-event.cpp b/tests/unit/plugins/relay/api/remote/test-relay-remote-event.cpp index 7f1b3ae0c..21f6e2859 100644 --- a/tests/unit/plugins/relay/api/remote/test-relay-remote-event.cpp +++ b/tests/unit/plugins/relay/api/remote/test-relay-remote-event.cpp @@ -255,6 +255,26 @@ TEST(RelayRemoteEvent, CbVersion) /* TODO: write tests */ } +/* + * Tests functions: + * relay_remote_event_cb_upgrade + */ + +TEST(RelayRemoteEvent, CbUpgrade) +{ + /* TODO: write tests */ +} + +/* + * Tests functions: + * relay_remote_event_cb_quit + */ + +TEST(RelayRemoteEvent, CbQuit) +{ + /* TODO: write tests */ +} + /* * Tests functions: * relay_remote_event_sync_with_remote