summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2020-01-12 17:03:16 +0100
committerSébastien Helleu <flashcode@flashtux.org>2020-01-12 17:03:16 +0100
commitb79cd6d54656b918a0fa84c3f307c59dbb89567d (patch)
tree4c939f52500c248d27d9b37f552afccc55c587f4 /src/plugins
parent1fac6fd404bebf042ca40f7cde083ca917d7d80e (diff)
downloadweechat-b79cd6d54656b918a0fa84c3f307c59dbb89567d.zip
relay: update buffers synchronization when buffers are renamed (closes #1428)
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/relay/weechat/relay-weechat-protocol.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/plugins/relay/weechat/relay-weechat-protocol.c b/src/plugins/relay/weechat/relay-weechat-protocol.c
index 82cb6ceb5..1d7452a8d 100644
--- a/src/plugins/relay/weechat/relay-weechat-protocol.c
+++ b/src/plugins/relay/weechat/relay-weechat-protocol.c
@@ -501,6 +501,8 @@ relay_weechat_protocol_signal_buffer_cb (const void *pointer, void *data,
struct t_gui_buffer *ptr_buffer;
struct t_relay_weechat_msg *msg;
char cmd_hdata[64], str_signal[128];
+ const char *ptr_old_full_name;
+ int *ptr_old_flags, flags;
/* make C compiler happy */
(void) data;
@@ -640,6 +642,27 @@ relay_weechat_protocol_signal_buffer_cb (const void *pointer, void *data,
if (!ptr_buffer)
return WEECHAT_RC_OK;
+ /* rename old buffer name if present in hashtable "buffers_sync" */
+ ptr_old_full_name = weechat_buffer_get_string (ptr_buffer,
+ "old_full_name");
+ if (ptr_old_full_name && ptr_old_full_name[0])
+ {
+ ptr_old_flags = weechat_hashtable_get (
+ RELAY_WEECHAT_DATA(ptr_client, buffers_sync),
+ ptr_old_full_name);
+ if (ptr_old_flags)
+ {
+ flags = *ptr_old_flags;
+ weechat_hashtable_remove (
+ RELAY_WEECHAT_DATA(ptr_client, buffers_sync),
+ ptr_old_full_name);
+ weechat_hashtable_set (
+ RELAY_WEECHAT_DATA(ptr_client, buffers_sync),
+ weechat_buffer_get_string (ptr_buffer, "full_name"),
+ &flags);
+ }
+ }
+
/* send signal only if sync with flag "buffers" or "buffer" */
if (relay_weechat_protocol_is_sync (ptr_client, ptr_buffer,
RELAY_WEECHAT_PROTOCOL_SYNC_BUFFERS |