Author: Isomer <perry@coders.net>
[ircu2.10.12-pk.git] / ircd / m_pong.c
index bfe558cec2ab6b3d18374d4e467dfbf5f2b59b4a..64a4e81f45cf98964473a45f70c6f651349084b2 100644 (file)
@@ -90,6 +90,7 @@
 #include "client.h"
 #include "hash.h"
 #include "ircd.h"
+#include "ircd_reply.h"
 #include "ircd_string.h"
 #include "msg.h"
 #include "numeric.h"
@@ -121,22 +122,20 @@ int ms_pong(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     /*
      * ignore there is nothing the server sending it can do about it
      */
-    sendto_one(sptr, err_str(ERR_NOORIGIN), me.name, parv[0]);
+    sendto_one(sptr, err_str(ERR_NOORIGIN), me.name, parv[0]); /* XXX DEAD */
 #endif
-    return 0;
+    return protocol_violation(sptr,"No Origin on PONG");
   }
   origin      = parv[1];
   destination = parv[2];
   cptr->flags &= ~FLAGS_PINGSENT;
   sptr->flags &= ~FLAGS_PINGSENT;
+  cptr->lasttime = CurrentTime;
 
   if (!EmptyString(destination) && 0 != ircd_strcmp(destination, me.name)) {
     struct Client* acptr;
     if ((acptr = FindClient(destination))) {
-      if (MyUser(acptr))
-        sendto_one(acptr, ":%s PONG %s %s", sptr->name, origin, destination);
-      else
-        sendto_one(acptr, "%s " TOK_PONG " %s %s", NumServ(sptr), origin, destination);
+      sendcmdto_one(sptr, CMD_PONG, acptr, "%s %s", origin, destination);
     }
   }
   return 0;
@@ -168,12 +167,11 @@ int mr_pong(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
         /*
          * NICK and USER OK
          */
-        return register_user(cptr, sptr, sptr->name, sptr->user->username);
+        return register_user(cptr, sptr, sptr->name, sptr->user->username, 0);
     }
     else  
-      sendto_one(sptr, ":%s %d %s :To connect, type /QUOTE PONG %u",
-                 me.name, ERR_BADPING, (sptr->name) ? sptr->name : "*",
-                 sptr->cookie);
+      send_reply(sptr, SND_EXPLICIT | ERR_BADPING,
+                ":To connect, type /QUOTE PONG %u", sptr->cookie);
   }
   return 0;
 }
@@ -222,10 +220,10 @@ int m_pong(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
       sptr->cookie = COOKIE_VERIFIED;
       if (sptr->user && *sptr->user->host && sptr->name[0])        /* NICK and
                                                                    USER OK */
-        return register_user(cptr, sptr, sptr->name, sptr->user->username);
+        return register_user(cptr, sptr, sptr->name, sptr->user->username); /* XXX DEAD */
     }
     else
-      sendto_one(sptr, ":%s %d %s :To connect, type /QUOTE PONG %u",
+      sendto_one(sptr, ":%s %d %s :To connect, type /QUOTE PONG %u", /* XXX DEAD */
           me.name, ERR_BADPING, sptr->name, sptr->cookie);
 
     return 0;
@@ -233,7 +231,7 @@ int m_pong(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
 
   if (parc < 2 || *parv[1] == '\0')
   {
-    sendto_one(sptr, err_str(ERR_NOORIGIN), me.name, parv[0]);
+    sendto_one(sptr, err_str(ERR_NOORIGIN), me.name, parv[0]); /* XXX DEAD */
     return 0;
   }
 
@@ -245,10 +243,10 @@ int m_pong(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
   if (!EmptyString(destination) && 0 != ircd_strcmp(destination, me.name))
   {
     if ((acptr = FindClient(destination)))
-      sendto_one(acptr, ":%s PONG %s %s", parv[0], origin, destination);
+      sendto_one(acptr, ":%s PONG %s %s", parv[0], origin, destination); /* XXX DEAD */
     else
     {
-      sendto_one(sptr, err_str(ERR_NOSUCHSERVER),
+      sendto_one(sptr, err_str(ERR_NOSUCHSERVER), /* XXX DEAD */
           me.name, parv[0], destination);
       return 0;
     }