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;
+ np->message = NULL;
if(cargc>=9) {
int sethostarg = 6, opernamearg = 6, accountarg = 6;
nick *np;
flag_t oldflags;
char *fakehost;
+ void *args[2];
if (cargc<2) {
Error("nick",ERR_WARNING,"Mode message with too few parameters");
oldflags=np->umodes;
setflags(&(np->umodes),UMODE_ALL,cargv[1],umodeflags,REJECT_NONE);
+ args[0] = np;
+ args[1] = (void *)oldflags;
+ triggerhook(HOOK_NICK_MODECHANGE, args);
+
if (strchr(cargv[1],'o')) { /* o always comes on its own when being set */
if(serverlist[myhub].flags & SMODE_OPERNAME) {
if((np->umodes & UMODE_OPER)) {
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;
+}
+