kike: don't send channel messages back

This commit is contained in:
Přemysl Eric Janouch 2014-08-05 23:26:30 +02:00
parent eab2d1765a
commit 5ed4e632a3

View File

@ -1232,12 +1232,14 @@ irc_handle_version (const struct irc_message *msg, struct client *c)
}
static void
irc_channel_multicast (struct channel *chan, const char *message)
irc_channel_multicast (struct channel *chan, const char *message,
struct client *except)
{
for (struct channel_user *iter = chan->users; iter; iter = iter->next)
{
struct client *c = str_map_find (&chan->ctx->users, iter->nickname);
irc_send (c, "%s", message);
if (c != except)
irc_send (c, "%s", message);
}
}
@ -1349,7 +1351,7 @@ irc_handle_user_message (const struct irc_message *msg, struct client *c,
char *message = xstrdup_printf (":%s!%s@%s %s %s :%s",
c->nickname, c->username, c->hostname, command, target, text);
irc_channel_multicast (chan, message);
irc_channel_multicast (chan, message, c);
free (message);
return;
}
@ -1714,7 +1716,7 @@ irc_handle_topic (const struct irc_message *msg, struct client *c)
char *message = xstrdup_printf (":%s!%s@%s TOPIC %s :%s",
c->nickname, c->username, c->hostname, target, chan->topic);
irc_channel_multicast (chan, message);
irc_channel_multicast (chan, message, NULL);
free (message);
}
@ -1735,7 +1737,7 @@ irc_try_part (struct client *c, const char *channel_name, const char *reason)
char *message = xstrdup_printf (":%s!%s@%s PART %s :%s",
c->nickname, c->username, c->hostname, channel_name, reason);
if (!(chan->modes & IRC_CHAN_MODE_QUIET))
irc_channel_multicast (chan, message);
irc_channel_multicast (chan, message, NULL);
else
irc_send (c, "%s", message);
free (message);
@ -1797,7 +1799,7 @@ irc_try_kick (struct client *c, const char *channel_name, const char *nick,
char *message = xstrdup_printf (":%s!%s@%s KICK %s %s :%s",
c->nickname, c->username, c->hostname, channel_name, nick, reason);
if (!(chan->modes & IRC_CHAN_MODE_QUIET))
irc_channel_multicast (chan, message);
irc_channel_multicast (chan, message, NULL);
else
irc_send (c, "%s", message);
free (message);
@ -1867,7 +1869,7 @@ irc_try_join (struct client *c, const char *channel_name, const char *key)
char *message = xstrdup_printf (":%s!%s@%s JOIN %s",
c->nickname, c->username, c->hostname, channel_name);
if (!(chan->modes & IRC_CHAN_MODE_QUIET))
irc_channel_multicast (chan, message);
irc_channel_multicast (chan, message, NULL);
else
irc_send (c, "%s", message);
free (message);