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