X-Git-Url: http://git.pk910.de/?p=ircu2.10.12-pk.git;a=blobdiff_plain;f=ircd%2Fsend.c;fp=ircd%2Fsend.c;h=ff8d1158b0f0b06e25fbdaae4c539c4b0d3c64a1;hp=828b518b4cb1565bca4e1619070ca10862140e75;hb=923424fa8bb6557bfeba194a583c3a8daad023ed;hpb=3c606acaad5d1b78a3c6a2a5ab6bfd18ce1145da diff --git a/ircd/send.c b/ircd/send.c index 828b518..ff8d115 100644 --- a/ircd/send.c +++ b/ircd/send.c @@ -514,6 +514,60 @@ void sendcmdto_common_channels_butone(struct Client *from, const char *cmd, msgq_clean(mb); } +/** Send a (prefixed) command to all channels that \a from is on. (Check audit) + * @param[in] from Client originating the command. + * @param[in] cmd Long name of command. + * @param[in] tok Short name of command. + * @param[in] one Client direction to skip (or NULL). + * @param[in] pattern Format string for command arguments. + */ +void sendcmdto_common_channels_butone_audit(struct Client *from, const char *cmd, + const char *tok, struct Client *one, + const char *pattern, ...) +{ + struct VarData vd; + struct MsgBuf *mb; + struct Membership *chan; + struct Membership *member; + + assert(0 != from); + assert(0 != cli_from(from)); + assert(0 != pattern); + assert(!IsServer(from) && !IsMe(from)); + + vd.vd_format = pattern; /* set up the struct VarData for %v */ + + va_start(vd.vd_args, pattern); + + /* build the buffer */ + mb = msgq_make(0, "%:#C %s %v", from, cmd, &vd); + va_end(vd.vd_args); + + bump_sentalong(from); + /* + * loop through from's channels, and the members on their channels + */ + for (chan = cli_user(from)->channel; chan; chan = chan->next_channel) { + if (IsZombie(chan) || IsDelayedJoin(chan)) + continue; + for (member = chan->channel->members; member; + member = member->next_member) + if (MyConnect(member->user) + && -1 < cli_fd(cli_from(member->user)) + && member->user != one + && cli_sentalong(member->user) != sentalong_marker + && (!(chan->channel->mode.mode & MODE_AUDITORIUM) || IsVoicedOrOpped(chan) || IsChanOp(member))) { + cli_sentalong(member->user) = sentalong_marker; + send_buffer(member->user, mb, 0); + } + } + + if (MyConnect(from) && from != one) + send_buffer(from, mb, 0); + + msgq_clean(mb); +} + /** Send a (prefixed) command to all local users on a channel. * @param[in] from Client originating the command. * @param[in] cmd Long name of command.