}
void rq_finifasttrack(void) {
- rq_fasttrack *ft;
+ rq_fasttrack *ft, *next;
deregisterhook(HOOK_NICK_NEWNICK, &rqhook_account);
deregisterhook(HOOK_NICK_ACCOUNT, &rqhook_account);
- for(ft=ftlist;ft;ft=ft->next)
+ for(ft=ftlist;ft;) {
+ next = ft->next;
free(ft);
+ ft = next;
+ }
releasenickext(rqnext);
}
nick *np = (nick *)arg;
rq_fasttrack *ft;
+ np->exts[rqnext] = NULL;
+
/* Auth might be null for the newnick hook. */
if(!np->auth)
return;
}
static void rq_cleanup_fasttrack(void *arg) {
+ time_t now;
+ rq_fasttrack **pft, *ft;
+ int j;
+ nick *tnp;
+
+ now = getnettime();
+ for(pft=&ftlist;*pft;pft=&((*pft)->next)) {
+ int foundnick = 0;
+
+ ft = *pft;
+
+ for(j=0;j<NICKHASHSIZE && !foundnick;j++) {
+ for(tnp=nicktable[j];tnp;tnp=tnp->next) {
+ if(tnp->exts[rqnext]==ft) {
+ foundnick = 1;
+ break;
+ }
+ }
+ }
+
+ if(!foundnick && ft->refill_time < now) {
+ *pft = ft->next;
+ free(ft);
+ }
+
+ if (!*pft)
+ break;
+ }
}
static rq_fasttrack *rq_getfasttrack(nick *np) {
ft->targets = 0;
ft->refill_time = 0;
+ ft->next = ftlist;
+ ftlist = ft;
+
np->exts[rqnext] = ft;
return ft;