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
1 changed files with 9 additions and 7 deletions

View File

@ -1232,11 +1232,13 @@ irc_handle_version (const struct irc_message *msg, struct client *c)
} }
static void 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) for (struct channel_user *iter = chan->users; iter; iter = iter->next)
{ {
struct client *c = str_map_find (&chan->ctx->users, iter->nickname); struct client *c = str_map_find (&chan->ctx->users, iter->nickname);
if (c != except)
irc_send (c, "%s", message); 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", char *message = xstrdup_printf (":%s!%s@%s %s %s :%s",
c->nickname, c->username, c->hostname, command, target, text); c->nickname, c->username, c->hostname, command, target, text);
irc_channel_multicast (chan, message); irc_channel_multicast (chan, message, c);
free (message); free (message);
return; 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", char *message = xstrdup_printf (":%s!%s@%s TOPIC %s :%s",
c->nickname, c->username, c->hostname, target, chan->topic); c->nickname, c->username, c->hostname, target, chan->topic);
irc_channel_multicast (chan, message); irc_channel_multicast (chan, message, NULL);
free (message); 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", char *message = xstrdup_printf (":%s!%s@%s PART %s :%s",
c->nickname, c->username, c->hostname, channel_name, reason); c->nickname, c->username, c->hostname, channel_name, reason);
if (!(chan->modes & IRC_CHAN_MODE_QUIET)) if (!(chan->modes & IRC_CHAN_MODE_QUIET))
irc_channel_multicast (chan, message); irc_channel_multicast (chan, message, NULL);
else else
irc_send (c, "%s", message); irc_send (c, "%s", message);
free (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", char *message = xstrdup_printf (":%s!%s@%s KICK %s %s :%s",
c->nickname, c->username, c->hostname, channel_name, nick, reason); c->nickname, c->username, c->hostname, channel_name, nick, reason);
if (!(chan->modes & IRC_CHAN_MODE_QUIET)) if (!(chan->modes & IRC_CHAN_MODE_QUIET))
irc_channel_multicast (chan, message); irc_channel_multicast (chan, message, NULL);
else else
irc_send (c, "%s", message); irc_send (c, "%s", message);
free (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", char *message = xstrdup_printf (":%s!%s@%s JOIN %s",
c->nickname, c->username, c->hostname, channel_name); c->nickname, c->username, c->hostname, channel_name);
if (!(chan->modes & IRC_CHAN_MODE_QUIET)) if (!(chan->modes & IRC_CHAN_MODE_QUIET))
irc_channel_multicast (chan, message); irc_channel_multicast (chan, message, NULL);
else else
irc_send (c, "%s", message); irc_send (c, "%s", message);
free (message); free (message);