]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/xline.cpp
Remove an extern, partly because it's unused, partly because it then gets shadowed...
[user/henk/code/inspircd.git] / src / xline.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
6  *                       E-mail:
7  *                <brain@chatspike.net>
8  *                <Craig@chatspike.net>
9  *     
10  * Written by Craig Edwards, Craig McLure, and others.
11  * This program is free but copyrighted software; see
12  *            the file COPYING for details.
13  *
14  * ---------------------------------------------------
15  */
16
17 using namespace std;
18
19 #include "inspircd_config.h"
20 #include "inspircd.h"
21 #include <string>
22 #include <map>
23 #include <sstream>
24 #include <vector>
25 #include <deque>
26 #include "users.h"
27 #include "ctables.h"
28 #include "globals.h"
29 #include "modules.h"
30 #include "dynamic.h"
31 #include "wildcard.h"
32 #include "message.h"
33 #include "commands.h"
34 #include "xline.h"
35 #include "inspstring.h"
36 #include "helperfuncs.h"
37 #include "hashcomp.h"
38 #include "typedefs.h"
39 #include "cull_list.h"
40
41 extern ServerConfig *Config;
42
43 extern int MODCOUNT;
44 extern std::vector<Module*> modules;
45 extern std::vector<ircd_module*> factory;
46 extern ServerConfig* Config;
47 extern user_hash clientlist;
48 extern std::vector<userrec*> local_users;
49
50 /* Version two, now with optimized expiry!
51  *
52  * Because the old way was horrendously slow, the new way of expiring xlines is very
53  * very efficient. I have improved the efficiency of the algorithm in two ways:
54  *
55  * (1) There are now two lists of items for each linetype. One list holds temporary
56  *     items, and the other list holds permenant items (ones which will expire).
57  *     Items which are on the permenant list are NEVER checked at all by the
58  *     expire_lines() function.
59  * (2) The temporary xline lists are always kept in strict numerical order, keyed by 
60  *     current time + duration. This means that the line which is due to expire the
61  *     soonest is always pointed at by vector::begin(), so a simple while loop can
62  *     very efficiently, very quickly and above all SAFELY pick off the first few
63  *     items in the vector which need zapping.
64  *
65  *     -- Brain
66  */
67
68
69
70 extern time_t TIME;
71
72 /* Lists for temporary lines with an expiry time */
73
74 std::vector<KLine> klines;
75 std::vector<GLine> glines;
76 std::vector<ZLine> zlines;
77 std::vector<QLine> qlines;
78 std::vector<ELine> elines;
79
80 /* Seperate lists for perm XLines that isnt checked by expiry functions */
81
82 std::vector<KLine> pklines;
83 std::vector<GLine> pglines;
84 std::vector<ZLine> pzlines;
85 std::vector<QLine> pqlines;
86 std::vector<ELine> pelines;
87
88
89 bool GSortComparison ( const GLine one, const GLine two );
90 bool ZSortComparison ( const ZLine one, const ZLine two );
91 bool ESortComparison ( const ELine one, const ELine two );
92 bool QSortComparison ( const QLine one, const QLine two );
93 bool KSortComparison ( const KLine one, const KLine two );
94
95 // Reads the default bans from the config file.
96 // only a very small number of bans are defined
97 // this way these days, such as qlines against 
98 // services nicks, etc.
99
100 bool InitXLine(const char* tag)
101 {
102         return true;
103 }
104
105 bool DoneXLine(const char* tag)
106 {
107         apply_lines(APPLY_ALL);
108         return true;
109 }
110
111 bool DoZLine(const char* tag, char** entries, void** values, int* types)
112 {
113         char* reason = (char*)values[0];
114         char* ipmask = (char*)values[1];
115         
116         add_zline(0,"<Config>",reason,ipmask);
117         log(DEBUG,"Read Z line (badip tag): ipmask=%s reason=%s",ipmask,reason);
118         return true;
119 }
120
121 bool DoQLine(const char* tag, char** entries, void** values, int* types)
122 {
123         char* reason = (char*)values[0];
124         char* nick = (char*)values[1];
125         
126         add_qline(0,"<Config>",reason,nick);
127         log(DEBUG,"Read Q line (badnick tag): nick=%s reason=%s",nick,reason);
128         return true;
129 }
130
131 bool DoKLine(const char* tag, char** entries, void** values, int* types)
132 {
133         char* reason = (char*)values[0];
134         char* host = (char*)values[1];
135         
136         add_kline(0,"<Config>",reason,host);
137         log(DEBUG,"Read K line (badhost tag): host=%s reason=%s",host,reason);
138         return true;
139 }
140
141 bool DoELine(const char* tag, char** entries, void** values, int* types)
142 {
143         char* reason = (char*)values[0];
144         char* host = (char*)values[1];
145         
146         add_eline(0,"<Config>",reason,host);
147         log(DEBUG,"Read E line (exception tag): host=%s reason=%s",host,reason);
148         return true;
149 }
150
151 // adds a g:line
152
153 bool add_gline(long duration, const char* source,const char* reason,const char* hostmask)
154 {
155         bool ret = del_gline(hostmask);
156         
157         GLine item;
158         item.duration = duration;
159         strlcpy(item.hostmask,hostmask,199);
160         strlcpy(item.reason,reason,MAXBUF);
161         strlcpy(item.source,source,255);
162         item.n_matches = 0;
163         item.set_time = TIME;
164         
165         if (duration)
166         {
167                 glines.push_back(item);
168                 sort(glines.begin(), glines.end(),GSortComparison);
169         }
170         else
171         {
172                 pglines.push_back(item);
173         }
174         
175         return !ret;
176 }
177
178 // adds an e:line (exception to bans)
179
180 bool add_eline(long duration, const char* source, const char* reason, const char* hostmask)
181 {
182         bool ret = del_eline(hostmask);
183         ELine item;
184         item.duration = duration;
185         strlcpy(item.hostmask,hostmask,199);
186         strlcpy(item.reason,reason,MAXBUF);
187         strlcpy(item.source,source,255);
188         item.n_matches = 0;
189         item.set_time = TIME;
190         if (duration)
191         {
192                 elines.push_back(item);
193                 sort(elines.begin(), elines.end(),ESortComparison);
194         }
195         else
196         {
197                 pelines.push_back(item);
198         }
199         return !ret;
200 }
201
202 // adds a q:line
203
204 bool add_qline(long duration, const char* source, const char* reason, const char* nickname)
205 {
206         bool ret = del_qline(nickname);
207         QLine item;
208         item.duration = duration;
209         strlcpy(item.nick,nickname,63);
210         strlcpy(item.reason,reason,MAXBUF);
211         strlcpy(item.source,source,255);
212         item.n_matches = 0;
213         item.is_global = false;
214         item.set_time = TIME;
215         if (duration)
216         {
217                 qlines.push_back(item);
218                 sort(qlines.begin(), qlines.end(),QSortComparison);
219         }
220         else
221         {
222                 pqlines.push_back(item);
223         }
224         return !ret;
225 }
226
227 // adds a z:line
228
229 bool add_zline(long duration, const char* source, const char* reason, const char* ipaddr)
230 {
231         bool ret = del_zline(ipaddr);
232         ZLine item;
233         item.duration = duration;
234         if (strchr(ipaddr,'@'))
235         {
236                 while (*ipaddr != '@')
237                         ipaddr++;
238                 ipaddr++;
239         }
240         strlcpy(item.ipaddr,ipaddr,39);
241         strlcpy(item.reason,reason,MAXBUF);
242         strlcpy(item.source,source,255);
243         item.n_matches = 0;
244         item.is_global = false;
245         item.set_time = TIME;
246         if (duration)
247         {
248                 zlines.push_back(item);
249                 sort(zlines.begin(), zlines.end(),ZSortComparison);
250         }
251         else
252         {
253                 pzlines.push_back(item);
254         }
255         return !ret;
256 }
257
258 // adds a k:line
259
260 bool add_kline(long duration, const char* source, const char* reason, const char* hostmask)
261 {
262         bool ret = del_kline(hostmask);
263         KLine item;
264         item.duration = duration;
265         strlcpy(item.hostmask,hostmask,200);
266         strlcpy(item.reason,reason,MAXBUF);
267         strlcpy(item.source,source,255);
268         item.n_matches = 0;
269         item.set_time = TIME;
270         if (duration)
271         {
272                 klines.push_back(item);
273                 sort(klines.begin(), klines.end(),KSortComparison);
274         }
275         else
276         {
277                 pklines.push_back(item);
278         }
279         return !ret;
280 }
281
282 // deletes a g:line, returns true if the line existed and was removed
283
284 bool del_gline(const char* hostmask)
285 {
286         for (std::vector<GLine>::iterator i = glines.begin(); i != glines.end(); i++)
287         {
288                 if (!strcasecmp(hostmask,i->hostmask))
289                 {
290                         glines.erase(i);
291                         return true;
292                 }
293         }
294         for (std::vector<GLine>::iterator i = pglines.begin(); i != pglines.end(); i++)
295         {
296                 if (!strcasecmp(hostmask,i->hostmask))
297                 {
298                         pglines.erase(i);
299                         return true;
300                 }
301         }
302         return false;
303 }
304
305 // deletes a e:line, returns true if the line existed and was removed
306
307 bool del_eline(const char* hostmask)
308 {
309         for (std::vector<ELine>::iterator i = elines.begin(); i != elines.end(); i++)
310         {
311                 if (!strcasecmp(hostmask,i->hostmask))
312                 {
313                         elines.erase(i);
314                         return true;
315                 }
316         }
317         for (std::vector<ELine>::iterator i = pelines.begin(); i != pelines.end(); i++)
318         {
319                 if (!strcasecmp(hostmask,i->hostmask))
320                 {
321                         pelines.erase(i);
322                         return true;
323                 }
324         }
325         return false;
326 }
327
328 // deletes a q:line, returns true if the line existed and was removed
329
330 bool del_qline(const char* nickname)
331 {
332         for (std::vector<QLine>::iterator i = qlines.begin(); i != qlines.end(); i++)
333         {
334                 if (!strcasecmp(nickname,i->nick))
335                 {
336                         qlines.erase(i);
337                         return true;
338                 }
339         }
340         for (std::vector<QLine>::iterator i = pqlines.begin(); i != pqlines.end(); i++)
341         {
342                 if (!strcasecmp(nickname,i->nick))
343                 {
344                         pqlines.erase(i);
345                         return true;
346                 }
347         }
348         return false;
349 }
350
351 bool qline_make_global(const char* nickname)
352 {
353         for (std::vector<QLine>::iterator i = qlines.begin(); i != qlines.end(); i++)
354         {
355                 if (!strcasecmp(nickname,i->nick))
356                 {
357                         i->is_global = true;
358                         return true;
359                 }
360         }
361         return false;
362 }
363
364 bool zline_make_global(const char* ipaddr)
365 {
366         for (std::vector<ZLine>::iterator i = zlines.begin(); i != zlines.end(); i++)
367         {
368                 if (!strcasecmp(ipaddr,i->ipaddr))
369                 {
370                         i->is_global = true;
371                         return true;
372                 }
373         }
374         return false;
375 }
376
377 // deletes a z:line, returns true if the line existed and was removed
378
379 bool del_zline(const char* ipaddr)
380 {
381         for (std::vector<ZLine>::iterator i = zlines.begin(); i != zlines.end(); i++)
382         {
383                 if (!strcasecmp(ipaddr,i->ipaddr))
384                 {
385                         zlines.erase(i);
386                         return true;
387                 }
388         }
389         for (std::vector<ZLine>::iterator i = pzlines.begin(); i != pzlines.end(); i++)
390         {
391                 if (!strcasecmp(ipaddr,i->ipaddr))
392                 {
393                         pzlines.erase(i);
394                         return true;
395                 }
396         }
397         return false;
398 }
399
400 // deletes a k:line, returns true if the line existed and was removed
401
402 bool del_kline(const char* hostmask)
403 {
404         for (std::vector<KLine>::iterator i = klines.begin(); i != klines.end(); i++)
405         {
406                 if (!strcasecmp(hostmask,i->hostmask))
407                 {
408                         klines.erase(i);
409                         return true;
410                 }
411         }
412         for (std::vector<KLine>::iterator i = pklines.begin(); i != pklines.end(); i++)
413         {
414                 if (!strcasecmp(hostmask,i->hostmask))
415                 {
416                         pklines.erase(i);
417                         return true;
418                 }
419         }
420         return false;
421 }
422
423 // returns a pointer to the reason if a nickname matches a qline, NULL if it didnt match
424
425 char* matches_qline(const char* nick)
426 {
427         if ((qlines.empty()) && (pqlines.empty()))
428                 return NULL;
429         for (std::vector<QLine>::iterator i = qlines.begin(); i != qlines.end(); i++)
430                 if (match(nick,i->nick))
431                         return i->reason;
432         for (std::vector<QLine>::iterator i = pqlines.begin(); i != pqlines.end(); i++)
433                 if (match(nick,i->nick))
434                         return i->reason;
435         return NULL;
436 }
437
438 // returns a pointer to the reason if a host matches a gline, NULL if it didnt match
439
440 char* matches_gline(const char* host)
441 {
442         if ((glines.empty()) && (pglines.empty()))
443                 return NULL;
444         for (std::vector<GLine>::iterator i = glines.begin(); i != glines.end(); i++)
445                 if (match(host,i->hostmask))
446                         return i->reason;
447         for (std::vector<GLine>::iterator i = pglines.begin(); i != pglines.end(); i++)
448                 if (match(host,i->hostmask))
449                         return i->reason;
450         return NULL;
451 }
452
453 char* matches_exception(const char* host)
454 {
455         if ((elines.empty()) && (pelines.empty()))
456                 return NULL;
457         char host2[MAXBUF];
458         snprintf(host2,MAXBUF,"*@%s",host);
459         for (std::vector<ELine>::iterator i = elines.begin(); i != elines.end(); i++)
460                 if ((match(host,i->hostmask)) || (match(host2,i->hostmask)))
461                         return i->reason;
462         for (std::vector<ELine>::iterator i = pelines.begin(); i != pelines.end(); i++)
463                 if ((match(host,i->hostmask)) || (match(host2,i->hostmask)))
464                         return i->reason;
465         return NULL;
466 }
467
468
469 void gline_set_creation_time(char* host, time_t create_time)
470 {
471         for (std::vector<GLine>::iterator i = glines.begin(); i != glines.end(); i++)
472         {
473                 if (!strcasecmp(host,i->hostmask))
474                 {
475                         i->set_time = create_time;
476                         return;
477                 }
478         }
479         for (std::vector<GLine>::iterator i = pglines.begin(); i != pglines.end(); i++)
480         {
481                 if (!strcasecmp(host,i->hostmask))
482                 {
483                         i->set_time = create_time;
484                         return;
485                 }
486         }
487         return ;        
488 }
489
490 void eline_set_creation_time(char* host, time_t create_time)
491 {
492         for (std::vector<ELine>::iterator i = elines.begin(); i != elines.end(); i++)
493         {
494                 if (!strcasecmp(host,i->hostmask))
495                 {
496                         i->set_time = create_time;
497                         return;
498                 }
499         }
500         for (std::vector<ELine>::iterator i = pelines.begin(); i != pelines.end(); i++) 
501         {
502                 if (!strcasecmp(host,i->hostmask))
503                 {
504                         i->set_time = create_time;
505                         return;
506                 }
507         }
508         return;
509 }
510
511 void qline_set_creation_time(char* nick, time_t create_time)
512 {
513         for (std::vector<QLine>::iterator i = qlines.begin(); i != qlines.end(); i++)
514         {
515                 if (!strcasecmp(nick,i->nick))
516                 {
517                         i->set_time = create_time;
518                         return;
519                 }
520         }
521         for (std::vector<QLine>::iterator i = pqlines.begin(); i != pqlines.end(); i++)
522         {
523                 if (!strcasecmp(nick,i->nick))
524                 {
525                         i->set_time = create_time;
526                         return;
527                 }
528         }
529         return;
530 }
531
532 void zline_set_creation_time(char* ip, time_t create_time)
533 {
534         for (std::vector<ZLine>::iterator i = zlines.begin(); i != zlines.end(); i++)
535         {
536                 if (!strcasecmp(ip,i->ipaddr))
537                 {
538                         i->set_time = create_time;
539                         return;
540                 }
541         }
542         for (std::vector<ZLine>::iterator i = pzlines.begin(); i != pzlines.end(); i++)
543         {
544                 if (!strcasecmp(ip,i->ipaddr))
545                 {
546                         i->set_time = create_time;
547                         return;
548                 }
549         }
550         return;
551 }
552
553 // returns a pointer to the reason if an ip address matches a zline, NULL if it didnt match
554
555 char* matches_zline(const char* ipaddr)
556 {
557         if ((zlines.empty()) && (pzlines.empty()))
558                 return NULL;
559         for (std::vector<ZLine>::iterator i = zlines.begin(); i != zlines.end(); i++)
560                 if (match(ipaddr,i->ipaddr))
561                         return i->reason;
562         for (std::vector<ZLine>::iterator i = pzlines.begin(); i != pzlines.end(); i++)
563                 if (match(ipaddr,i->ipaddr))
564                         return i->reason;
565         return NULL;
566 }
567
568 // returns a pointer to the reason if a host matches a kline, NULL if it didnt match
569
570 char* matches_kline(const char* host)
571 {
572         if ((klines.empty()) && (pklines.empty()))
573                 return NULL;
574         for (std::vector<KLine>::iterator i = klines.begin(); i != klines.end(); i++)
575                 if (match(host,i->hostmask))
576                         return i->reason;
577         for (std::vector<KLine>::iterator i = pklines.begin(); i != pklines.end(); i++)
578                 if (match(host,i->hostmask))
579                         return i->reason;
580         return NULL;
581 }
582
583 bool GSortComparison ( const GLine one, const GLine two )
584 {
585         return (one.duration + one.set_time) < (two.duration + two.set_time);
586 }
587
588 bool ESortComparison ( const ELine one, const ELine two )
589 {
590         return (one.duration + one.set_time) < (two.duration + two.set_time);
591 }
592
593 bool ZSortComparison ( const ZLine one, const ZLine two )
594 {
595         return (one.duration + one.set_time) < (two.duration + two.set_time);
596 }
597
598 bool KSortComparison ( const KLine one, const KLine two )
599 {
600         return (one.duration + one.set_time) < (two.duration + two.set_time);
601 }
602
603 bool QSortComparison ( const QLine one, const QLine two )
604 {
605         return (one.duration + one.set_time) < (two.duration + two.set_time);
606 }
607
608 // removes lines that have expired
609
610 void expire_lines()
611 {
612         time_t current = TIME;
613
614         /* Because we now store all our XLines in sorted order using (i->duration + i->set_time) as a key, this
615          * means that to expire the XLines we just need to do a while, picking off the top few until there are
616          * none left at the head of the queue that are after the current time.
617          */
618
619         while ((glines.size()) && (current > (glines.begin()->duration + glines.begin()->set_time)))
620         {
621                 std::vector<GLine>::iterator i = glines.begin();
622                 WriteOpers("*** Expiring timed G-Line %s (set by %s %d seconds ago)",i->hostmask,i->source,i->duration);
623                 glines.erase(i);
624         }
625
626         while ((elines.size()) && (current > (elines.begin()->duration + elines.begin()->set_time)))
627         {
628                 std::vector<ELine>::iterator i = elines.begin();
629                 WriteOpers("*** Expiring timed E-Line %s (set by %s %d seconds ago)",i->hostmask,i->source,i->duration);
630                 elines.erase(i);
631         }
632
633         while ((zlines.size()) && (current > (zlines.begin()->duration + zlines.begin()->set_time)))
634         {
635                 std::vector<ZLine>::iterator i = zlines.begin();
636                 WriteOpers("*** Expiring timed Z-Line %s (set by %s %d seconds ago)",i->ipaddr,i->source,i->duration);
637                 zlines.erase(i);
638         }
639
640         while ((klines.size()) && (current > (klines.begin()->duration + klines.begin()->set_time)))
641         {
642                 std::vector<KLine>::iterator i = klines.begin();
643                 WriteOpers("*** Expiring timed K-Line %s (set by %s %d seconds ago)",i->hostmask,i->source,i->duration);
644                 klines.erase(i);
645         }
646
647         while ((qlines.size()) && (current > (qlines.begin()->duration + qlines.begin()->set_time)))
648         {
649                 std::vector<QLine>::iterator i = qlines.begin();
650                 WriteOpers("*** Expiring timed Q-Line %s (set by %s %d seconds ago)",i->nick,i->source,i->duration);
651                 qlines.erase(i);
652         }
653         
654 }
655
656 // applies lines, removing clients and changing nicks etc as applicable
657
658 void apply_lines(const int What)
659 {
660         char reason[MAXBUF];
661         char host[MAXBUF];
662
663         if ((!glines.size()) && (!klines.size()) && (!zlines.size()) && (!qlines.size()) &&
664         (!pglines.size()) && (!pklines.size()) && (!pzlines.size()) && (!pqlines.size()))
665                 return;
666
667         CullList* Goners = new CullList();
668         char* check = NULL;
669         for (std::vector<userrec*>::const_iterator u2 = local_users.begin(); u2 != local_users.end(); u2++)
670         {
671                 userrec* u = (userrec*)(*u2);
672                 u->MakeHost(host);
673                 if (elines.size() || pelines.size())
674                 {
675                         // ignore people matching exempts
676                         if (matches_exception(host))
677                                 continue;
678                 }
679                 if ((What & APPLY_GLINES) && (glines.size() || pglines.size()))
680                 {
681                         if ((check = matches_gline(host)))
682                         {
683                                 snprintf(reason,MAXBUF,"G-Lined: %s",check);
684                                 Goners->AddItem(u,reason);
685                         }
686                 }
687                 if ((What & APPLY_KLINES) && (klines.size() || pklines.size()))
688                 {
689                         if ((check = matches_kline(host)))
690                         {
691                                 snprintf(reason,MAXBUF,"K-Lined: %s",check);
692                                 Goners->AddItem(u,reason);
693                         }
694                 }
695                 if ((What & APPLY_QLINES) && (qlines.size() || pqlines.size()))
696                 {
697                         if ((check = matches_qline(u->nick)))
698                         {
699                                 snprintf(reason,MAXBUF,"Q-Lined: %s",check);
700                                 Goners->AddItem(u,reason);
701                         }
702                 }
703                 if ((What & APPLY_ZLINES) && (zlines.size() || pzlines.size()))
704                 {
705                         if ((check = matches_zline((char*)inet_ntoa(u->ip4))))
706                         {
707                                 snprintf(reason,MAXBUF,"Z-Lined: %s",check);
708                                 Goners->AddItem(u,reason);
709                         }
710                 }
711         }
712
713         Goners->Apply();
714         delete Goners;
715 }
716
717 void stats_k(userrec* user)
718 {
719         for (std::vector<KLine>::iterator i = klines.begin(); i != klines.end(); i++)
720                 WriteServ(user->fd,"216 %s :%s %d %d %s :%s",user->nick,i->hostmask,i->set_time,i->duration,i->source,i->reason);
721         for (std::vector<KLine>::iterator i = pklines.begin(); i != pklines.end(); i++)
722                 WriteServ(user->fd,"216 %s :%s %d %d %s :%s",user->nick,i->hostmask,i->set_time,i->duration,i->source,i->reason);
723 }
724
725 void stats_g(userrec* user)
726 {
727         for (std::vector<GLine>::iterator i = glines.begin(); i != glines.end(); i++)
728                 WriteServ(user->fd,"223 %s :%s %d %d %s :%s",user->nick,i->hostmask,i->set_time,i->duration,i->source,i->reason);
729         for (std::vector<GLine>::iterator i = pglines.begin(); i != pglines.end(); i++)
730                 WriteServ(user->fd,"223 %s :%s %d %d %s :%s",user->nick,i->hostmask,i->set_time,i->duration,i->source,i->reason);
731 }
732
733 void stats_q(userrec* user)
734 {
735         for (std::vector<QLine>::iterator i = qlines.begin(); i != qlines.end(); i++)
736                 WriteServ(user->fd,"217 %s :%s %d %d %s :%s",user->nick,i->nick,i->set_time,i->duration,i->source,i->reason);
737         for (std::vector<QLine>::iterator i = pqlines.begin(); i != pqlines.end(); i++)
738                 WriteServ(user->fd,"217 %s :%s %d %d %s :%s",user->nick,i->nick,i->set_time,i->duration,i->source,i->reason);
739 }
740
741 void stats_z(userrec* user)
742 {
743         for (std::vector<ZLine>::iterator i = zlines.begin(); i != zlines.end(); i++)
744                 WriteServ(user->fd,"223 %s :%s %d %d %s :%s",user->nick,i->ipaddr,i->set_time,i->duration,i->source,i->reason);
745         for (std::vector<ZLine>::iterator i = pzlines.begin(); i != pzlines.end(); i++)
746                 WriteServ(user->fd,"223 %s :%s %d %d %s :%s",user->nick,i->ipaddr,i->set_time,i->duration,i->source,i->reason);
747 }
748
749 void stats_e(userrec* user)
750 {
751         for (std::vector<ELine>::iterator i = elines.begin(); i != elines.end(); i++)
752                 WriteServ(user->fd,"223 %s :%s %d %d %s :%s",user->nick,i->hostmask,i->set_time,i->duration,i->source,i->reason);
753         for (std::vector<ELine>::iterator i = pelines.begin(); i != pelines.end(); i++)
754                 WriteServ(user->fd,"223 %s :%s %d %d %s :%s",user->nick,i->hostmask,i->set_time,i->duration,i->source,i->reason);
755 }