diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2023-12-24 16:27:51 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2023-12-24 16:27:51 +0100 |
commit | 77002288234d0255f5f92065b0ece8c9f3b65e3d (patch) | |
tree | cfbe9038ba6d0c885ce9f96a9ea2642107b0555d /src | |
parent | 76a3f85831b3a470cee65e4a12af779f9a141b8a (diff) | |
download | weechat-77002288234d0255f5f92065b0ece8c9f3b65e3d.zip |
relay: move function to check if buffer belongs to relay
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/relay/relay-buffer.c | 15 | ||||
-rw-r--r-- | src/plugins/relay/relay-buffer.h | 1 | ||||
-rw-r--r-- | src/plugins/relay/weechat/relay-weechat-protocol.c | 19 |
3 files changed, 18 insertions, 17 deletions
diff --git a/src/plugins/relay/relay-buffer.c b/src/plugins/relay/relay-buffer.c index 191f076cf..8efbc6660 100644 --- a/src/plugins/relay/relay-buffer.c +++ b/src/plugins/relay/relay-buffer.c @@ -37,6 +37,21 @@ int relay_buffer_selected_line = 0; /* + * Checks if the buffer pointer is a relay buffer (relay raw/list). + * + * Returns: + * 1: buffer is a relay buffer (raw/list) + * 0: buffer is NOT a relay buffer + */ + +int +relay_buffer_is_relay (struct t_gui_buffer *buffer) +{ + return ((relay_raw_buffer && (buffer == relay_raw_buffer)) + || (relay_buffer && (buffer == relay_buffer))) ? 1 : 0; +} + +/* * Updates a client in buffer and updates hotlist for relay buffer. */ diff --git a/src/plugins/relay/relay-buffer.h b/src/plugins/relay/relay-buffer.h index a3187cbc3..493e66942 100644 --- a/src/plugins/relay/relay-buffer.h +++ b/src/plugins/relay/relay-buffer.h @@ -25,6 +25,7 @@ extern struct t_gui_buffer *relay_buffer; extern int relay_buffer_selected_line; +extern int relay_buffer_is_relay (struct t_gui_buffer *buffer); extern void relay_buffer_refresh (const char *hotlist); extern int relay_buffer_input_cb (const void *pointer, void *data, struct t_gui_buffer *buffer, diff --git a/src/plugins/relay/weechat/relay-weechat-protocol.c b/src/plugins/relay/weechat/relay-weechat-protocol.c index e27c6308d..4966f19ae 100644 --- a/src/plugins/relay/weechat/relay-weechat-protocol.c +++ b/src/plugins/relay/weechat/relay-weechat-protocol.c @@ -37,21 +37,6 @@ /* - * Checks if the buffer pointer is a relay buffer (relay raw/list). - * - * Returns: - * 1: buffer is a relay buffer (raw/list) - * 0: buffer is NOT a relay buffer - */ - -int -relay_weechat_is_relay_buffer (struct t_gui_buffer *buffer) -{ - return ((relay_raw_buffer && (buffer == relay_raw_buffer)) - || (relay_buffer && (buffer == relay_buffer))) ? 1 : 0; -} - -/* * Gets buffer pointer with argument from a command. * * The argument "arg" can be a pointer ("0x12345678") or a full name @@ -1106,7 +1091,7 @@ relay_weechat_protocol_signal_buffer_cb (const void *pointer, void *data, else if (strcmp (signal, "buffer_cleared") == 0) { ptr_buffer = (struct t_gui_buffer *)signal_data; - if (!ptr_buffer || relay_weechat_is_relay_buffer (ptr_buffer)) + if (!ptr_buffer || relay_buffer_is_relay (ptr_buffer)) return WEECHAT_RC_OK; /* send signal only if sync with flag "buffer" */ @@ -1145,7 +1130,7 @@ relay_weechat_protocol_signal_buffer_cb (const void *pointer, void *data, ptr_buffer = weechat_hdata_pointer (ptr_hdata_line_data, ptr_line_data, "buffer"); - if (!ptr_buffer || relay_weechat_is_relay_buffer (ptr_buffer)) + if (!ptr_buffer || relay_buffer_is_relay (ptr_buffer)) return WEECHAT_RC_OK; /* send signal only if sync with flag "buffer" */ |