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/modules/m_admin.c (file contents), Revision 1028 by michael, Sun Nov 8 13:03:38 2009 UTC vs.
ircd-hybrid-8/modules/m_admin.c (file contents), Revision 1230 by michael, Thu Sep 22 19:41:19 2011 UTC

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

Diff Legend

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