/[svn]/ircd-hybrid/modules/m_pong.c
ViewVC logotype

Diff of /ircd-hybrid/modules/m_pong.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 442 by adx, Sat Feb 11 23:14:21 2006 UTC revision 458 by michael, Sun Feb 12 20:45:14 2006 UTC
# Line 36  Line 36 
36  #include "parse.h"  #include "parse.h"
37  #include "modules.h"  #include "modules.h"
38    
39  static void mr_pong(struct Client *, struct Client *, int, char **);  static void mr_pong(struct Client *, struct Client *, int, char *[]);
40  static void ms_pong(struct Client *, struct Client *, int, char **);  static void ms_pong(struct Client *, struct Client *, int, char *[]);
41    
42  struct Message pong_msgtab = {  struct Message pong_msgtab = {
43    "PONG", 0, 0, 1, 0, MFLG_SLOW | MFLG_UNREG, 0,    "PONG", 0, 0, 1, 0, MFLG_SLOW | MFLG_UNREG, 0,
44    {mr_pong, m_ignore, ms_pong, m_ignore, m_ignore, m_ignore}    { mr_pong, m_ignore, ms_pong, m_ignore, m_ignore, m_ignore }
45  };  };
46    
47  INIT_MODULE(m_pong, "$Revision$")  INIT_MODULE(m_pong, "$Revision$")
# Line 61  ms_pong(struct Client *client_p, struct Line 61  ms_pong(struct Client *client_p, struct
61    struct Client *target_p;    struct Client *target_p;
62    const char *origin, *destination;    const char *origin, *destination;
63    
64    if (parc < 2 || *parv[1] == '\0')    if (*parv[1] == '\0')
65    {    {
66      sendto_one(source_p, form_str(ERR_NOORIGIN),      sendto_one(source_p, form_str(ERR_NOORIGIN),
67                 me.name, parv[0]);                 me.name, parv[0]);
# Line 97  static void Line 97  static void
97  mr_pong(struct Client *client_p, struct Client *source_p,  mr_pong(struct Client *client_p, struct Client *source_p,
98          int parc, char *parv[])          int parc, char *parv[])
99  {  {
100      assert(source_p == client_p);
101    
102    if (parc == 2 && *parv[1] != '\0')    if (parc == 2 && *parv[1] != '\0')
103    {    {
104      if(ConfigFileEntry.ping_cookie && (source_p->flags&FLAGS_GOTUSER) && source_p->name[0])      if (ConfigFileEntry.ping_cookie && (source_p->flags&FLAGS_GOTUSER) && source_p->name[0])
105      {      {
106          unsigned long incoming_ping = strtoul(parv[1], NULL, 10);        unsigned long incoming_ping = strtoul(parv[1], NULL, 10);
107          if(incoming_ping)        if (incoming_ping)
108          {        {
109            if(source_p->localClient->random_ping == incoming_ping)            if(source_p->localClient->random_ping == incoming_ping)
110            {            {
111                  char buf[USERLEN+1];                  char buf[USERLEN+1];
112                  strlcpy(buf, source_p->username, sizeof(buf));                  strlcpy(buf, source_p->username, sizeof(buf));
113                  SetPingCookie(source_p);                  SetPingCookie(source_p);
114                  register_local_user(client_p, source_p, source_p->name, buf);                  register_local_user(source_p, buf);
115            }            }
116            else            else
117            {            {
118                  sendto_one(source_p, form_str(ERR_WRONGPONG), me.name,                  sendto_one(source_p, form_str(ERR_WRONGPONG), me.name,
119                             source_p->name, source_p->localClient->random_ping);                             source_p->name, source_p->localClient->random_ping);
120                  return;                  return;
121            }          }
         }  
122        }        }
       
123      }      }
124      }
125    else    else
126      sendto_one(source_p, form_str(ERR_NOORIGIN), me.name, parv[0]);      sendto_one(source_p, form_str(ERR_NOORIGIN), me.name, parv[0]);
127  }  }

Legend:
Removed from v.442  
changed lines
  Added in v.458

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28