X-Git-Url: https://jfr.im/git/irc/quakenet/newserv.git/blobdiff_plain/333b6dd44b1b57eaf1edda2810eb32403f6d05fa..cb5aa4cdd6af4114b18db464f022ef99a44304d7:/nick/nick.c diff --git a/nick/nick.c b/nick/nick.c index f7393847..679f0554 100644 --- a/nick/nick.c +++ b/nick/nick.c @@ -37,18 +37,29 @@ const flag umodeflags[] = { { 'P', UMODE_PARANOID }, { '\0', 0 } }; +const flag accountflags[] = { + { 's', AFLAG_STAFF }, + { 'd', AFLAG_DEVELOPER }, + { '\0', 0 } }; + #define nickhash(x) ((crc32i(x))%NICKHASHSIZE) nick *nicktable[NICKHASHSIZE]; nick **servernicks[MAXSERVERS]; sstring *nickextnames[MAXNICKEXTS]; -sstring *nodeextnames[PATRICIA_MAXSLOTS]; -patricia_tree_t *iptree; void nickstats(int hooknum, void *arg); void _init() { + unsigned int i; + authname *anp; + + /* Clear up the nicks in authext */ + for (i=0;inext) + anp->nicks=NULL; + initnickalloc(); initnickhelpers(); memset(nicktable,0,sizeof(nicktable)); @@ -70,13 +81,23 @@ void _init() { /* Fake the addition of our own server */ handleserverchange(HOOK_SERVER_NEWSERVER,(void *)numerictolong(mynumeric->content,2)); - - iptree = patricia_new_tree(PATRICIA_MAXBITS); } void _fini() { + nick *np; + int i; + + fininickhelpers(); + + for (i=0;inext) { + freesstring(np->shident); + freesstring(np->sethost); + } + } + nsfreeall(POOL_NICK); - + /* Free the hooks */ deregisterhook(HOOK_SERVER_NEWSERVER,&handleserverchange); deregisterhook(HOOK_SERVER_LOSTSERVER,&handleserverchange); @@ -293,6 +314,19 @@ void releasenickext(int index) { */ char *visiblehostmask(nick *np, char *buf) { + char uhbuf[USERLEN+HOSTLEN+2]; + + visibleuserhost(np, uhbuf); + sprintf(buf,"%s!%s",np->nick,uhbuf); + + return buf; +} + +/* visibleuserhost + * As above without nick + */ + +char *visibleuserhost(nick *np, char *buf) { char hostbuf[HOSTLEN+1]; char *ident, *host; @@ -311,7 +345,7 @@ char *visiblehostmask(nick *np, char *buf) { host=hostbuf; } - sprintf(buf,"%s!%s@%s",np->nick,ident,host); + sprintf(buf,"%s@%s",ident,host); return buf; } @@ -371,47 +405,3 @@ nick *getnickbynumericstr(char *numericstr) { #endif -int registernodeext(const char *name) { - int i; - - if (findnodeext(name)!=-1) { - Error("nick",ERR_WARNING,"Tried to register duplicate node extension %s",name); - return -1; - } - - for (i=0;icontent)) { - return i; - } - } - - return -1; -} - -void releasenodeext(int index) { - patricia_node_t *head, *node; - - freesstring(nodeextnames[index]); - nodeextnames[index]=NULL; - - head = iptree->head; - - PATRICIA_WALK_ALL(head, node) - { - node->slots[index]=NULL; - } PATRICIA_WALK_END; -}