From 5ed4e632a30bf33d540acd9858c6771465bfc5eb Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Tue, 5 Aug 2014 23:26:30 +0200
Subject: kike: don't send channel messages back
---
src/kike.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
(limited to 'src')
diff --git a/src/kike.c b/src/kike.c
index a4be70f..ee72f8d 100644
--- a/src/kike.c
+++ b/src/kike.c
@@ -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);
--
cgit v1.2.3-70-g09d2