X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=ircd%2Fircd_reply.c;h=256d18c5047c92f2ad5521eabca98ecce2f3b6f0;hb=refs%2Fheads%2Fupstream;hp=f4220ce74c087520289cc707c4e8f4baa3add3fe;hpb=56f512008e81aeae915b2b7f6bcdd54b549188d3;p=ircu2.10.12-pk.git diff --git a/ircd/ircd_reply.c b/ircd/ircd_reply.c index f4220ce..256d18c 100644 --- a/ircd/ircd_reply.c +++ b/ircd/ircd_reply.c @@ -19,14 +19,17 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id$ + */ +/** @file + * @brief Implementation of functions to send common replies to users. + * @version $Id$ */ #include "config.h" #include "ircd_reply.h" #include "client.h" #include "ircd.h" +#include "ircd_log.h" #include "ircd_snprintf.h" #include "msg.h" #include "msgq.h" @@ -35,36 +38,49 @@ #include "s_debug.h" #include "send.h" -#include +/* #include -- Now using assert in ircd_log.h */ #include -/* Report a protocol violation warning to anyone listening. This can be - * easily used to cleanup the last couple of parts of the code up. +/** Report a protocol violation warning to anyone listening. This can + * be easily used to clean up the last couple of parts of the code. + * @param[in] cptr Client that violated the protocol. + * @param[in] pattern Description of how the protocol was violated. + * @return Zero. */ - int protocol_violation(struct Client* cptr, const char* pattern, ...) { struct VarData vd; + char message[BUFSIZE]; assert(pattern); assert(cptr); vd.vd_format = pattern; va_start(vd.vd_args, pattern); - - sendcmdto_flag_butone(&me, CMD_DESYNCH, NULL, FLAGS_DEBUG, - ":Protocol Violation from %s: %v", cli_name(cptr), &vd); - + ircd_snprintf(NULL, message, sizeof(message), + "Protocol Violation from %s: %v", cli_name(cptr), &vd); va_end(vd.vd_args); + + sendwallto_group_butone(&me, WALL_DESYNCH, NULL, "%s", message); return 0; } +/** Inform a client that they need to provide more parameters. + * @param[in] cptr Taciturn client. + * @param[in] cmd Command name. + * @return Zero. + */ int need_more_params(struct Client* cptr, const char* cmd) { send_reply(cptr, ERR_NEEDMOREPARAMS, cmd); return 0; } +/** Send a generic reply to a user. + * @param[in] to Client that wants a reply. + * @param[in] reply Numeric of message to send. + * @return Zero. + */ int send_reply(struct Client *to, int reply, ...) { struct VarData vd;