ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_pong.c
(Generate patch)

Comparing:
ircd-hybrid-7.2/modules/m_pong.c (file contents), Revision 982 by michael, Thu Aug 13 22:15:08 2009 UTC vs.
ircd-hybrid-8/modules/m_pong.c (file contents), Revision 1309 by michael, Sun Mar 25 11:24:18 2012 UTC

# Line 24 | Line 24
24  
25   #include "stdinc.h"
26   #include "ircd.h"
27 #include "handlers.h"
27   #include "s_user.h"
28   #include "client.h"
29   #include "hash.h"       /* for find_client() */
30   #include "numeric.h"
31 < #include "s_conf.h"
31 > #include "conf.h"
32   #include "send.h"
33   #include "irc_string.h"
35 #include "msg.h"
34   #include "parse.h"
35   #include "modules.h"
36  
39 static void mr_pong(struct Client *, struct Client *, int, char **);
40 static void ms_pong(struct Client *, struct Client *, int, char **);
41
42 struct Message pong_msgtab = {
43  "PONG", 0, 0, 1, 0, MFLG_SLOW | MFLG_UNREG, 0,
44  {mr_pong, m_ignore, ms_pong, m_ignore, m_ignore, m_ignore}
45 };
46
47 #ifndef STATIC_MODULES
48 void
49 _modinit(void)
50 {
51  mod_add_cmd(&pong_msgtab);
52 }
53
54 void
55 _moddeinit(void)
56 {
57  mod_del_cmd(&pong_msgtab);
58 }
59
60 const char *_version = "$Revision$";
61 #endif
37  
38   static void
39   ms_pong(struct Client *client_p, struct Client *source_p,
# Line 67 | Line 42 | ms_pong(struct Client *client_p, struct
42    struct Client *target_p;
43    const char *origin, *destination;
44  
45 <  if (parc < 2 || *parv[1] == '\0')
45 >  if (parc < 2 || EmptyString(parv[1]))
46    {
47      sendto_one(source_p, form_str(ERR_NOORIGIN),
48 <               me.name, parv[0]);
48 >               me.name, source_p->name);
49      return;
50    }
51  
# Line 86 | Line 61 | ms_pong(struct Client *client_p, struct
61    if (!EmptyString(destination) && !match(destination, me.name) &&
62        irccmp(destination, me.id))
63    {
64 <      if ((target_p = find_client(destination)) ||
65 <          (target_p = find_server(destination)))
66 <        sendto_one(target_p,":%s PONG %s %s",
67 <                   parv[0], origin, destination);
68 <      else
69 <        {
70 <          sendto_one(source_p, form_str(ERR_NOSUCHSERVER),
71 <                     me.name, parv[0], destination);
72 <          return;
73 <        }
64 >    if ((target_p = hash_find_client(destination)) ||
65 >        (target_p = hash_find_server(destination)))
66 >      sendto_one(target_p, ":%s PONG %s %s",
67 >                 source_p->name, origin, destination);
68 >    else
69 >    {
70 >      sendto_one(source_p, form_str(ERR_NOSUCHSERVER),
71 >                 me.name, source_p->name, destination);
72 >      return;
73 >    }
74    }
75   }
76  
# Line 115 | Line 90 | mr_pong(struct Client *client_p, struct
90        {
91          if (source_p->localClient->random_ping == incoming_ping)
92          {
118          char buf[USERLEN + 1];
119
120          strlcpy(buf, source_p->username, sizeof(buf));
93            SetPingCookie(source_p);
94 <          register_local_user(client_p, source_p, source_p->name, buf);
94 >          register_local_user(source_p);
95          }
96          else
97          {
# Line 131 | Line 103 | mr_pong(struct Client *client_p, struct
103      }
104    }
105    else
106 <    sendto_one(source_p, form_str(ERR_NOORIGIN), me.name, parv[0]);
106 >    sendto_one(source_p, form_str(ERR_NOORIGIN),
107 >               me.name, source_p->name);
108 > }
109 >
110 > static struct Message pong_msgtab = {
111 >  "PONG", 0, 0, 1, MAXPARA, MFLG_SLOW | MFLG_UNREG, 0,
112 >  {mr_pong, m_ignore, ms_pong, m_ignore, m_ignore, m_ignore}
113 > };
114 >
115 > static void
116 > module_init(void)
117 > {
118 >  mod_add_cmd(&pong_msgtab);
119 > }
120 >
121 > static void
122 > module_exit(void)
123 > {
124 >  mod_del_cmd(&pong_msgtab);
125   }
126  
127 + struct module module_entry = {
128 +  .node    = { NULL, NULL, NULL },
129 +  .name    = NULL,
130 +  .version = "$Revision$",
131 +  .handle  = NULL,
132 +  .modinit = module_init,
133 +  .modexit = module_exit,
134 +  .flags   = 0
135 + };

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)