msgq_clean(mb);
}
+/**
+ * Send a (prefixed) command to all servers matching or not matching a
+ * flag but one.
+ * @param[in] from Client sending the command.
+ * @param[in] cmd Long name of command (ignored).
+ * @param[in] tok Short name of command.
+ * @param[in] one Client direction to skip (or NULL).
+ * @param[in] require Only send to servers with this Flag bit set.
+ * @param[in] forbid Do not send to servers with this Flag bit set.
+ * @param[in] pattern Format string for command arguments.
+ */
+void sendcmdto_flag_serv_butone(struct Client *from, const char *cmd,
+ const char *tok, struct Client *one,
+ int require, int forbid,
+ const char *pattern, ...)
+{
+ struct VarData vd;
+ struct MsgBuf *mb;
+ struct DLink *lp;
+
+ vd.vd_format = pattern; /* set up the struct VarData for %v */
+ va_start(vd.vd_args, pattern);
+
+ /* use token */
+ mb = msgq_make(&me, "%C %s %v", from, tok, &vd);
+ va_end(vd.vd_args);
+
+ /* send it to our downlinks */
+ for (lp = cli_serv(&me)->down; lp; lp = lp->next) {
+ if (one && lp->value.cptr == cli_from(one))
+ continue;
+ if ((require < FLAG_LAST_FLAG) && !HasFlag(lp->value.cptr, require))
+ continue;
+ if ((forbid < FLAG_LAST_FLAG) && HasFlag(lp->value.cptr, forbid))
+ continue;
+ send_buffer(lp->value.cptr, mb, 0);
+ }
+
+ msgq_clean(mb);
+}
+
/**
* Send a (prefixed) command to all servers but one.
* @param[in] from Client sending the command.
/** Send a (prefixed) command to all users on this channel, except for
* \a one and those matching \a skip.
+ * @warning \a pattern must not contain %v.
* @param[in] from Client originating the command.
* @param[in] cmd Long name of command.
* @param[in] tok Short name of command.
}
/** Send a (prefixed) WALL of type \a type to all users except \a one.
+ * @warning \a pattern must not contain %v.
* @param[in] from Source of the command.
* @param[in] type One of WALL_DESYNCH, WALL_WALLOPS or WALL_WALLUSERS.
* @param[in] one Client direction to skip (or NULL).
struct DLink *lp;
char *prefix=NULL;
char *tok=NULL;
+ int his_wallops;
int i;
vd.vd_format = pattern;
va_end(vd.vd_args);
/* send buffer along! */
+ his_wallops = feature_bool(FEAT_HIS_WALLOPS);
for (i = 0; i <= HighestFd; i++)
{
if (!(cptr = LocalClientArray[i]) ||
(cli_fd(cli_from(cptr)) < 0) ||
- (type == WALL_DESYNCH && !HasFlag(cptr, FLAG_DEBUG)) ||
+ (type == WALL_DESYNCH && !SendDebug(cptr)) ||
(type == WALL_WALLOPS &&
- (!HasFlag(cptr, FLAG_WALLOP) || (feature_bool(FEAT_HIS_WALLOPS) &&
- !IsAnOper(cptr)))) ||
- (type == WALL_WALLUSERS && !HasFlag(cptr, FLAG_WALLOP)))
+ (!SendWallops(cptr) || (his_wallops && !IsAnOper(cptr)))) ||
+ (type == WALL_WALLUSERS && !SendWallops(cptr)))
continue; /* skip it */
send_buffer(cptr, mb, 1);
}
}
/** Send a (prefixed) command to all users matching \a to as \a who.
+ * @warning \a pattern must not contain %v.
* @param[in] from Source of the command.
* @param[in] cmd Long name of command.
* @param[in] tok Short name of command.
/* send buffer along */
bump_sentalong(one);
for (cptr = GlobalClientList; cptr; cptr = cli_next(cptr)) {
- if (!IsRegistered(cptr) || IsServer(cptr) ||
- !match_it(from, cptr, to, who) || cli_fd(cli_from(cptr)) < 0 ||
- cli_sentalong(cptr) == sentalong_marker)
+ if (!IsRegistered(cptr) || IsServer(cptr) || cli_fd(cli_from(cptr)) < 0 ||
+ cli_sentalong(cptr) == sentalong_marker ||
+ !match_it(from, cptr, to, who))
continue; /* skip it */
cli_sentalong(cptr) = sentalong_marker;