#include <string.h>
#include <stdarg.h>
#include <stdio.h>
+#include <inttypes.h>
MODULE_VERSION("");
newuser->accountts=0;
newuser->auth=NULL;
- newuser->authname=NULL;
+ newuser->authname=NULLAUTHNAME;
if (IsAccount(newuser)) {
newuser->accountts=newuser->timestamp;
if (authid) {
/* Case only name change */
strncpy(np->nick,newnick,NICKLEN);
np->nick[NICKLEN]='\0';
- irc_send("%s N %s %d",iptobase64(ipbuf, &(np->p_ipaddr), sizeof(ipbuf), 1),np->nick,np->timestamp);
+ irc_send("%s N %s %jd",iptobase64(ipbuf, &(np->p_ipaddr), sizeof(ipbuf), 1),np->nick,(intmax_t)np->timestamp);
triggerhook(HOOK_NICK_RENAME,np);
return 0;
} else {
strncpy(np->nick,newnick,NICKLEN);
np->nick[NICKLEN]='\0';
addnicktohash(np);
- irc_send("%s N %s %d",longtonumeric(np->numeric,5),np->nick,np->timestamp);
+ irc_send("%s N %s %jd",longtonumeric(np->numeric,5),np->nick,(intmax_t)np->timestamp);
triggerhook(HOOK_NICK_RENAME,np);
return 0;
if (IsAccount(np)) {
if (np->auth) {
if(np->auth->flags) {
- snprintf(accountbuf,sizeof(accountbuf)," %s:%ld:%lu:" FLAG_T_SPECIFIER,np->authname,np->accountts,np->auth->userid,np->auth->flags);
+ snprintf(accountbuf,sizeof(accountbuf)," %s:%ld:%lu:%"PRIu64,np->authname,np->accountts,np->auth->userid,np->auth->flags);
} else {
snprintf(accountbuf,sizeof(accountbuf)," %s:%ld:%lu",np->authname,np->accountts,np->auth->userid);
}
void _killuser(nick *source, nick *target, char *reason) {
char senderstr[6];
char sourcestring[HOSTLEN+NICKLEN+3];
+ char reasonstr[512];
+ void *args[2];
if (!source) {
/* If we have a null nick, use the server.. */
sprintf(sourcestring,"%s!%s",source->host->name->content, source->nick);
}
- irc_send("%s D %s :%s (%s)",senderstr,longtonumeric(target->numeric,5),sourcestring,reason);
+ snprintf(reasonstr,512,"%s (%s)",sourcestring,reason);
+ reasonstr[511]='\0';
+
+ irc_send("%s D %s :%s",senderstr,longtonumeric(target->numeric,5),reasonstr);
+
+ args[0]=target;
+ args[1]=reasonstr;
+ triggerhook(HOOK_NICK_KILL, args);
+
deletenick(target);
}
}
void sendaccountmessage(nick *np) {
- if (connected) {
+ if (connected && IsAccount(np)) {
if (np->auth) {
if (np->auth->flags) {
- irc_send("%s AC %s %s %ld %lu %lu",mynumeric->content, longtonumeric(np->numeric,5), np->authname, np->accountts, np->auth->userid, np->auth->flags);
+ irc_send("%s AC %s %s %ld %lu %"PRIu64,mynumeric->content, longtonumeric(np->numeric,5), np->authname, np->accountts, np->auth->userid, np->auth->flags);
} else {
irc_send("%s AC %s %s %ld %lu",mynumeric->content, longtonumeric(np->numeric,5), np->authname, np->accountts, np->auth->userid);
}
}
/* Auth user, don't use to set flags after authing */
-void localusersetaccount(nick *np, char *accname, unsigned long accid, flag_t accountflags, time_t authTS) {
+void localusersetaccount(nick *np, char *accname, unsigned long accid, u_int64_t accountflags, time_t authTS) {
if (IsAccount(np)) {
Error("localuser",ERR_WARNING,"Tried to set account on user %s already authed", np->nick);
return;
np->umodes = newmodes;
}
-void localusersetaccountflags(authname *anp, flag_t accountflags) {
+void localusersetaccountflags(authname *anp, u_int64_t accountflags) {
void *arg[2];
nick *np;
+ u_int64_t oldflags = anp->flags;
- arg[0] = (void *)anp;
- arg[1] = (void *)(long)anp->flags;
+ arg[0] = anp;
+ arg[1] = &oldflags;
anp->flags = accountflags;
- for(np=anp->nicks;np;np=np->next)
+ for(np=anp->nicks;np;np=np->nextbyauthname)
sendaccountmessage(np);
- triggerhook(HOOK_AUTH_FLAGSUPDATED, arg);
+ triggerhook(HOOK_AUTH_FLAGSUPDATED, arg);
}