]> jfr.im git - solanum.git/blobdiff - modules/m_pong.c
msg: remove last vestiges of the fakelag system. charybdis has never supported fakelag.
[solanum.git] / modules / m_pong.c
index 7cf84d5a7980701f50c20e242c65c692a31f42c8..de8b494cab02346bf1a2ae7d045322172d0bca48 100644 (file)
 #include "s_conf.h"
 #include "send.h"
 #include "channel.h"
-#include "irc_string.h"
+#include "match.h"
 #include "msg.h"
 #include "parse.h"
 #include "hash.h"
 #include "modules.h"
 
-static int mr_pong(struct Client *, struct Client *, int, const char **);
-static int ms_pong(struct Client *, struct Client *, int, const char **);
+static int mr_pong(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
+static int ms_pong(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
 
 struct Message pong_msgtab = {
-       "PONG", 0, 0, 0, MFLG_SLOW | MFLG_UNREG,
+       "PONG", 0, 0, 0, 0,
        {{mr_pong, 0}, mg_ignore, mg_ignore, {ms_pong, 2}, mg_ignore, mg_ignore}
 };
 
@@ -52,7 +52,7 @@ mapi_clist_av1 pong_clist[] = { &pong_msgtab, NULL };
 DECLARE_MODULE_AV1(pong, NULL, NULL, pong_clist, NULL, NULL, "$Revision: 3181 $");
 
 static int
-ms_pong(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
+ms_pong(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
 {
        struct Client *target_p;
        const char *destination;
@@ -70,8 +70,8 @@ ms_pong(struct Client *client_p, struct Client *source_p, int parc, const char *
           irccmp(destination, me.id))
        {
                if((target_p = find_client(destination)))
-                       sendto_one(target_p, ":%s PONG %s %s", 
-                                  get_id(source_p, target_p), parv[1], 
+                       sendto_one(target_p, ":%s PONG %s %s",
+                                  get_id(source_p, target_p), parv[1],
                                   get_id(target_p, target_p));
                else
                {
@@ -99,21 +99,19 @@ ms_pong(struct Client *client_p, struct Client *source_p, int parc, const char *
 }
 
 static int
-mr_pong(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
+mr_pong(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
 {
        if(parc == 2 && !EmptyString(parv[1]))
        {
-               if(ConfigFileEntry.ping_cookie && source_p->user && source_p->name[0])
+               if(ConfigFileEntry.ping_cookie && source_p->flags & FLAGS_SENTUSER && source_p->name[0])
                {
                        unsigned long incoming_ping = strtoul(parv[1], NULL, 16);
                        if(incoming_ping)
                        {
                                if(source_p->localClient->random_ping == incoming_ping)
                                {
-                                       char buf[USERLEN + 1];
-                                       rb_strlcpy(buf, source_p->username, sizeof(buf));
                                        source_p->flags |= FLAGS_PING_COOKIE;
-                                       register_local_user(client_p, source_p, buf);
+                                       register_local_user(client_p, source_p);
                                }
                                else
                                {
@@ -127,7 +125,7 @@ mr_pong(struct Client *client_p, struct Client *source_p, int parc, const char *
 
        }
        else
-               sendto_one(source_p, form_str(ERR_NOORIGIN), me.name, parv[0]);
+               sendto_one(source_p, form_str(ERR_NOORIGIN), me.name, source_p->name);
 
        source_p->flags &= ~FLAGS_PINGSENT;