summaryrefslogtreecommitdiff
path: root/src/plugins/relay/irc
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2013-01-11 10:30:44 +0100
committerSebastien Helleu <flashcode@flashtux.org>2013-01-11 10:30:44 +0100
commit57024ab1e4271f232c481ffdf0fea7736c7a9220 (patch)
tree1a52a93b2e48686c8f85184e3f540068b4103dff /src/plugins/relay/irc
parentca205ccb8c4771c5ff13dddf6770f98714c1f22a (diff)
downloadweechat-57024ab1e4271f232c481ffdf0fea7736c7a9220.zip
relay: fix duplicated messages sent to irc clients (when messages are redirected) (bug #37870)
Diffstat (limited to 'src/plugins/relay/irc')
-rw-r--r--src/plugins/relay/irc/relay-irc.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/plugins/relay/irc/relay-irc.c b/src/plugins/relay/irc/relay-irc.c
index 53d40103f..5534a6e5e 100644
--- a/src/plugins/relay/irc/relay-irc.c
+++ b/src/plugins/relay/irc/relay-irc.c
@@ -519,21 +519,34 @@ int
relay_irc_hsignal_irc_redir_cb (void *data, const char *signal,
struct t_hashtable *hashtable)
{
+ struct t_relay_client *client;
int rc, client_id, num_messages, i;
char pattern[128], **messages;
const char *output;
- struct t_relay_client *ptr_client;
- /* make C compiler happy */
- (void) data;
+ client = (struct t_relay_client *)data;
+
+ if (weechat_relay_plugin->debug >= 2)
+ {
+ weechat_printf (NULL, "%s: %s: client: %s%s%s",
+ RELAY_PLUGIN_NAME,
+ signal,
+ RELAY_COLOR_CHAT_CLIENT,
+ client->desc,
+ RELAY_COLOR_CHAT);
+ }
rc = sscanf (signal, "irc_redirection_relay_%d_%s",
&client_id, pattern);
if (rc != 2)
return WEECHAT_RC_OK;
- ptr_client = relay_client_search_by_id (client_id);
- if (!ptr_client)
+ /* check that client id found in signal exists */
+ if (!relay_client_search_by_id (client_id))
+ return WEECHAT_RC_OK;
+
+ /* ignore redirection if it is for another relay client */
+ if (client->id != client_id)
return WEECHAT_RC_OK;
output = weechat_hashtable_get (hashtable, "output");
@@ -545,7 +558,7 @@ relay_irc_hsignal_irc_redir_cb (void *data, const char *signal,
{
for (i = 0; i < num_messages; i++)
{
- relay_irc_sendf (ptr_client, messages[i]);
+ relay_irc_sendf (client, messages[i]);
}
weechat_string_free_split (messages);
}
@@ -1176,7 +1189,7 @@ relay_irc_hook_signals (struct t_relay_client *client)
RELAY_IRC_DATA(client, hook_hsignal_irc_redir) =
weechat_hook_hsignal ("irc_redirection_relay_*",
&relay_irc_hsignal_irc_redir_cb,
- NULL);
+ client);
}
/*