nick **servernicks[MAXSERVERS];
sstring *nickextnames[MAXNICKEXTS];
-sstring *nodeextnames[PATRICIA_MAXSLOTS];
-patricia_tree_t *iptree;
void nickstats(int hooknum, void *arg);
registerserverhandler("W",&handlewhoismsg,2);
registerserverhandler("AC",&handleaccountmsg,4);
registerserverhandler("R",&handlestatsmsg,2);
+ registerserverhandler("P",&handleprivmsg,2);
/* Fake the addition of our own server */
handleserverchange(HOOK_SERVER_NEWSERVER,(void *)numerictolong(mynumeric->content,2));
-
- iptree = patricia_new_tree(PATRICIA_MAXBITS);
}
void _fini() {
deregisterserverhandler("W",&handlewhoismsg);
deregisterserverhandler("AC",&handleaccountmsg);
deregisterserverhandler("R",&handlestatsmsg);
+ deregisterserverhandler("P",&handleprivmsg);
}
/*
freesstring(np->shident); /* freesstring(NULL) is OK */
freesstring(np->sethost);
- np->ipnode->usercount--;
+ node_decrement_usercount(np->ipnode);
derefnode(iptree, np->ipnode);
/* TODO: figure out how to cleanly remove nodes without affecting other modules */
*/
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;
host=hostbuf;
}
- sprintf(buf,"%s!%s@%s",np->nick,ident,host);
+ sprintf(buf,"%s@%s",ident,host);
return buf;
}
#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;i<PATRICIA_MAXSLOTS;i++) {
- if (nodeextnames[i]==NULL) {
- nodeextnames[i]=getsstring(name,100);
- return i;
- }
- }
-
- Error("nick",ERR_WARNING,"Tried to register too many extensions: %s",name);
- return -1;
-}
-
-int findnodeext(const char *name) {
- int i;
-
- for (i=0;i<PATRICIA_MAXSLOTS;i++) {
- if (nodeextnames[i]!=NULL && !ircd_strcmp(name,nodeextnames[i]->content)) {
- 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->exts[index]=NULL;
- } PATRICIA_WALK_END;
-}