X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=ircd%2Fm_rping.c;h=1db4b239174a047c2bd6d70eb4b08eaf4cdf324d;hb=refs%2Fheads%2Fupstream;hp=dee0c70e72266d92b2eead459b7e2bf4203a8ef8;hpb=13033a96057c217964d51ff0a0e36b04cc4e729e;p=ircu2.10.12-pk.git diff --git a/ircd/m_rping.c b/ircd/m_rping.c index dee0c70..1db4b23 100644 --- a/ircd/m_rping.c +++ b/ircd/m_rping.c @@ -79,17 +79,12 @@ * 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_log.h" #include "ircd_reply.h" #include "ircd_string.h" #include "msg.h" @@ -99,7 +94,7 @@ #include "s_user.h" #include "send.h" -#include +/* #include -- Now using assert in ircd_log.h */ /* @@ -128,7 +123,7 @@ */ int ms_rping(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { - struct Client* destination = FindNServer(parv[1]); + struct Client* destination = 0; assert(0 != cptr); assert(0 != sptr); assert(IsServer(cptr)); @@ -151,36 +146,34 @@ int ms_rping(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * if it's not for me, pass it on */ if (IsMe(destination)) - sendto_one(cptr, "%s " TOK_RPONG " %s %s %s %s :%s", NumServ(&me), - parv[0], parv[2], parv[3], parv[4], parv[5]); + sendcmdto_one(&me, CMD_RPONG, sptr, "%s %s %s %s :%s", cli_name(sptr), + parv[2], parv[3], parv[4], parv[5]); else - sendto_one(destination, "%s " TOK_RPING " %s %s %s %s :%s", - parv[0], parv[1], parv[2], parv[3], parv[4], parv[5]); + sendcmdto_one(sptr, CMD_RPING, destination, "%C %s %s %s :%s", + destination, parv[2], parv[3], parv[4], parv[5]); } } else { if (parc < 3) { - /* - * PROTOCOL ERROR - */ return need_more_params(sptr, "RPING"); } /* * Haven't made it to the start server yet, if I'm not the start server * pass it on. */ - if (hunt_server(1, cptr, sptr, "%s%s " TOK_RPING " %s %s :%s", 2, parc, parv) != HUNTED_ISME) + if (hunt_server_cmd(sptr, CMD_RPING, cptr, 1, "%s %C :%s", 2, parc, parv) + != HUNTED_ISME) return 0; /* * otherwise ping the destination from here */ if ((destination = find_match_server(parv[1]))) { - assert(IsServer(destination)); - sendto_one(destination, "%s " TOK_RPING " %s %s%s %s :%s", - NumServ(&me), NumServ(destination), NumNick(sptr), militime(0, 0), parv[3]); + assert(IsServer(destination) || IsMe(destination)); + sendcmdto_one(&me, CMD_RPING, destination, "%C %C %s :%s", destination, + sptr, militime(0, 0), parv[3]); } else - sendto_one(sptr, err_str(ERR_NOSUCHSERVER), me.name, parv[0], parv[1]); + send_reply(sptr, ERR_NOSUCHSERVER, parv[1]); } return 0; } @@ -218,14 +211,14 @@ int mo_rping(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (parc > 2) { if ((acptr = find_match_server(parv[2])) && !IsMe(acptr)) { - parv[2] = acptr->name; + parv[2] = cli_name(acptr); if (3 == parc) { /* * const_cast(start_time); */ parv[parc++] = (char*) start_time; } - hunt_server(1, cptr, sptr, "%s%s " TOK_RPING " %s %s :%s", 2, parc, parv); + hunt_server_cmd(sptr, CMD_RPING, cptr, 1, "%s %C :%s", 2, parc, parv); return 0; } else @@ -233,82 +226,12 @@ int mo_rping(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) } if ((acptr = find_match_server(parv[1]))) { - assert(IsServer(acptr)); - sendto_one(acptr, "%s " TOK_RPING " %s %s%s %s :%s", - NumServ(&me), NumServ(acptr), NumNick(sptr), militime(0, 0), start_time); + assert(IsServer(acptr) || IsMe(acptr)); + sendcmdto_one(&me, CMD_RPING, acptr, "%C %C %s :%s", acptr, sptr, + militime(0, 0), start_time); } else - sendto_one(sptr, err_str(ERR_NOSUCHSERVER), me.name, parv[0], parv[1]); + send_reply(sptr, ERR_NOSUCHSERVER, parv[1]); return 0; } - -#if 0 -/* - * m_rping -- by Run - * - * parv[0] = sender (sptr->name thus) - * if sender is a person: (traveling towards start server) - * parv[1] = pinged server[mask] - * parv[2] = start server (current target) - * parv[3] = optional remark - * if sender is a server: (traveling towards pinged server) - * parv[1] = pinged server (current target) - * parv[2] = original sender (person) - * parv[3] = start time in s - * parv[4] = start time in us - * parv[5] = the optional remark - */ -int m_rping(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) -{ - struct Client *acptr; - - if (!IsPrivileged(sptr)) - return 0; - - if (parc < (IsAnOper(sptr) ? (MyConnect(sptr) ? 2 : 3) : 6)) - { - return need_more_params(sptr, "RPING"); - return 0; - } - if (MyUser(sptr)) - { - if (parc == 2) - parv[parc++] = me.name; - else if (!(acptr = find_match_server(parv[2]))) - { - parv[3] = parv[2]; - parv[2] = me.name; - parc++; - } - else - parv[2] = acptr->name; - if (parc == 3) - parv[parc++] = ""; - } - - if (IsAnOper(sptr)) - { - if (hunt_server(1, cptr, sptr, "%s%s " TOK_RPING " %s %s :%s", 2, parc, parv) != - HUNTED_ISME) - return 0; - if (!(acptr = find_match_server(parv[1])) || !IsServer(acptr)) - { - sendto_one(sptr, err_str(ERR_NOSUCHSERVER), me.name, parv[0], parv[1]); - return 0; - } - sendto_one(acptr, ":%s RPING %s %s %s :%s", - me.name, NumServ(acptr), sptr->name, militime(0, 0), parv[3]); - } - else - { - if (hunt_server(1, cptr, sptr, "%s%s " TOK_RPING " %s %s %s %s :%s", 1, parc, parv) - != HUNTED_ISME) - return 0; - sendto_one(cptr, ":%s RPONG %s %s %s %s :%s", me.name, parv[0], - parv[2], parv[3], parv[4], parv[5]); - } - return 0; -} -#endif /* 0 */ -