1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-28 13:56:37 +02:00

relay: fix duplicated messages sent to irc clients (when messages are redirected) (bug #37870)

This commit is contained in:
Sebastien Helleu
2013-01-11 10:30:44 +01:00
parent ca205ccb8c
commit 57024ab1e4
2 changed files with 23 additions and 8 deletions
+3 -1
View File
@@ -1,7 +1,7 @@
WeeChat ChangeLog
=================
Sébastien Helleu <flashcode@flashtux.org>
v0.4.0-rc2, 2013-01-10
v0.4.0-rc2, 2013-01-11
Version 0.4.0 (under dev!)
@@ -106,6 +106,8 @@ Version 0.4.0 (under dev!)
* perl: display script filename in error messages
* perl: fix calls to callbacks during load of script when multiplicity is
disabled (bug #38044)
* relay: fix duplicated messages sent to irc clients (when messages are
redirected) (bug #37870)
* relay: fix memory leak when adding hdata to a message (weechat protocol)
* relay: add backlog and server capability "server-time" for irc protocol, add
new options relay.irc.backlog_max_minutes, relay.irc.backlog_max_number,
+20 -7
View File
@@ -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);
}
/*