/* :%s NEWMASK %s parv[0] = sender parv[1] = new mask (if no '@', hostname is assumed) */ int denora_event_newmask(char *source, int ac, char **av) { char *newhost; char *newuser; if (denora->protocoldebug) { protocol_debug(source, ac, av); } if (ac != 1) { return MOD_CONT; } newuser = myStrGetOnlyToken(av[0], '@', 0); if (newuser) { newhost = myStrGetTokenRemainder(av[0], '@', 1); change_user_username(source, newuser); free(newuser); } else { newhost = av[0]; } if (*newhost == '@') newhost++; if (newhost) { change_user_host(source, newhost); } return MOD_CONT; }
int denora_event_setident(char *source, int ac, char **av) { if (denora->protocoldebug) { protocol_debug(source, ac, av); } change_user_username(source, av[0]); return MOD_CONT; }
int denora_event_chgident(char *source, int ac, char **av) { if (denora->protocoldebug) { protocol_debug(source, ac, av); } if (ac != 2) return MOD_CONT; change_user_username(av[0], av[1]); return MOD_CONT; }
int xanadu_event_chgident(char *source, int ac, char **av) { User *u; if (ac != 2) return MOD_CONT; u = finduser(av[0]); if (!u) { if (debug) { alog("debug: CHGIDENT for nonexistent user %s", av[0]); } return MOD_CONT; } change_user_username(u, av[1]); return MOD_CONT; }
int denora_event_encap(char *source, int ac, char **av) { char *newav[3]; if (denora->protocoldebug) { protocol_debug(source, ac, av); } if (!stricmp(av[1], "CHGNAME")) { change_user_realname(av[2], av[3]); } if (!stricmp(av[1], "CHGHOST")) { change_user_host(av[2], av[3]); } if (!stricmp(av[1], "CHGIDENT")) { change_user_username(av[2], av[3]); } if (!stricmp(av[1], "XLINE")) { sql_do_xline(av[3], av[5]); } if (!stricmp(av[1], "SVSNICK")) { do_nick(av[2], av[3], NULL, NULL, NULL, NULL, time(NULL), 0, NULL, NULL, NULL, 0, NULL, NULL); } if (!stricmp(av[1], "SVSMODE")) { newav[0] = av[2]; newav[1] = av[4]; newav[2] = av[3]; denora_event_svsmode(source, 3, newav); } return MOD_CONT; }
int denora_event_nick(char *source, int ac, char **av) { User *user; Server *s; char *temp; char *ipchar; if (denora->protocoldebug) { protocol_debug(source, ac, av); } temp = sstrdup(source); if (ac != 2) { char *realname, *ip, *nick; char *ident, *host, *modes, *modes2; const char *uid = ""; const char *account = ""; char *fakehost = NULL; char *sethost = NULL; char *hiddenhost = NULL; char *hiddenip = NULL; const char *timestamp = ""; char hhostbuf[255] = ""; int ishidden = 0, isaccount = 0; s = server_find(source); *source = '\0'; realname = sstrdup(av[ac - 1]); uid = sstrdup(av[ac - 2]); ip = sstrdup(av[ac - 3]); nick = sstrdup(av[0]); ident = sstrdup(av[3]); host = sstrdup(av[4]); modes = sstrdup(av[5]); modes2 = sstrdup(av[5]); if (strpbrk(av[5], "+")) { int cnt = 6; int c = 1; char *uaccount = sstrdup(""); char *acc = NULL; while (*modes) { switch (*modes) { case 'r': isaccount = 1; uaccount = av[cnt++]; for (acc = strtok(uaccount, ":"); acc; acc = strtok(NULL, ":")) { if (c == 1) account = sstrdup(acc); else if (c == 2) timestamp = sstrdup(acc); c++; } c = 1; break; case 'h': sethost = sstrdup(av[cnt++]); break; case 'f': fakehost = sstrdup(av[cnt++]); break; case 'c': hiddenip = sstrdup(av[cnt++]); break; case 'C': hiddenhost = sstrdup(av[cnt++]); break; case 'x': ishidden = 1; break; default: break; } modes++; } modes = sstrdup(modes2); } else modes = NULL; /* do_nick(const char *source, char *nick, char *username, char *host, char *server, char *realname, time_t ts, uint32 svid, uint32 ip, char *vhost, char *uid, int hopcount, char *modes, char *account) */ ipchar = nefarious_nickip(ip); if (ishidden) { if (hiddenhost) { ircsnprintf(hhostbuf, sizeof(hhostbuf) + 3, "%s", hiddenhost); } else if (isaccount) { ircsnprintf(hhostbuf, sizeof(account) + sizeof(hhostbuf) + 2, "%s%s%s", HiddenPrefix, account, HiddenSuffix); } } user = do_nick(source, nick, ident, host, (s ? s->name : temp), realname, strtoul(av[2], NULL, 10), 0, ipchar, hhostbuf, (char *) uid, strtoul(av[1], NULL, 10), modes, (char *) account); if (user) { if (fakehost || sethost) { const char *vhost = ""; if (sethost) { int h = 1; char *uh = NULL; const char *vident = ""; for (uh = strtok(sethost, "@"); uh; uh = strtok(NULL, "@")) { if (h == 1) vident = uh; else if (h == 2) vhost = uh; h++; } h = 1; change_user_username(user->nick, (char *) vident); } change_user_host(user->nick, sethost ? (char *) vhost : fakehost); /* set host as ip */ } } free(ipchar); } else { /* Nick change */ user = find_byuid(source); do_nick((user ? user->nick : source), av[0], NULL, NULL, NULL, NULL, strtoul(av[1], NULL, 10), 0, NULL, NULL, NULL, 0, NULL, NULL); } free(temp); return MOD_CONT; }