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

Comparing:
ircd-hybrid-7.3/modules/m_admin.c (file contents), Revision 1029 by michael, Sun Nov 8 13:10:50 2009 UTC vs.
ircd-hybrid-8/modules/m_admin.c (file contents), Revision 1309 by michael, Sun Mar 25 11:24:18 2012 UTC

# Line 25 | Line 25
25   */
26  
27   #include "stdinc.h"
28 – #include "handlers.h"
28   #include "client.h"
29   #include "ircd.h"
30   #include "numeric.h"
31 < #include "s_conf.h"
31 > #include "conf.h"
32   #include "s_serv.h"
33   #include "send.h"
35 – #include "msg.h"
34   #include "parse.h"
37 – #include "hook.h"
35   #include "modules.h"
36   #include "irc_string.h"
37  
41 – static void m_admin(struct Client *, struct Client *, int, char *[]);
42 – static void mr_admin(struct Client *, struct Client *, int, char *[]);
43 – static void ms_admin(struct Client *, struct Client *, int, char *[]);
44 – static void do_admin(struct Client *);
38  
46 – struct Message admin_msgtab = {
47 –  "ADMIN", 0, 0, 0, 0, MFLG_SLOW | MFLG_UNREG, 0,
48 –  {mr_admin, m_admin, ms_admin, m_ignore, ms_admin, m_ignore}
49 – };
39  
40 < #ifndef STATIC_MODULES
41 < static struct Callback *admin_cb;
42 < const char *_version = "$Revision$";
43 <
44 < static void *
45 < va_admin(va_list args)
40 > /*! \brief Sends administrative information about this server.
41 > *
42 > * \param source_p Pointer to client to report to
43 > */
44 > static void
45 > do_admin(struct Client *source_p)
46   {
47 <  do_admin(va_arg(args, struct Client *));
48 <  return NULL;
60 < }
47 >  const char *me_name;
48 >  const char *nick;
49  
50 < void
51 < _modinit(void)
52 < {
53 <  admin_cb = register_callback("doing_admin", va_admin);
66 <  mod_add_cmd(&admin_msgtab);
67 < }
50 >  sendto_realops_flags(UMODE_SPY, L_ALL,
51 >                       "ADMIN requested by %s (%s@%s) [%s]",
52 >                       source_p->name, source_p->username,
53 >                       source_p->host, source_p->servptr->name);
54  
55 < void
56 < _moddeinit(void)
57 < {
58 <  mod_del_cmd(&admin_msgtab);
59 <  uninstall_hook(admin_cb, va_admin);
55 >  me_name = ID_or_name(&me, source_p->from);
56 >  nick = ID_or_name(source_p, source_p->from);
57 >
58 >  sendto_one(source_p, form_str(RPL_ADMINME),
59 >             me_name, nick, me.name);
60 >  if (AdminInfo.name != NULL)
61 >    sendto_one(source_p, form_str(RPL_ADMINLOC1),
62 >               me_name, nick, AdminInfo.name);
63 >  if (AdminInfo.description != NULL)
64 >    sendto_one(source_p, form_str(RPL_ADMINLOC2),
65 >               me_name, nick, AdminInfo.description);
66 >  if (AdminInfo.email != NULL)
67 >    sendto_one(source_p, form_str(RPL_ADMINEMAIL),
68 >               me_name, nick, AdminInfo.email);
69   }
75 – #endif
70  
71   /*! \brief ADMIN command handler (called by unregistered,
72   *         locally connected clients)
# Line 104 | Line 98 | mr_admin(struct Client *client_p, struct
98  
99    last_used = CurrentTime;
100  
101 < #ifdef STATIC_MODULES
108 <  do_admin(client_p);
109 < #else
110 <  execute_callback(admin_cb, source_p, parc, parv);
111 < #endif
101 >  do_admin(source_p);
102   }
103  
104   /*! \brief NICK command handler (called by already registered,
# Line 145 | Line 135 | m_admin(struct Client *client_p, struct
135                      parc, parv) != HUNTED_ISME)
136        return;
137  
138 < #ifdef STATIC_MODULES
149 <  do_admin(client_p);
150 < #else
151 <  execute_callback(admin_cb, source_p, parc, parv);
152 < #endif
138 >  do_admin(source_p);
139   }
140  
141   /*! \brief ADMIN command handler (called by operators and
# Line 170 | Line 156 | static void
156   ms_admin(struct Client *client_p, struct Client *source_p,
157           int parc, char *parv[])
158   {
159 <  if (hunt_server(client_p, source_p, ":%s ADMIN :%s", 1, parc, parv)
160 <                  != HUNTED_ISME)
159 >  if (hunt_server(client_p, source_p, ":%s ADMIN :%s", 1,
160 >                  parc, parv) != HUNTED_ISME)
161      return;
162  
163    if (IsClient(source_p))
178 – #ifdef STATIC_MODULES
164      do_admin(source_p);
180 – #else
181 –    execute_callback(admin_cb, source_p, parc, parv);
182 – #endif
165   }
166  
167 < /*! \brief Sends administrative information about this server.
168 < *
169 < * \param source_p Pointer to client to report to
170 < */
167 > static struct Message admin_msgtab = {
168 >  "ADMIN", 0, 0, 0, MAXPARA, MFLG_SLOW | MFLG_UNREG, 0,
169 >  {mr_admin, m_admin, ms_admin, m_ignore, ms_admin, m_ignore}
170 > };
171 >
172   static void
173 < do_admin(struct Client *source_p)
173 > module_init(void)
174   {
175 <  const char *me_name;
176 <  const char *nick;
194 <
195 <  me_name = ID_or_name(&me, source_p->from);
196 <  nick = ID_or_name(source_p, source_p->from);
175 >  mod_add_cmd(&admin_msgtab);
176 > }
177  
178 <  sendto_one(source_p, form_str(RPL_ADMINME),
179 <             me_name, nick, me.name);
180 <  if (AdminInfo.name != NULL)
181 <    sendto_one(source_p, form_str(RPL_ADMINLOC1),
202 <               me_name, nick, AdminInfo.name);
203 <  if (AdminInfo.description != NULL)
204 <    sendto_one(source_p, form_str(RPL_ADMINLOC2),
205 <               me_name, nick, AdminInfo.description);
206 <  if (AdminInfo.email != NULL)
207 <    sendto_one(source_p, form_str(RPL_ADMINEMAIL),
208 <               me_name, nick, AdminInfo.email);
178 > static void
179 > module_exit(void)
180 > {
181 >  mod_del_cmd(&admin_msgtab);
182   }
183 +
184 + struct module module_entry = {
185 +  .node    = { NULL, NULL, NULL },
186 +  .name    = NULL,
187 +  .version = "$Revision$",
188 +  .handle  = NULL,
189 +  .modinit = module_init,
190 +  .modexit = module_exit,
191 +  .flags   = 0
192 + };

Diff Legend

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