mirror of
https://github.com/weechat/weechat.git
synced 2026-06-30 06:46:38 +02:00
relay/api: clear lines and nicklist on all remote buffers upon successful connection to the remote (closes #2161)
This commit is contained in:
@@ -60,6 +60,7 @@
|
||||
- relay/api: allow clients without authentication when no relay password is defined and option relay.network.allow_empty_password is on ([#2158](https://github.com/weechat/weechat/issues/2158))
|
||||
- relay/api: fix connection to remote without password ([#2158](https://github.com/weechat/weechat/issues/2158))
|
||||
- relay/api: fix timezone of dates sent to clients ([#2151](https://github.com/weechat/weechat/issues/2151))
|
||||
- relay/api: clear lines and nicklist on all remote buffers upon successful connection to the remote ([#2161](https://github.com/weechat/weechat/issues/2161))
|
||||
- relay/api: fix "body_type" returned when lines or nicks of a buffer are requested
|
||||
- relay/api: fix read of one buffer line
|
||||
- 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))
|
||||
|
||||
@@ -980,6 +980,32 @@ RELAY_REMOTE_EVENT_CALLBACK(input)
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Clears buffers lines/nicklist for a remote.
|
||||
*/
|
||||
|
||||
void
|
||||
relay_remote_event_clear_buffers (struct t_relay_remote *remote)
|
||||
{
|
||||
struct t_gui_buffer *ptr_buffer;
|
||||
const char *ptr_name;
|
||||
|
||||
if (!remote)
|
||||
return;
|
||||
|
||||
ptr_buffer = weechat_hdata_get_list (relay_hdata_buffer, "gui_buffers");
|
||||
while (ptr_buffer)
|
||||
{
|
||||
ptr_name = weechat_buffer_get_string (ptr_buffer, "localvar_relay_remote");
|
||||
if (ptr_name && (weechat_strcmp (ptr_name, remote->name) == 0))
|
||||
{
|
||||
weechat_buffer_clear (ptr_buffer);
|
||||
weechat_nicklist_remove_all (ptr_buffer);
|
||||
}
|
||||
ptr_buffer = weechat_hdata_move (relay_hdata_buffer, ptr_buffer, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Callback for response to GET /api/version.
|
||||
*/
|
||||
@@ -1025,7 +1051,7 @@ RELAY_REMOTE_EVENT_CALLBACK(version)
|
||||
relay_remote_network_disconnect (event->remote);
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
relay_remote_event_clear_buffers (event->remote);
|
||||
event->remote->version_ok = 1;
|
||||
snprintf (request, sizeof (request),
|
||||
"{\"request\": \"GET /api/buffers?"
|
||||
|
||||
@@ -225,6 +225,16 @@ TEST(RelayRemoteEvent, CbInput)
|
||||
/* TODO: write tests */
|
||||
}
|
||||
|
||||
/*
|
||||
* Tests functions:
|
||||
* relay_remote_event_clear_buffers
|
||||
*/
|
||||
|
||||
TEST(RelayRemoteEvent, ClearBuffers)
|
||||
{
|
||||
/* TODO: write tests */
|
||||
}
|
||||
|
||||
/*
|
||||
* Tests functions:
|
||||
* relay_remote_event_cb_version
|
||||
|
||||
Reference in New Issue
Block a user