}
/*
- * registerlocaluserwithuserid:
+ * registerlocaluserwithuseridflags:
* This function creates a local user, and broadcasts it's existence to the net (if connected).
*/
-nick *registerlocaluserwithuserid(char *nickname, char *ident, char *host, char *realname, char *authname, unsigned long authid, flag_t umodes, UserMessageHandler handler) {
+nick *registerlocaluserwithuseridflags(char *nickname, char *ident, char *host, char *realname, char *authname, unsigned long authid, flag_t umodes, flag_t accountflags, UserMessageHandler handler) {
int i;
nick *newuser,*np;
struct irc_in_addr ipaddress;
newuser->nextbyrealname=newuser->realname->nicks;
newuser->realname->nicks=newuser;
newuser->umodes=umodes;
+ newuser->accountflags=accountflags;
memset(&ipaddress, 0, sizeof(ipaddress));
((unsigned short *)(ipaddress.in6_16))[5] = 65535;
numericbuf[5]='\0';
if (IsAccount(np)) {
- if (np->auth) {
- irc_send("%s N %s 1 %ld %s %s %s %s:%ld:%lu %s %s :%s",
+ if(np->accountflags) {
+ irc_send("%s N %s 1 %ld %s %s %s %s:%ld:%lu:" FLAG_T_SPECIFIER " %s %s :%s",
mynumeric->content,np->nick,np->timestamp,np->ident,np->host->name->content,
- printflags(np->umodes,umodeflags),np->authname,np->accountts,np->auth->userid,
+ printflags(np->umodes,umodeflags),np->authname,np->accountts,np->auth?np->auth->userid:0,np->accountflags,
iptobase64(ipbuf, &(np->p_ipaddr), sizeof(ipbuf), 1),numericbuf,np->realname->name->content);
+ } else if (np->auth) {
+ irc_send("%s N %s 1 %ld %s %s %s %s:%ld:%lu %s %s :%s",
+ mynumeric->content,np->nick,np->timestamp,np->ident,np->host->name->content,
+ printflags(np->umodes,umodeflags),np->authname,np->accountts,np->auth->userid,
+ iptobase64(ipbuf, &(np->p_ipaddr), sizeof(ipbuf), 1),numericbuf,np->realname->name->content);
} else if (np->accountts) {
irc_send("%s N %s 1 %ld %s %s %s %s:%ld %s %s :%s",
mynumeric->content,np->nick,np->timestamp,np->ident,np->host->name->content,
}
}
+void sethostuser(nick *target, char *ident, char *host) {
+ irc_send("%s SH %s %s %s", mynumeric->content, longtonumeric(target->numeric, 5), ident, host);
+}
+
void _killuser(nick *source, nick *target, char *reason) {
char senderstr[6];
char sourcestring[HOSTLEN+NICKLEN+3];
}
/* Auth user */
-void localusersetaccountwithuserid(nick *np, char *accname, unsigned long accid) {
+void localusersetaccountwithuseridflags(nick *np, char *accname, unsigned long accid, flag_t accountflags) {
if (IsAccount(np)) {
Error("localuser",ERR_WARNING,"Tried to set account on user %s already authed", np->nick);
return;
strncpy(np->authname, accname, ACCOUNTLEN);
np->authname[ACCOUNTLEN]='\0';
np->accountts=getnettime();
+ np->accountflags=accountflags;
if (accid) {
np->auth=findorcreateauthname(accid);
}
if (connected) {
- if (np->auth) {
+ if (np->accountflags) {
+ irc_send("%s AC %s %s %ld %lu %lu",mynumeric->content, longtonumeric(np->numeric,5), np->authname, np->accountts, np->auth?np->auth->userid:0, np->accountflags);
+ } else if (np->auth) {
irc_send("%s AC %s %s %ld %lu",mynumeric->content, longtonumeric(np->numeric,5), np->authname, np->accountts, np->auth->userid);
} else {
irc_send("%s AC %s %s %ld",mynumeric->content, longtonumeric(np->numeric,5), np->authname, np->accountts);