X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=ircd%2Fm_error.c;h=561fbcffffb44cfe5a673ecb1dda083f135dfbc3;hb=refs%2Fheads%2Fupstream;hp=f981a6627b1114c8feeaa3d6a3bcc8b4fa019b82;hpb=ae91ef6320f611af74e70a0db2620c338fbaa7d5;p=ircu2.10.12-pk.git diff --git a/ircd/m_error.c b/ircd/m_error.c index f981a66..561fbcf 100644 --- a/ircd/m_error.c +++ b/ircd/m_error.c @@ -79,18 +79,13 @@ * note: it is guaranteed that parv[0]..parv[parc-1] are all * non-NULL pointers. */ -#if 0 -/* - * No need to include handlers.h here the signatures must match - * and we don't need to force a rebuild of all the handlers everytime - * we add a new one to the list. --Bleep - */ -#include "handlers.h" -#endif /* 0 */ +#include "config.h" + #include "client.h" #include "hash.h" #include "ircd.h" #include "ircd_alloc.h" +#include "ircd_log.h" #include "ircd_reply.h" #include "ircd_string.h" #include "numeric.h" @@ -99,121 +94,66 @@ #include "s_misc.h" #include "send.h" -#include - -/* - * ms_error - server message handler - * - * parv[0] = sender prefix - * parv[parc-1] = text - */ -int ms_error(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) -{ - char *para; - - para = (parc > 1 && *parv[parc - 1] != '\0') ? parv[parc - 1] : "<>"; - - Debug((DEBUG_ERROR, "Received ERROR message from %s: %s", sptr->name, para)); - /* - * Ignore error messages generated by normal user clients - * (because ill-behaving user clients would flood opers - * screen otherwise). Pass ERROR's from other sources to - * the local operator... - */ - if (IsUser(cptr)) - return 0; - if (IsUnknown(cptr)) - return exit_client_msg(cptr, cptr, &me, "Register first"); - - if (cptr == sptr) - sendto_ops("ERROR :from %s -- %s", cptr->name, para); - else - sendto_ops("ERROR :from %s via %s -- %s", sptr->name, cptr->name, para); - - if (sptr->serv) - { - MyFree(sptr->serv->last_error_msg); - DupString(sptr->serv->last_error_msg, para); - } - - return 0; -} +/* #include -- Now using assert in ircd_log.h */ +#include /* - * mr_error - registration message handler + * mr_error - unregistered client message handler * * parv[0] = sender prefix * parv[parc-1] = text */ int mr_error(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { - char *para; + const char *para; + + if (!IsHandshake(cptr) && !IsConnecting(cptr)) + return 0; /* ignore ERROR from regular clients */ para = (parc > 1 && *parv[parc - 1] != '\0') ? parv[parc - 1] : "<>"; - Debug((DEBUG_ERROR, "Received ERROR message from %s: %s", sptr->name, para)); - /* - * Ignore error messages generated by normal user clients - * (because ill-behaving user clients would flood opers - * screen otherwise). Pass ERROR's from other sources to - * the local operator... - */ - if (IsUser(cptr)) - return 0; - if (IsUnknown(cptr)) - return exit_client_msg(cptr, cptr, &me, "Register first"); + Debug((DEBUG_ERROR, "Received ERROR message from %s: %s", cli_name(sptr), para)); if (cptr == sptr) - sendto_ops("ERROR :from %s -- %s", cptr->name, para); + sendto_opmask_butone(0, SNO_OLDSNO, "ERROR :from %C -- %s", cptr, para); else - sendto_ops("ERROR :from %s via %s -- %s", sptr->name, cptr->name, para); + sendto_opmask_butone(0, SNO_OLDSNO, "ERROR :from %C via %C -- %s", sptr, + cptr, para); - if (sptr->serv) + if (cli_serv(sptr)) { - MyFree(sptr->serv->last_error_msg); - DupString(sptr->serv->last_error_msg, para); + MyFree(cli_serv(sptr)->last_error_msg); + DupString(cli_serv(sptr)->last_error_msg, para); } return 0; } -#if 0 /* - * m_error + * ms_error - server message handler * * parv[0] = sender prefix * parv[parc-1] = text */ -int m_error(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) +int ms_error(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { - char *para; + const char *para; para = (parc > 1 && *parv[parc - 1] != '\0') ? parv[parc - 1] : "<>"; - Debug((DEBUG_ERROR, "Received ERROR message from %s: %s", sptr->name, para)); - /* - * Ignore error messages generated by normal user clients - * (because ill-behaving user clients would flood opers - * screen otherwise). Pass ERROR's from other sources to - * the local operator... - */ - if (IsUser(cptr)) - return 0; - if (IsUnknown(cptr)) - return exit_client_msg(cptr, cptr, &me, "Register first"); + Debug((DEBUG_ERROR, "Received ERROR message from %s: %s", cli_name(sptr), para)); if (cptr == sptr) - sendto_ops("ERROR :from %s -- %s", cptr->name, para); + sendto_opmask_butone(0, SNO_OLDSNO, "ERROR :from %C -- %s", cptr, para); else - sendto_ops("ERROR :from %s via %s -- %s", sptr->name, cptr->name, para); + sendto_opmask_butone(0, SNO_OLDSNO, "ERROR :from %C via %C -- %s", sptr, + cptr, para); - if (sptr->serv) + if (cli_serv(sptr)) { - MyFree(sptr->serv->last_error_msg); - DupString(sptr->serv->last_error_msg, para); + MyFree(cli_serv(sptr)->last_error_msg); + DupString(cli_serv(sptr)->last_error_msg, para); } return 0; } -#endif /* 0 */ -