char *fakehost;
char *accountts;
char *accountflags;
- struct irc_in_addr ipaddress;
+ struct irc_in_addr ipaddress, ipaddress_canonical;
char *accountid;
unsigned long userid;
if (cargc==2) { /* rename */
+ char oldnick[NICKLEN+1];
+ void *harg[2];
+
/* Nyklon 1017697578 */
timestamp=strtol(cargv[1],NULL,10);
np=getnickbynumericstr(sender);
Error("nick",ERR_ERROR,"Rename from non-existent sender %s",sender);
return CMD_OK;
}
+
+ strncpy(oldnick,np->nick,NICKLEN);
+ oldnick[NICKLEN]='\0';
+ harg[0]=(void *)np;
+ harg[1]=(void *)oldnick;
+
np2=getnickbynick(cargv[0]);
if (np==np2) {
/* The new and old nickname have the same hash, this means a rename to the same name in
}
strncpy(np->nick,cargv[0],NICKLEN);
np->nick[NICKLEN]='\0';
- triggerhook(HOOK_NICK_RENAME,np);
+ triggerhook(HOOK_NICK_RENAME,harg);
return CMD_OK;
}
if (np2!=NULL) {
strncpy(np->nick,cargv[0],NICKLEN);
np->nick[NICKLEN]='\0';
addnicktohash(np);
- triggerhook(HOOK_NICK_RENAME,np);
+ triggerhook(HOOK_NICK_RENAME,harg);
} else if (cargc>=8) { /* new nick */
/* Jupiler 2 1016645147 ~Jupiler www.iglobal.be +ir moo [FUTURE CRAP HERE] DV74O] BNBd7 :Jupiler */
timestamp=strtol(cargv[2],NULL,10);
}
base64toip(cargv[cargc-3], &ipaddress);
- if (!irc_in_addr_valid(&ipaddress)) {
- Error("nick",ERR_ERROR,"Received NICK with invalid ipaddress for %s from %s.",cargv[0],sender);
- return CMD_ERROR;
- }
/* At this stage the nick is cleared to proceed */
np=newnick();
np->realname->nicks=np;
np->timestamp=timestamp;
- base64toip(cargv[cargc-3], &ipaddress);
- np->ipnode = refnode(iptree, &ipaddress, PATRICIA_MAXBITS);
+ memcpy(&(np->ipaddress), &ipaddress, sizeof(ipaddress));
+
+ ip_canonicalize_tunnel(&ipaddress_canonical, &ipaddress);
+ np->ipnode = refnode(iptree, &ipaddress_canonical, PATRICIA_MAXBITS);
node_increment_usercount(np->ipnode);
np->away=NULL;
np->authname=NULLAUTHNAME;
np->auth=NULL;
np->accountts=0;
+ np->cloak_count = 0;
+ np->cloak_extra = NULL;
if(cargc>=9) {
int sethostarg = 6, opernamearg = 6, accountarg = 6;
int handleprivmsg(void *source, int cargc, char **cargv) {
nick *sender;
- char *message;
void *args[3];
if (cargc<2)
if (!match2strings(cargv[0] + 1,myserver->content))
return CMD_OK;
- message=cargv[0];
-
args[0]=sender;
args[1]=cargv[0];
args[2]=cargv[1];
return CMD_OK;
}
+
+int handleaddcloak(void *source, int cargc, char **cargv) {
+ nick *sender, *target;
+
+ /* Check source is a valid user */
+ if (!(sender=getnickbynumericstr(source))) {
+ return CMD_OK;
+ }
+
+ if (cargc < 1)
+ return CMD_OK;
+
+ if (!(target=getnickbynumericstr(cargv[0]))) {
+ return CMD_OK;
+ }
+
+ addcloaktarget(sender, target);
+
+ return CMD_OK;
+}
+
+int handleclearcloak(void *source, int cargc, char **cargv) {
+ nick *sender;
+
+ /* Check source is a valid user */
+ if (!(sender=getnickbynumericstr(source))) {
+ return CMD_OK;
+ }
+
+ clearcloaktargets(sender);
+
+ return CMD_OK;
+}
+