From: Chris Porter Date: Tue, 30 Sep 2008 01:15:57 +0000 (+0100) Subject: Move nterfacer checking of rlines into handlers (where it should be...) X-Git-Url: https://jfr.im/git/irc/quakenet/newserv.git/commitdiff_plain/f435bd22df49a283ffbea2d993afe983ff7ce697 Move nterfacer checking of rlines into handlers (where it should be...) --- diff --git a/nterfacer/nterfacer.c b/nterfacer/nterfacer.c index b671a84a..76de7099 100644 --- a/nterfacer/nterfacer.c +++ b/nterfacer/nterfacer.c @@ -82,6 +82,29 @@ void _init(void) { } void free_handler(struct handler *hp) { + struct rline *li, *pi = NULL; + + for(li=rlines;li;) { + if(li->handler == hp) { + if(li->socket) { + esocket_write_line(li->socket, "%d,OE%d,%s", li->id, BF_UNLOADED, "Service was unloaded."); + } else if(li->callback) { + li->callback(BF_UNLOADED, "Service was unloaded.", li->tag); + } + if(pi) { + pi->next = li->next; + ntfree(li); + li = pi->next; + } else { + rlines = li->next; + ntfree(li); + li = rlines; + } + } else { + pi=li,li=li->next; + } + } + freesstring(hp->command); ntfree(hp); } @@ -300,7 +323,6 @@ void deregister_handler(struct handler *hl) { void deregister_service(struct service_node *service) { struct service_node *sp, *lp = NULL; - struct rline *li, *pi = NULL; for(sp=tree;sp;lp=sp,sp=sp->next) { if(sp == service) { @@ -318,21 +340,6 @@ void deregister_service(struct service_node *service) { free_handlers(service); - for(li=rlines;li;) { - if(li->service == service) { - if(pi) { - pi->next = li->next; - ntfree(li); - li = pi->next; - } else { - rlines = li->next; - ntfree(li); - li = rlines; - } - } else { - pi=li,li=li->next; - } - } freesstring(service->name); ntfree(service); diff --git a/nterfacer/nterfacer.h b/nterfacer/nterfacer.h index 4e91164f..69760fdd 100644 --- a/nterfacer/nterfacer.h +++ b/nterfacer/nterfacer.h @@ -16,6 +16,7 @@ #define BF_OK 0x00 #define BF_OVER 0xFF +#define BF_UNLOADED 0xFE #define SS_IDLE 0x00 #define SS_VERSIONED 0x01