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

Comparing ircd-hybrid/libio/misc/hook.c (file contents):
Revision 64 by adx, Mon Oct 3 22:23:39 2005 UTC vs.
Revision 65 by adx, Mon Oct 3 23:33:16 2005 UTC

# Line 24 | Line 24
24   */
25  
26   #include "stdinc.h"
27 #include "client.h"
27   #include "hook.h"
29 #include "ircd.h"
28   #include "list.h"
29   #include "memory.h"
32 #include "numeric.h"
30   #include "tools.h"
31   #include "irc_string.h"
32 < #include "send.h"
32 > #include "s_misc.h"
33  
34   dlink_list callback_list = {NULL, NULL, 0};
35  
# Line 205 | Line 202 | uninstall_hook(struct Callback *cb, CBFU
202    dlinkDelete(ptr, &cb->chain);
203    MyFree(ptr);
204   }
208
209 /*
210 * stats_hooks()
211 *
212 * Displays registered callbacks and lengths of their hook chains.
213 * (This is the handler of /stats h)
214 *
215 * inputs:
216 *   source_p  -  pointer to struct Client
217 * output: none
218 */
219 void
220 stats_hooks(struct Client *source_p)
221 {
222  dlink_node *ptr;
223  struct Callback *cb;
224  char lastused[32];
225
226  sendto_one(source_p, ":%s %d %s : %-20s %-20s Used     Hooks", me.name,
227             RPL_STATSDEBUG, source_p->name, "Callback", "Last Execution");
228  sendto_one(source_p, ":%s %d %s : ------------------------------------"
229             "--------------------", me.name, RPL_STATSDEBUG, source_p->name);
230
231  DLINK_FOREACH(ptr, callback_list.head)
232  {
233    cb = ptr->data;
234
235    if (cb->last != 0)
236      snprintf(lastused, sizeof(lastused), "%d seconds ago",
237               (int) (CurrentTime - cb->last));
238    else
239      strcpy(lastused, "NEVER");
240
241    sendto_one(source_p, ":%s %d %s : %-20s %-20s %-8u %d", me.name,
242               RPL_STATSDEBUG, source_p->name, cb->name, lastused, cb->called,
243               dlink_list_length(&cb->chain));
244  }
245
246  sendto_one(source_p, ":%s %d %s : ", me.name, RPL_STATSDEBUG,
247             source_p->name);
248 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines