X-Git-Url: https://jfr.im/git/irc/quakenet/newserv.git/blobdiff_plain/10158aa1a158b6e032038c3b83d5290a7d798194..673180ed0d92f33e9c07d8de22c1e30afc4b5977:/chanserv/authtracker/authtracker_hooks.c diff --git a/chanserv/authtracker/authtracker_hooks.c b/chanserv/authtracker/authtracker_hooks.c index 7ffc308c..2b9ffc7d 100644 --- a/chanserv/authtracker/authtracker_hooks.c +++ b/chanserv/authtracker/authtracker_hooks.c @@ -4,10 +4,13 @@ #include "../chanserv.h" #include "../../core/hooks.h" #include "../../nick/nick.h" +#include "../../lib/irc_string.h" #include #include +#define NTERFACER_AUTH "nterfacer" + /* OK, we need to deal separately with users who have definitely gone (QUIT * or KILL) and those who has mysteriously vanished (lost in netsplit). * There are hooks for all these things, but sadly QUIT and KILL also @@ -21,20 +24,20 @@ time_t at_lastauthts; unsigned long at_lastuserid; unsigned long at_getuserid(nick *np) { - reguser *rup; - /* If they are not +r, forget it. */ if (!IsAccount(np)) return 0; + + /* Ignore that pesky nterfacer */ +#ifdef NTERFACER_AUTH + if (!ircd_strcmp(np->authname, NTERFACER_AUTH)) + return 0; +#endif - /* Try getting it from np->auth */ + /* Use the userid from authext only. */ if (np->auth) return np->auth->userid; - /* Else use the chanserv nickext */ - if ((rup=getreguserfromnick(np))) - return rup->ID; - Error("authtracker",ERR_WARNING,"Unable to get userID from IsAccount() user %s",np->nick); return 0; } @@ -44,6 +47,7 @@ void at_handlequitorkill(int hooknum, void *arg) { nick *np=args[0]; char *reason=args[1]; char *rreason; + char resbuf[512]; unsigned long userid; /* Ignore unauthed users, or those with no accountts */ @@ -54,8 +58,10 @@ void at_handlequitorkill(int hooknum, void *arg) { at_lastauthts=np->accountts; at_lastnum=np->numeric; - if (hooknum==HOOK_NICK_KILL && (rreason=strchr(reason,'@'))) - reason=rreason; + if (hooknum==HOOK_NICK_KILL && (rreason=strchr(reason,' '))) { + sprintf(resbuf,"Killed%s",rreason); + reason=resbuf; + } at_logquit(userid, np->accountts, time(NULL), reason); } @@ -99,7 +105,8 @@ void at_hookinit() { registerhook(HOOK_NICK_QUIT, at_handlequitorkill); registerhook(HOOK_NICK_KILL, at_handlequitorkill); registerhook(HOOK_NICK_LOSTNICK, at_handlelostnick); - registerhook(HOOK_CHANSERV_SETUSERID, at_newnick); + registerhook(HOOK_NICK_NEWNICK, at_newnick); + registerhook(HOOK_NICK_ACCOUNT, at_newnick); registerhook(HOOK_SERVER_LINKED, at_serverlinked); } @@ -107,6 +114,7 @@ void at_hookfini() { deregisterhook(HOOK_NICK_QUIT, at_handlequitorkill); deregisterhook(HOOK_NICK_KILL, at_handlequitorkill); deregisterhook(HOOK_NICK_LOSTNICK, at_handlelostnick); - deregisterhook(HOOK_CHANSERV_SETUSERID, at_newnick); + deregisterhook(HOOK_NICK_NEWNICK, at_newnick); + deregisterhook(HOOK_NICK_ACCOUNT, at_newnick); deregisterhook(HOOK_SERVER_LINKED, at_serverlinked); }