aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2014-08-05 23:26:30 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2014-08-05 23:26:30 +0200
commit5ed4e632a30bf33d540acd9858c6771465bfc5eb (patch)
tree60f18378cfa5972e7fcabf17a18f35c522ffeef2 /src
parenteab2d1765a2a88c17aed35469ff843030f02b550 (diff)
downloadxK-5ed4e632a30bf33d540acd9858c6771465bfc5eb.tar.gz
xK-5ed4e632a30bf33d540acd9858c6771465bfc5eb.tar.xz
xK-5ed4e632a30bf33d540acd9858c6771465bfc5eb.zip
kike: don't send channel messages back
Diffstat (limited to 'src')
-rw-r--r--src/kike.c16
1 files changed, 9 insertions, 7 deletions
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);