]> jfr.im git - irc/quakenet/newserv.git/blame - localuser/localuser.c
Add eXtended service broadcast module (allows sending of authflags without ircd support).
[irc/quakenet/newserv.git] / localuser / localuser.c
CommitLineData
c86edd1d
Q
1/* localuser.c */
2
3#include "../nick/nick.h"
4#include "../lib/base64.h"
526e7c1d 5#include "../lib/sstring.h"
c86edd1d
Q
6#include "../irc/irc.h"
7#include "../irc/irc_config.h"
8#include "../core/hooks.h"
9#include "../core/error.h"
87698d77 10#include "../lib/version.h"
c86edd1d
Q
11#include "localuser.h"
12
13#include <string.h>
14#include <stdarg.h>
15#include <stdio.h>
16
70b0a4e5 17MODULE_VERSION("");
87698d77 18
c86edd1d
Q
19int currentlocalunum;
20UserMessageHandler umhandlers[MAXLOCALUSER+1];
21
526e7c1d
P
22typedef struct pendingkill {
23 nick *source, *target;
24 sstring *reason;
25 struct pendingkill *next;
26} pendingkill;
27
28pendingkill *pendingkilllist;
29
c86edd1d 30void checklocalkill(int hooknum, void *nick);
526e7c1d
P
31void clearpendingkills(int hooknum, void *arg);
32void checkpendingkills(int hooknum, void *arg);
33void _killuser(nick *source, nick *target, char *reason);
c86edd1d
Q
34
35void _init() {
36 int i;
37
38 for (i=0;i<=MAXLOCALUSER;i++) {
39 umhandlers[i]=NULL;
40 }
41 currentlocalunum=1;
526e7c1d 42 pendingkilllist=NULL;
c86edd1d 43 registerhook(HOOK_IRC_SENDBURSTNICKS,&sendnickburst);
acd438c7 44 registerhook(HOOK_NICK_KILL,&checklocalkill);
ff99b5c0 45 registerhook(HOOK_NICK_LOSTNICK,&checkpendingkills); /* CHECK ME -> should this hook KILL or LOSTNICK or BOTH */
526e7c1d 46 registerhook(HOOK_CORE_ENDOFHOOKSQUEUE,&clearpendingkills);
c86edd1d
Q
47 registerserverhandler("P",&handleprivatemsgcmd,2);
48 registerserverhandler("O",&handleprivatenoticecmd, 2);
49}
50
df3bf970
CP
51void _fini() {
52 pendingkill *pk;
53
54 for (pk=pendingkilllist;pk;pk=pendingkilllist) {
55 pendingkilllist = pk->next;
56 freesstring(pk->reason);
57 free(pk);
58 }
65f2c6a3 59
60 deregisterhook(HOOK_IRC_SENDBURSTNICKS,&sendnickburst);
61 deregisterhook(HOOK_NICK_KILL,&checklocalkill);
62 deregisterhook(HOOK_NICK_LOSTNICK,&checkpendingkills); /* CHECK ME -> should this hook KILL or LOSTNICK or BOTH */
63 deregisterhook(HOOK_CORE_ENDOFHOOKSQUEUE,&clearpendingkills);
646b8161 64
65 deregisterserverhandler("P",&handleprivatemsgcmd);
66 deregisterserverhandler("O",&handleprivatenoticecmd);
df3bf970
CP
67}
68
c86edd1d 69/*
c153c0dc 70 * registerlocaluserwithuseridflags:
c86edd1d
Q
71 * This function creates a local user, and broadcasts it's existence to the net (if connected).
72 */
73
c153c0dc 74nick *registerlocaluserwithuseridflags(char *nickname, char *ident, char *host, char *realname, char *authname, unsigned long authid, flag_t umodes, flag_t accountflags, UserMessageHandler handler) {
c86edd1d
Q
75 int i;
76 nick *newuser,*np;
526e7c1d
P
77 struct irc_in_addr ipaddress;
78
c86edd1d 79 i=0;
95ee3dac 80 currentlocalunum=(currentlocalunum+1)%262142;
c86edd1d
Q
81 while (servernicks[numerictolong(mynumeric->content,2)][currentlocalunum&MAXLOCALUSER]!=NULL) {
82 /* Numeric 262143 on our server is used for "nouser" by the channels module, so cannot be allocated */
83 currentlocalunum=(currentlocalunum+1)%262142;
84 if (++i>MAXLOCALUSER) {
85 return NULL;
86 }
87 }
88
89 /* This code is very similar to stuff in nick.c... */
90 newuser=newnick();
91 newuser->numeric=(numerictolong(mynumeric->content,2)<<18)|(currentlocalunum);
92 strncpy(newuser->nick,nickname,NICKLEN);
93 newuser->nick[NICKLEN]='\0';
94 strncpy(newuser->ident,ident,USERLEN);
95 newuser->ident[USERLEN]='\0';
96 newuser->host=findorcreatehost(host);
97 newuser->realname=findorcreaterealname(realname);
98 newuser->nextbyhost=newuser->host->nicks;
99 newuser->host->nicks=newuser;
100 newuser->nextbyrealname=newuser->realname->nicks;
101 newuser->realname->nicks=newuser;
102 newuser->umodes=umodes;
526e7c1d 103
526e7c1d 104 memset(&ipaddress, 0, sizeof(ipaddress));
c426783d 105 ((unsigned short *)(ipaddress.in6_16))[5] = 65535;
4f077f54
P
106 ((unsigned short *)(ipaddress.in6_16))[6] = 127;
107 ((unsigned char *)(ipaddress.in6_16))[14] = 1;
108 ((unsigned char *)(ipaddress.in6_16))[15] = (currentlocalunum%253)+1;
526e7c1d
P
109
110 newuser->ipnode = refnode(iptree, &ipaddress, PATRICIA_MAXBITS);
96644df6 111 node_increment_usercount(newuser->ipnode);
c426783d 112
c86edd1d
Q
113 newuser->timestamp=getnettime();
114 newuser->shident=NULL;
115 newuser->sethost=NULL;
116 newuser->marker=0;
117 memset(newuser->exts, 0, MAXNICKEXTS * sizeof(void *));
118
119 if (IsAccount(newuser)) {
120 strncpy(newuser->authname,authname,ACCOUNTLEN);
47657339
C
121 newuser->accountts=newuser->timestamp;
122 if (authid) {
5a335041 123 newuser->auth=findorcreateauthname(authid, newuser->authname);
47657339
C
124 newuser->auth->usercount++;
125 newuser->nextbyauthname=newuser->auth->nicks;
126 newuser->auth->nicks=newuser;
0b0fb773 127 newuser->auth->flags=accountflags;
47657339
C
128 } else {
129 newuser->auth=NULL;
130 }
c86edd1d
Q
131 } else {
132 newuser->authname[0]='\0';
47657339
C
133 newuser->accountts=0;
134 newuser->auth=NULL;
c86edd1d
Q
135 }
136
137 if (connected) {
138 /* Check for nick collision */
139 if ((np=getnickbynick(nickname))!=NULL) {
140 /* Make sure we will win the collision */
141 newuser->timestamp=(np->timestamp-1);
142 killuser(NULL, np, "Nick collision");
143 }
144 sendnickmsg(newuser);
145 }
146
147 if (handler!=NULL) {
148 umhandlers[(currentlocalunum&MAXLOCALUSER)]=handler;
149 }
150
151 *(gethandlebynumeric(newuser->numeric))=newuser;
152 addnicktohash(newuser);
153 triggerhook(HOOK_NICK_NEWNICK,newuser);
154
155 return newuser;
156}
157
158/*
159 * renamelocaluser:
160 * This function changes the name of a given local user
161 */
162
163int renamelocaluser(nick *np, char *newnick) {
164 nick *np2;
526e7c1d 165 char ipbuf[25];
c86edd1d
Q
166 time_t timestamp=getnettime();
167
168 if (!np)
169 return -1;
170
171 if (strlen(newnick) > NICKLEN)
172 return -1;
173
174 if (homeserver(np->numeric)!=mylongnum)
175 return -1;
176
177 if ((np2=getnickbynick(newnick))) {
178 if (np2==np) {
179 /* Case only name change */
180 strncpy(np->nick,newnick,NICKLEN);
181 np->nick[NICKLEN]='\0';
526e7c1d
P
182 irc_send("%s N %s %d",iptobase64(ipbuf, &(np->p_ipaddr), sizeof(ipbuf), 1),np->nick,np->timestamp);
183 triggerhook(HOOK_NICK_RENAME,np);
c86edd1d
Q
184 return 0;
185 } else {
186 /* Kill other user and drop through */
187 timestamp=np2->timestamp-1;
188 killuser(NULL, np2, "Nick collision");
189 }
190 }
191
192 np->timestamp=timestamp;
193 removenickfromhash(np);
194 strncpy(np->nick,newnick,NICKLEN);
195 np->nick[NICKLEN]='\0';
196 addnicktohash(np);
197 irc_send("%s N %s %d",longtonumeric(np->numeric,5),np->nick,np->timestamp);
198 triggerhook(HOOK_NICK_RENAME,np);
199
200 return 0;
201}
202
203/*
204 * deregisterlocaluser:
205 * This function removes the given local user from the network
206 */
207
208int deregisterlocaluser(nick *np, char *reason) {
c86edd1d 209 long numeric;
73ab573f 210 char reasonstr[512];
211 void *harg[2];
c86edd1d
Q
212
213 if (np==NULL || (homeserver(np->numeric)!=mylongnum)) {
214 /* Non-existent user, or user not on this server */
215 return -1;
216 }
217
218 if (reason==NULL || *reason=='\0') {
73ab573f 219 sprintf(reasonstr,"Quit");
220 } else {
221 snprintf(reasonstr,510,"Quit: %s",reason);
c86edd1d
Q
222 }
223
73ab573f 224 harg[0]=np;
225 harg[1]=reasonstr;
226
227 triggerhook(HOOK_NICK_QUIT, harg);
228
c86edd1d
Q
229 numeric=np->numeric;
230 umhandlers[np->numeric&MAXLOCALUSER]=NULL;
231 deletenick(np);
232 if (connected) {
73ab573f 233 irc_send("%s Q :%s",longtonumeric(numeric,5),reasonstr);
c86edd1d
Q
234 }
235
236 return 0;
237}
238
c5f1f827
CP
239/*
240 * hooklocaluserhandler:
241 * This function adds a new handler to the hook chain for a local user
242 * THIS RELIES ON MODULES BEING UNLOADED IN THE CORRECT ORDER.
243 */
244UserMessageHandler hooklocaluserhandler(nick *np, UserMessageHandler newhandler) {
245 UserMessageHandler oldhandler = NULL;
246 if (np==NULL || (homeserver(np->numeric)!=mylongnum)) {
247 /* Non-existent user, or user not on this server */
248 return NULL;
249 }
250 oldhandler = umhandlers[np->numeric&MAXLOCALUSER];
251 umhandlers[np->numeric&MAXLOCALUSER]=newhandler;
252 return oldhandler;
253}
254
c86edd1d
Q
255/*
256 * sendnickmsg:
257 * Sends details of a given local nick to the network.
258 */
259
260void sendnickmsg(nick *np) {
261 char numericbuf[6];
526e7c1d 262 char ipbuf[25];
c86edd1d
Q
263
264 strncpy(numericbuf,longtonumeric(np->numeric,5),5);
265 numericbuf[5]='\0';
266
47657339 267 if (IsAccount(np)) {
0b0fb773
CP
268 if (np->auth) {
269 if(np->auth->flags) {
270 irc_send("%s N %s 1 %ld %s %s %s %s:%ld:%lu:" FLAG_T_SPECIFIER " %s %s :%s",
271 mynumeric->content,np->nick,np->timestamp,np->ident,np->host->name->content,
272 printflags(np->umodes,umodeflags),np->authname,np->accountts,np->auth->userid,np->auth->flags,
273 iptobase64(ipbuf, &(np->p_ipaddr), sizeof(ipbuf), 1),numericbuf,np->realname->name->content);
274 } else {
c153c0dc
CP
275 irc_send("%s N %s 1 %ld %s %s %s %s:%ld:%lu %s %s :%s",
276 mynumeric->content,np->nick,np->timestamp,np->ident,np->host->name->content,
277 printflags(np->umodes,umodeflags),np->authname,np->accountts,np->auth->userid,
278 iptobase64(ipbuf, &(np->p_ipaddr), sizeof(ipbuf), 1),numericbuf,np->realname->name->content);
0b0fb773 279 }
47657339
C
280 } else if (np->accountts) {
281 irc_send("%s N %s 1 %ld %s %s %s %s:%ld %s %s :%s",
282 mynumeric->content,np->nick,np->timestamp,np->ident,np->host->name->content,
283 printflags(np->umodes,umodeflags),np->authname,np->accountts,
27ce0548 284 iptobase64(ipbuf, &(np->p_ipaddr), sizeof(ipbuf), 1),numericbuf,np->realname->name->content);
47657339
C
285 } else {
286 irc_send("%s N %s 1 %ld %s %s %s %s %s %s :%s",
287 mynumeric->content,np->nick,np->timestamp,np->ident,np->host->name->content,
288 printflags(np->umodes,umodeflags),np->authname,
27ce0548 289 iptobase64(ipbuf, &(np->p_ipaddr), sizeof(ipbuf), 1),numericbuf,np->realname->name->content);
47657339
C
290 }
291 } else {
292 irc_send("%s N %s 1 %ld %s %s %s %s %s :%s",
293 mynumeric->content,np->nick,np->timestamp,np->ident,np->host->name->content,
27ce0548 294 printflags(np->umodes,umodeflags),iptobase64(ipbuf, &(np->p_ipaddr), sizeof(ipbuf), 1),
47657339
C
295 numericbuf,np->realname->name->content);
296 }
c86edd1d
Q
297}
298
299void sendnickburst(int hooknum, void *arg) {
300 /* Send nick messages for all local users */
301 nick **nh;
302 int i;
303
304 nh=servernicks[numerictolong(mynumeric->content,2)];
305 for (i=0;i<=MAXLOCALUSER;i++) {
306 if (nh[i]!=NULL) {
307 sendnickmsg(nh[i]);
308 }
309 }
310}
311
312/* Check for a kill of a local user */
acd438c7
CP
313void checklocalkill(int hooknum, void *arg) {
314 void **args=arg;
315 nick *target=args[0];
316 char *reason=args[1];
c86edd1d 317 long numeric;
acd438c7
CP
318
319 void *myargs[1];
320 myargs[0]=reason;
321
c86edd1d
Q
322
323 numeric=((nick *)target)->numeric;
324
325 if (homeserver(numeric)==mylongnum) {
326 if (umhandlers[(numeric)&MAXLOCALUSER]!=NULL) {
acd438c7 327 (umhandlers[(numeric)&MAXLOCALUSER])((nick *)target,LU_KILLED,myargs);
c86edd1d
Q
328 }
329 }
330}
331
332int handleprivatemsgcmd(void *source, int cargc, char **cargv) {
333 return handlemessageornotice(source, cargc, cargv, 0);
334}
335
336int handleprivatenoticecmd(void *source, int cargc, char **cargv) {
337 return handlemessageornotice(source, cargc, cargv, 1);
338}
339
340/* Handle privmsg or notice command addressed to user */
341int handlemessageornotice(void *source, int cargc, char **cargv, int isnotice) {
342 nick *sender;
343 nick *target;
344 char *ch;
345 char targetnick[NICKLEN+1];
346 int foundat;
347 void *nargs[2];
348 int i;
349
350 /* Should have target and message */
351 if (cargc<2) {
352 return CMD_OK;
353 }
354
355 if (cargv[0][0]=='#' || cargv[0][0]=='+') {
356 /* Channel message/notice */
357 return CMD_OK;
358 }
359
360 if ((sender=getnickbynumericstr((char *)source))==NULL) {
361 Error("localuser",ERR_WARNING,"PRIVMSG from non existant user %s",(char *)source);
362 return CMD_OK;
363 }
364
365 /* Check for a "secure" message (foo@bar) */
366 foundat=0;
367 for (i=0,ch=cargv[0];(i<=NICKLEN) && (*ch);i++,ch++) {
368 if (*ch=='@') {
369 targetnick[i]='\0';
370 foundat=1;
371 break;
372 } else {
373 targetnick[i]=*ch;
374 }
375 }
376
377 if (!foundat) { /* Didn't find an @ sign, assume it's a numeric */
378 if ((target=getnickbynumericstr(cargv[0]))==NULL) {
379 Error("localuser",ERR_DEBUG,"Couldn't find target for %s",cargv[0]);
380 return CMD_OK;
381 }
382 } else { /* Did find @, do a lookup by nick */
383 if ((target=getnickbynick(targetnick))==NULL) {
384 Error("localuser",ERR_DEBUG,"Couldn't find target for %s",cargv[0]);
bc81aa36 385 irc_send(":%s 401 %s %s :No such nick",myserver->content,sender->nick,cargv[0]);
c86edd1d
Q
386 return CMD_OK;
387 }
388 }
389
390 if (homeserver(target->numeric)!=mylongnum) {
391 Error("localuser",ERR_WARNING,"Got message/notice for someone not on my server");
bc81aa36
C
392 irc_send(":%s 401 %s %s :No such nick",myserver->content,sender->nick,cargv[0]);
393 return CMD_OK;
394 }
395
396 if (foundat && !IsService(target)) {
397 Error("localuser",ERR_DEBUG,"Received secure message for %s, but user is not a service",cargv[0]);
398 irc_send(":%s 401 %s %s :No such nick",myserver->content,sender->nick,cargv[0]);
c86edd1d
Q
399 return CMD_OK;
400 }
401
402 if (umhandlers[(target->numeric)&MAXLOCALUSER]==NULL) {
403 /* No handler anyhow.. */
404 return CMD_OK;
405 }
406
407 /* Dispatch the message. */
408 nargs[0]=(void *)sender;
409 nargs[1]=(void *)cargv[1];
410 (umhandlers[(target->numeric)&MAXLOCALUSER])(target,isnotice?LU_PRIVNOTICE:(foundat?LU_SECUREMSG:LU_PRIVMSG),nargs);
411
412 return CMD_OK;
413}
414
415/* Send message to user */
416void sendmessagetouser(nick *source, nick *target, char *format, ... ) {
417 char buf[BUFSIZE];
418 char senderstr[6];
419 va_list va;
420
421 longtonumeric2(source->numeric,5,senderstr);
422
423 va_start(va,format);
424 /* 10 bytes of numeric, 5 bytes of fixed format + terminator = 17 bytes */
425 /* So max sendable message is 495 bytes. Of course, a client won't be able
426 * to receive this.. */
427
428 vsnprintf(buf,BUFSIZE-17,format,va);
429 va_end(va);
430
431 if (homeserver(target->numeric)!=mylongnum)
432 irc_send("%s P %s :%s",senderstr,longtonumeric(target->numeric,5),buf);
433}
434
435/* Send messageto server, we don't check, but noones going to want to put a server pointer in anyway... */
436void sendsecuremessagetouser(nick *source, nick *target, char *servername, char *format, ... ) {
437 char buf[BUFSIZE];
438 char senderstr[6];
439 va_list va;
440
441 longtonumeric2(source->numeric,5,senderstr);
442
443 va_start(va,format);
444 /* 10 bytes of numeric, 5 bytes of fixed format + terminator = 17 bytes */
445 /* So max sendable message is 495 bytes. Of course, a client won't be able
446 * to receive this.. */
447
448 vsnprintf(buf,BUFSIZE-17,format,va);
449 va_end(va);
450
451 if (homeserver(target->numeric)!=mylongnum)
452 irc_send("%s P %s@%s :%s",senderstr,target->nick,servername,buf);
453}
454
455/* Send notice to user */
456void sendnoticetouser(nick *source, nick *target, char *format, ... ) {
457 char buf[BUFSIZE];
458 char senderstr[6];
459 va_list va;
460
461 longtonumeric2(source->numeric,5,senderstr);
462
463 va_start(va,format);
464 /* 10 bytes of numeric, 5 bytes of fixed format + terminator = 17 bytes */
465 /* So max sendable message is 495 bytes. Of course, a client won't be able
466 * to receive this.. */
467
468 vsnprintf(buf,BUFSIZE-17,format,va);
469 va_end(va);
470
471 if (homeserver(target->numeric)!=mylongnum)
472 irc_send("%s O %s :%s",senderstr,longtonumeric(target->numeric,5),buf);
473}
474
475/* Kill user */
476void killuser(nick *source, nick *target, char *format, ... ) {
477 char buf[BUFSIZE];
526e7c1d
P
478 va_list va;
479 pendingkill *pk;
480
481 va_start(va, format);
482 vsnprintf(buf, BUFSIZE-17, format, va);
483 va_end (va);
484
485 if (hookqueuelength) {
486 for (pk = pendingkilllist; pk; pk = pk->next)
487 if (pk->target == target)
488 return;
489
a77bd764 490 Error("localuser", ERR_DEBUG, "Adding pending kill for %s", target->nick);
526e7c1d
P
491 pk = (pendingkill *)malloc(sizeof(pendingkill));
492 pk->source = source;
493 pk->target = target;
494 pk->reason = getsstring(buf, BUFSIZE);
495 pk->next = pendingkilllist;
496 pendingkilllist = pk;
497 } else {
498 _killuser(source, target, buf);
499 }
500}
501
ab2c2b20
CP
502void sethostuser(nick *target, char *ident, char *host) {
503 irc_send("%s SH %s %s %s", mynumeric->content, longtonumeric(target->numeric, 5), ident, host);
504}
505
526e7c1d 506void _killuser(nick *source, nick *target, char *reason) {
c86edd1d 507 char senderstr[6];
616eddc9 508 char sourcestring[HOSTLEN+NICKLEN+3];
c86edd1d
Q
509
510 if (!source) {
511 /* If we have a null nick, use the server.. */
512 strcpy(senderstr, mynumeric->content);
513 strcpy(sourcestring, myserver->content);
514 } else {
515 strcpy(senderstr, longtonumeric(source->numeric,5));
516 sprintf(sourcestring,"%s!%s",source->host->name->content, source->nick);
517 }
518
526e7c1d 519 irc_send("%s D %s :%s (%s)",senderstr,longtonumeric(target->numeric,5),sourcestring,reason);
c86edd1d
Q
520 deletenick(target);
521}
522
526e7c1d
P
523void clearpendingkills(int hooknum, void *arg) {
524 pendingkill *pk;
525
526 pk = pendingkilllist;
527 while (pk) {
528 pendingkilllist = pk->next;
529
530 if (pk->target) {
a77bd764 531 Error("localuser", ERR_DEBUG, "Processing pending kill for %s", pk->target->nick);
526e7c1d
P
532 _killuser(pk->source, pk->target, pk->reason->content);
533 }
534
535 freesstring(pk->reason);
536 free(pk);
537 pk = pendingkilllist;
538 }
539}
540
541void checkpendingkills(int hooknum, void *arg) {
542 nick *np = (nick *)arg;
543 pendingkill *pk;
544
545 for (pk=pendingkilllist; pk; pk = pk->next) {
546 if (pk->source == np) {
547 Error("localuser", ERR_INFO, "Pending kill source %s got deleted, NULL'ing source for pending kill", np->nick);
548 pk->source = NULL;
549 }
550 if (pk->target == np) {
551 Error("localuser", ERR_INFO, "Pending kill target %s got deleted, NULL'ing target for pending kill", np->nick);
552 pk->target = NULL;
553 }
554 }
555}
556
c86edd1d 557/* Auth user */
b17a30ed 558void localusersetaccountwithuseridflagsts(nick *np, char *accname, unsigned long accid, flag_t accountflags, time_t authTS) {
c86edd1d
Q
559 if (IsAccount(np)) {
560 Error("localuser",ERR_WARNING,"Tried to set account on user %s already authed", np->nick);
561 return;
562 }
563
564 SetAccount(np);
565 strncpy(np->authname, accname, ACCOUNTLEN);
566 np->authname[ACCOUNTLEN]='\0';
b17a30ed 567 np->accountts=authTS?authTS:getnettime();
47657339
C
568
569 if (accid) {
5a335041 570 np->auth=findorcreateauthname(accid, accname);
47657339
C
571 np->auth->usercount++;
572 np->nextbyauthname=np->auth->nicks;
573 np->auth->nicks=np;
0b0fb773 574 np->auth->flags=accountflags;
47657339
C
575 } else {
576 np->auth=NULL;
577 }
c86edd1d
Q
578
579 if (connected) {
0b0fb773
CP
580 if (np->auth) {
581 if (np->auth->flags) {
582 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);
583 } else {
584 irc_send("%s AC %s %s %ld %lu",mynumeric->content, longtonumeric(np->numeric,5), np->authname, np->accountts, np->auth->userid);
585 }
47657339
C
586 } else {
587 irc_send("%s AC %s %s %ld",mynumeric->content, longtonumeric(np->numeric,5), np->authname, np->accountts);
588 }
c86edd1d
Q
589 }
590
591 triggerhook(HOOK_NICK_ACCOUNT, np);
592}
593
eac66732
CP
594void localusersetumodes(nick *np, flag_t newmodes) {
595 if (connected) {
596 irc_send("%s M %s %s", longtonumeric(np->numeric,5), np->nick, printflagdiff(np->umodes, newmodes, umodeflags));
597 }
598
599 np->umodes = newmodes;
600}