Clean up comments and channel prefix list in a test file.
[ircu2.10.12-pk.git] / ircd / m_ping.c
index 0d6c689502740c0b6c75080023263b0fe7816506..609e00d457e394e5aadba97240ddf9b9ae017cb0 100644 (file)
 #include "msg.h"
 #include "numeric.h"
 #include "numnicks.h"
+#include "opercmds.h"
 #include "s_debug.h"
 #include "send.h"
 
 #include <assert.h>
+#include <stdlib.h>
 #include <string.h>
 
 /*
@@ -161,7 +163,7 @@ int m_ping(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   if (parc < 2 || EmptyString(parv[1]))
     return send_reply(sptr, ERR_NOORIGIN);
 
-  sendcmdto_one(&me, CMD_PONG, sptr, "%C :%s", &me, origin);
+  sendcmdto_one(&me, CMD_PONG, sptr, "%C :%s", &me, parv[1]);
   return 0;
 }
 
@@ -175,15 +177,24 @@ int m_ping(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 int mo_ping(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {
   struct Client* acptr;
-  char*          destination;
+  char *destination, *origin;
   assert(0 != cptr);
   assert(cptr == sptr);
 
   if (parc < 2 || EmptyString(parv[1]))
     return send_reply(sptr, ERR_NOORIGIN);
 
+  origin = parv[1];
   destination = parv[2];        /* Will get NULL or pointer (parc >= 2!!) */
 
+  if (parc > 3)
+  {
+    /* AsLL ping, send reply back */
+    int diff = atoi(militime_float(parv[3]));
+    sendcmdto_one(&me, CMD_PONG, sptr, "%C %s %s %i %s", &me, origin,
+                  parv[3], diff, militime_float(NULL));
+    return 0;
+  }
   if (!EmptyString(destination) && 0 != ircd_strcmp(destination, cli_name(&me))) {
     if ((acptr = FindServer(destination)))
       sendcmdto_one(sptr, CMD_PING, acptr, "%C :%s", sptr, destination);
@@ -219,7 +230,7 @@ int mo_ping(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
  */
 
 /*
- * ms_ping - server message handler template
+ * ms_ping - server message handler
  */
 int ms_ping(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {