]>
jfr.im git - irc/quakenet/newserv.git/blob - testmod/testmod.c
4 #include "../core/hooks.h"
5 #include "../server/server.h"
6 #include "../nick/nick.h"
7 #include "../core/error.h"
8 #include "../core/schedule.h"
9 #include "../localuser/localuser.h"
11 void spamserverstate(int hook
, void *servernum
) {
13 case HOOK_SERVER_NEWSERVER
:
14 Error("testmod",ERR_INFO
,"New server: %ld (%d maxusers)",(long)servernum
,serverlist
[(long)servernum
].maxusernum
+1);
17 case HOOK_SERVER_LOSTSERVER
:
18 Error("testmod",ERR_INFO
,"Lost server: %ld",(long)servernum
);
23 void printnick(int hook
, void *vp
) {
25 // nick *np=(nick *)vp;
27 // printf("New nick %s: %s!%s@%s (%s)\n",longtonumeric(np->numeric,5),np->nick,np->ident,np->host->name->content,np->realname->name->content);
31 void printstats(int hook
, void *arg
) {
32 printf("%s\n",(char *)arg
);
35 void requeststats(void *arg
) {
36 triggerhook(HOOK_CORE_STATSREQUEST
,(void *)20);
40 registerhook(HOOK_SERVER_NEWSERVER
,&spamserverstate
);
41 registerhook(HOOK_SERVER_LOSTSERVER
,&spamserverstate
);
42 registerhook(HOOK_NICK_NEWNICK
,&printnick
);
43 registerhook(HOOK_CORE_STATSREPLY
,&printstats
);
45 schedulerecurring(time(NULL
),0,10,&requeststats
,NULL
);
49 deregisterhook(HOOK_SERVER_NEWSERVER
,&spamserverstate
);
50 deregisterhook(HOOK_SERVER_LOSTSERVER
,&spamserverstate
);
51 deregisterhook(HOOK_NICK_NEWNICK
,&printnick
);
52 deregisterhook(HOOK_CORE_STATSREPLY
,&printstats
);
54 deleteschedule(NULL
,&requeststats
,NULL
);