nick **nh;
char *fakehost;
char *accountts;
+ char *accountflags;
struct irc_in_addr ipaddress;
+ char *accountid;
+ unsigned long userid;
if (cargc==2) { /* rename */
/* Nyklon 1017697578 */
base64toip(cargv[cargc-3], &ipaddress);
/* todo: use a single node for /64 prefixes */
np->ipnode = refnode(iptree, &ipaddress, irc_in_addr_is_ipv4(&ipaddress) ? PATRICIA_MAXBITS : 64);
+ node_increment_usercount(np->ipnode);
np->shident=NULL;
np->sethost=NULL;
np->marker=0;
memset(np->exts, 0, MAXNICKEXTS * sizeof(void *));
np->authname[0]='\0';
+ np->auth=NULL;
if(cargc>=9) {
setflags(&(np->umodes),UMODE_ALL,cargv[5],umodeflags,REJECT_NONE);
if (IsAccount(np)) {
if ((accountts=strchr(cargv[6],':'))) {
*accountts++='\0';
- np->accountts=strtoul(accountts,NULL,10);
+ np->accountts=strtoul(accountts,&accountid,10);
+ if(accountid) {
+ userid=strtoul(accountid + 1,&accountflags,10);
+ if(!userid) {
+ np->auth=NULL;
+ } else {
+ np->auth=findorcreateauthname(userid, cargv[6]);
+ np->auth->usercount++;
+ np->nextbyauthname=np->auth->nicks;
+ np->auth->nicks=np;
+ if(accountflags)
+ np->auth->flags=strtoul(accountflags + 1,NULL,10);
+ }
+ } else {
+ np->auth=NULL;
+ }
} else {
np->accountts=0;
+ np->auth=NULL;
}
strncpy(np->authname,cargv[6],ACCOUNTLEN);
np->authname[ACCOUNTLEN]='\0';
nick *np;
void *harg[2];
- if (cargc>1) {
- harg[1]=(void *)cargv[1];
+ if (cargc>0) {
+ harg[1]=(void *)cargv[0];
} else {
harg[1]="";
}
int handlekillmsg(void *source, int cargc, char **cargv) {
nick *np;
-
+ void *harg[2];
+#warning Fix me to use source
+
if (cargc<1) {
Error("nick",ERR_WARNING,"Kill message with too few parameters");
return CMD_ERROR;
}
+
+ if (cargc>1) {
+ harg[1]=(void *)cargv[1];
+ } else {
+ harg[1]="";
+ }
+
np=getnickbynumericstr(cargv[0]);
if (np) {
+ harg[0]=(void *)np;
+ triggerhook(HOOK_NICK_KILL, harg);
deletenick(np);
} else {
Error("nick",ERR_WARNING,"Kill for non-existant numeric %s",cargv[0]);
int handleaccountmsg(void *source, int cargc, char **cargv) {
nick *target;
+ unsigned long userid;
if (cargc<2) {
return CMD_OK;
SetAccount(target);
strncpy(target->authname,cargv[1],ACCOUNTLEN);
target->authname[ACCOUNTLEN]='\0';
-
+
+ if (cargc>=3) {
+ target->accountts=strtoul(cargv[2],NULL,10);
+ if (cargc>=4) {
+ userid=strtoul(cargv[3],NULL,10);
+ if(!userid) {
+ target->auth=NULL;
+ } else {
+ target->auth=findorcreateauthname(userid, target->authname);
+ target->auth->usercount++;
+ target->nextbyauthname = target->auth->nicks;
+ target->auth->nicks = target;
+ if (cargc>=5)
+ target->auth->flags=strtoul(cargv[4],NULL,10);
+ }
+ } else {
+ target->auth=NULL;
+ }
+ } else {
+ target->accountts=0;
+ target->auth=NULL;
+ }
+
triggerhook(HOOK_NICK_ACCOUNT, (void *)target);
return CMD_OK;
return CMD_OK;
}
+
+int handleprivmsg(void *source, int cargc, char **cargv) {
+ nick *sender;
+ char *message;
+ void *args[3];
+
+ if (cargc<2)
+ return CMD_OK;
+
+ if (cargv[0][0]!='$')
+ return CMD_OK;
+
+ sender=getnickbynumericstr((char *)source);
+
+ if (!match2strings(cargv[0] + 1,myserver->content))
+ return CMD_OK;
+
+ message=cargv[0];
+
+ args[0]=sender;
+ args[1]=cargv[0];
+ args[2]=cargv[1];
+
+ triggerhook(HOOK_NICK_MASKPRIVMSG, (void *)args);
+
+ return CMD_OK;
+}
+