1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
18 /* Version two, now with optimized expiry!
20 * Because the old way was horrendously slow, the new way of expiring xlines is very
21 * very efficient. I have improved the efficiency of the algorithm in two ways:
23 * (1) There are now two lists of items for each linetype. One list holds temporary
24 * items, and the other list holds permanent items (ones which will expire).
25 * Items which are on the permanent list are NEVER checked at all by the
26 * expire_lines() function.
27 * (2) The temporary xline lists are always kept in strict numerical order, keyed by
28 * current time + duration. This means that the line which is due to expire the
29 * soonest is always pointed at by vector::begin(), so a simple while loop can
30 * very efficiently, very quickly and above all SAFELY pick off the first few
31 * items in the vector which need zapping.
36 bool InitXLine(ServerConfig* conf, const char* tag)
41 bool DoneZLine(ServerConfig* conf, const char* tag)
43 conf->GetInstance()->XLines->apply_lines(APPLY_ZLINES|APPLY_PERM_ONLY);
47 bool DoneQLine(ServerConfig* conf, const char* tag)
49 conf->GetInstance()->XLines->apply_lines(APPLY_QLINES|APPLY_PERM_ONLY);
53 bool DoneKLine(ServerConfig* conf, const char* tag)
55 conf->GetInstance()->XLines->apply_lines(APPLY_KLINES|APPLY_PERM_ONLY);
59 bool DoneELine(ServerConfig* conf, const char* tag)
61 /* Yes, this is supposed to do nothing, we dont 'apply' these */
65 bool DoZLine(ServerConfig* conf, const char* tag, char** entries, ValueList &values, int* types)
67 const char* reason = values[0].GetString();
68 const char* ipmask = values[1].GetString();
70 conf->GetInstance()->XLines->add_zline(0,"<Config>",reason,ipmask);
74 bool DoQLine(ServerConfig* conf, const char* tag, char** entries, ValueList &values, int* types)
76 const char* reason = values[0].GetString();
77 const char* nick = values[1].GetString();
79 conf->GetInstance()->XLines->add_qline(0,"<Config>",reason,nick);
83 bool DoKLine(ServerConfig* conf, const char* tag, char** entries, ValueList &values, int* types)
85 const char* reason = values[0].GetString();
86 const char* host = values[1].GetString();
88 conf->GetInstance()->XLines->add_kline(0,"<Config>",reason,host);
92 bool DoELine(ServerConfig* conf, const char* tag, char** entries, ValueList &values, int* types)
94 const char* reason = values[0].GetString();
95 const char* host = values[1].GetString();
97 conf->GetInstance()->XLines->add_eline(0,"<Config>",reason,host);
101 IdentHostPair XLineManager::IdentSplit(const std::string &ident_and_host)
103 IdentHostPair n = std::make_pair<std::string,std::string>("*","*");
104 std::string::size_type x = ident_and_host.find('@');
105 if (x != std::string::npos)
107 n.second = ident_and_host.substr(x + 1,ident_and_host.length());
108 n.first = ident_and_host.substr(0, x);
109 if (!n.first.length())
111 if (!n.second.length())
112 n.second.assign("*");
116 n.second = ident_and_host;
124 bool XLineManager::add_gline(long duration, const char* source,const char* reason,const char* hostmask)
126 IdentHostPair ih = IdentSplit(hostmask);
128 if (del_gline(hostmask, true))
131 GLine* item = new GLine(ServerInstance->Time(), duration, source, reason, ih.first.c_str(), ih.second.c_str());
135 glines.push_back(item);
136 sort(glines.begin(), glines.end(),XLineManager::GSortComparison);
140 pglines.push_back(item);
146 // adds an e:line (exception to bans)
148 bool XLineManager::add_eline(long duration, const char* source, const char* reason, const char* hostmask)
150 IdentHostPair ih = IdentSplit(hostmask);
152 if (del_eline(hostmask, true))
155 ELine* item = new ELine(ServerInstance->Time(), duration, source, reason, ih.first.c_str(), ih.second.c_str());
159 elines.push_back(item);
160 sort(elines.begin(), elines.end(),XLineManager::ESortComparison);
164 pelines.push_back(item);
171 bool XLineManager::add_qline(long duration, const char* source, const char* reason, const char* nickname)
173 if (del_qline(nickname, true))
176 QLine* item = new QLine(ServerInstance->Time(), duration, source, reason, nickname);
180 qlines.push_back(item);
181 sort(qlines.begin(), qlines.end(),XLineManager::QSortComparison);
185 pqlines.push_back(item);
192 bool XLineManager::add_zline(long duration, const char* source, const char* reason, const char* ipaddr)
194 if (strchr(ipaddr,'@'))
196 while (*ipaddr != '@')
201 if (del_zline(ipaddr, true))
204 ZLine* item = new ZLine(ServerInstance->Time(), duration, source, reason, ipaddr);
208 zlines.push_back(item);
209 sort(zlines.begin(), zlines.end(),XLineManager::ZSortComparison);
213 pzlines.push_back(item);
220 bool XLineManager::add_kline(long duration, const char* source, const char* reason, const char* hostmask)
222 IdentHostPair ih = IdentSplit(hostmask);
224 if (del_kline(hostmask, true))
227 KLine* item = new KLine(ServerInstance->Time(), duration, source, reason, ih.first.c_str(), ih.second.c_str());
231 klines.push_back(item);
232 sort(klines.begin(), klines.end(),XLineManager::KSortComparison);
236 pklines.push_back(item);
241 // deletes a g:line, returns true if the line existed and was removed
243 bool XLineManager::del_gline(const char* hostmask, bool simulate)
245 IdentHostPair ih = IdentSplit(hostmask);
246 for (std::vector<GLine*>::iterator i = glines.begin(); i != glines.end(); i++)
248 if (!strcasecmp(ih.first.c_str(),(*i)->identmask) && !strcasecmp(ih.second.c_str(),(*i)->hostmask))
258 for (std::vector<GLine*>::iterator i = pglines.begin(); i != pglines.end(); i++)
260 if (!strcasecmp(ih.first.c_str(),(*i)->identmask) && !strcasecmp(ih.second.c_str(),(*i)->hostmask))
273 // deletes a e:line, returns true if the line existed and was removed
275 bool XLineManager::del_eline(const char* hostmask, bool simulate)
277 IdentHostPair ih = IdentSplit(hostmask);
278 for (std::vector<ELine*>::iterator i = elines.begin(); i != elines.end(); i++)
280 if (!strcasecmp(ih.first.c_str(),(*i)->identmask) && !strcasecmp(ih.second.c_str(),(*i)->hostmask))
290 for (std::vector<ELine*>::iterator i = pelines.begin(); i != pelines.end(); i++)
292 if (!strcasecmp(ih.first.c_str(),(*i)->identmask) && !strcasecmp(ih.second.c_str(),(*i)->hostmask))
305 // deletes a q:line, returns true if the line existed and was removed
307 bool XLineManager::del_qline(const char* nickname, bool simulate)
309 for (std::vector<QLine*>::iterator i = qlines.begin(); i != qlines.end(); i++)
311 if (!strcasecmp(nickname,(*i)->nick))
321 for (std::vector<QLine*>::iterator i = pqlines.begin(); i != pqlines.end(); i++)
323 if (!strcasecmp(nickname,(*i)->nick))
336 // deletes a z:line, returns true if the line existed and was removed
338 bool XLineManager::del_zline(const char* ipaddr, bool simulate)
340 for (std::vector<ZLine*>::iterator i = zlines.begin(); i != zlines.end(); i++)
342 if (!strcasecmp(ipaddr,(*i)->ipaddr))
352 for (std::vector<ZLine*>::iterator i = pzlines.begin(); i != pzlines.end(); i++)
354 if (!strcasecmp(ipaddr,(*i)->ipaddr))
367 // deletes a k:line, returns true if the line existed and was removed
369 bool XLineManager::del_kline(const char* hostmask, bool simulate)
371 IdentHostPair ih = IdentSplit(hostmask);
372 for (std::vector<KLine*>::iterator i = klines.begin(); i != klines.end(); i++)
374 if (!strcasecmp(ih.first.c_str(),(*i)->identmask) && !strcasecmp(ih.second.c_str(),(*i)->hostmask))
384 for (std::vector<KLine*>::iterator i = pklines.begin(); i != pklines.end(); i++)
386 if (!strcasecmp(ih.first.c_str(),(*i)->identmask) && !strcasecmp(ih.second.c_str(),(*i)->hostmask))
399 // returns a pointer to the reason if a nickname matches a qline, NULL if it didnt match
401 QLine* XLineManager::matches_qline(const char* nick, bool permonly)
403 if ((qlines.empty()) && (pqlines.empty()))
407 for (std::vector<QLine*>::iterator i = qlines.begin(); i != qlines.end(); i++)
408 if (match(nick,(*i)->nick))
411 for (std::vector<QLine*>::iterator i = pqlines.begin(); i != pqlines.end(); i++)
412 if (match(nick,(*i)->nick))
417 // returns a pointer to the reason if a host matches a gline, NULL if it didnt match
419 GLine* XLineManager::matches_gline(userrec* user, bool permonly)
421 if ((glines.empty()) && (pglines.empty()))
425 for (std::vector<GLine*>::iterator i = glines.begin(); i != glines.end(); i++)
427 if ((match(user->ident,(*i)->identmask)))
429 if ((match(user->host,(*i)->hostmask, true)) || (match(user->GetIPString(),(*i)->hostmask, true)))
436 for (std::vector<GLine*>::iterator i = pglines.begin(); i != pglines.end(); i++)
438 if ((match(user->ident,(*i)->identmask)))
440 if ((match(user->host,(*i)->hostmask, true)) || (match(user->GetIPString(),(*i)->hostmask, true)))
449 ELine* XLineManager::matches_exception(userrec* user, bool permonly)
451 if ((elines.empty()) && (pelines.empty()))
454 snprintf(host2,MAXBUF,"*@%s",user->host);
457 for (std::vector<ELine*>::iterator i = elines.begin(); i != elines.end(); i++)
459 if ((match(user->ident,(*i)->identmask)))
461 if ((match(user->host,(*i)->hostmask, true)) || (match(user->GetIPString(),(*i)->hostmask, true)))
468 for (std::vector<ELine*>::iterator i = pelines.begin(); i != pelines.end(); i++)
470 if ((match(user->ident,(*i)->identmask)))
472 if ((match(user->host,(*i)->hostmask, true)) || (match(user->GetIPString(),(*i)->hostmask, true)))
482 void XLineManager::gline_set_creation_time(const char* host, time_t create_time)
484 for (std::vector<GLine*>::iterator i = glines.begin(); i != glines.end(); i++)
486 if (!strcasecmp(host,(*i)->hostmask))
488 (*i)->set_time = create_time;
489 (*i)->expiry = create_time + (*i)->duration;
493 for (std::vector<GLine*>::iterator i = pglines.begin(); i != pglines.end(); i++)
495 if (!strcasecmp(host,(*i)->hostmask))
497 (*i)->set_time = create_time;
504 void XLineManager::eline_set_creation_time(const char* host, time_t create_time)
506 for (std::vector<ELine*>::iterator i = elines.begin(); i != elines.end(); i++)
508 if (!strcasecmp(host,(*i)->hostmask))
510 (*i)->set_time = create_time;
511 (*i)->expiry = create_time + (*i)->duration;
515 for (std::vector<ELine*>::iterator i = pelines.begin(); i != pelines.end(); i++)
517 if (!strcasecmp(host,(*i)->hostmask))
519 (*i)->set_time = create_time;
526 void XLineManager::qline_set_creation_time(const char* nick, time_t create_time)
528 for (std::vector<QLine*>::iterator i = qlines.begin(); i != qlines.end(); i++)
530 if (!strcasecmp(nick,(*i)->nick))
532 (*i)->set_time = create_time;
533 (*i)->expiry = create_time + (*i)->duration;
537 for (std::vector<QLine*>::iterator i = pqlines.begin(); i != pqlines.end(); i++)
539 if (!strcasecmp(nick,(*i)->nick))
541 (*i)->set_time = create_time;
548 void XLineManager::zline_set_creation_time(const char* ip, time_t create_time)
550 for (std::vector<ZLine*>::iterator i = zlines.begin(); i != zlines.end(); i++)
552 if (!strcasecmp(ip,(*i)->ipaddr))
554 (*i)->set_time = create_time;
555 (*i)->expiry = create_time + (*i)->duration;
559 for (std::vector<ZLine*>::iterator i = pzlines.begin(); i != pzlines.end(); i++)
561 if (!strcasecmp(ip,(*i)->ipaddr))
563 (*i)->set_time = create_time;
570 // returns a pointer to the reason if an ip address matches a zline, NULL if it didnt match
572 ZLine* XLineManager::matches_zline(const char* ipaddr, bool permonly)
574 if ((zlines.empty()) && (pzlines.empty()))
578 for (std::vector<ZLine*>::iterator i = zlines.begin(); i != zlines.end(); i++)
579 if (match(ipaddr,(*i)->ipaddr, true))
582 for (std::vector<ZLine*>::iterator i = pzlines.begin(); i != pzlines.end(); i++)
583 if (match(ipaddr,(*i)->ipaddr, true))
588 // returns a pointer to the reason if a host matches a kline, NULL if it didnt match
590 KLine* XLineManager::matches_kline(userrec* user, bool permonly)
592 if ((klines.empty()) && (pklines.empty()))
596 for (std::vector<KLine*>::iterator i = klines.begin(); i != klines.end(); i++)
598 if ((match(user->ident,(*i)->identmask)))
600 if ((match(user->host,(*i)->hostmask, true)) || (match(user->GetIPString(),(*i)->hostmask, true)))
607 for (std::vector<KLine*>::iterator i = pklines.begin(); i != pklines.end(); i++)
609 if ((match(user->ident,(*i)->identmask)))
611 if ((match(user->host,(*i)->hostmask, true)) || (match(user->GetIPString(),(*i)->hostmask, true)))
620 bool XLineManager::GSortComparison ( const GLine* one, const GLine* two )
622 return (one->expiry) < (two->expiry);
625 bool XLineManager::ESortComparison ( const ELine* one, const ELine* two )
627 return (one->expiry) < (two->expiry);
630 bool XLineManager::ZSortComparison ( const ZLine* one, const ZLine* two )
632 return (one->expiry) < (two->expiry);
635 bool XLineManager::KSortComparison ( const KLine* one, const KLine* two )
637 return (one->expiry) < (two->expiry);
640 bool XLineManager::QSortComparison ( const QLine* one, const QLine* two )
642 return (one->expiry) < (two->expiry);
645 // removes lines that have expired
647 void XLineManager::expire_lines()
649 time_t current = ServerInstance->Time();
651 /* Because we now store all our XLines in sorted order using ((*i)->duration + (*i)->set_time) as a key, this
652 * means that to expire the XLines we just need to do a while, picking off the top few until there are
653 * none left at the head of the queue that are after the current time.
656 while ((glines.size()) && (current > (*glines.begin())->expiry))
658 std::vector<GLine*>::iterator i = glines.begin();
659 ServerInstance->SNO->WriteToSnoMask('x',"Expiring timed G-Line %s@%s (set by %s %d seconds ago)",(*i)->identmask,(*i)->hostmask,(*i)->source,(*i)->duration);
663 while ((elines.size()) && (current > (*elines.begin())->expiry))
665 std::vector<ELine*>::iterator i = elines.begin();
666 ServerInstance->SNO->WriteToSnoMask('x',"Expiring timed E-Line %s@%s (set by %s %d seconds ago)",(*i)->identmask,(*i)->hostmask,(*i)->source,(*i)->duration);
670 while ((zlines.size()) && (current > (*zlines.begin())->expiry))
672 std::vector<ZLine*>::iterator i = zlines.begin();
673 ServerInstance->SNO->WriteToSnoMask('x',"Expiring timed Z-Line %s (set by %s %d seconds ago)",(*i)->ipaddr,(*i)->source,(*i)->duration);
677 while ((klines.size()) && (current > (*klines.begin())->expiry))
679 std::vector<KLine*>::iterator i = klines.begin();
680 ServerInstance->SNO->WriteToSnoMask('x',"Expiring timed K-Line %s@%s (set by %s %d seconds ago)",(*i)->identmask,(*i)->hostmask,(*i)->source,(*i)->duration);
684 while ((qlines.size()) && (current > (*qlines.begin())->expiry))
686 std::vector<QLine*>::iterator i = qlines.begin();
687 ServerInstance->SNO->WriteToSnoMask('x',"Expiring timed Q-Line %s (set by %s %d seconds ago)",(*i)->nick,(*i)->source,(*i)->duration);
693 // applies lines, removing clients and changing nicks etc as applicable
695 void XLineManager::apply_lines(const int What)
700 if (What & APPLY_PERM_ONLY)
704 if ((!pglines.size()) && (!pklines.size()) && (!pzlines.size()) && (!pqlines.size()))
708 for (std::vector<userrec*>::const_iterator u2 = ServerInstance->local_users.begin(); u2 != ServerInstance->local_users.end(); u2++)
710 userrec* u = (userrec*)(*u2);
712 if (elines.size() || pelines.size())
713 if (matches_exception(u))
716 if ((What & APPLY_GLINES) && pglines.size())
718 if ((check = matches_gline(u,true)))
720 snprintf(reason,MAXBUF,"G-Lined: %s",check->reason);
721 if (*ServerInstance->Config->MoronBanner)
722 u->WriteServ("NOTICE %s :*** %s", u->nick, ServerInstance->Config->MoronBanner);
723 if (ServerInstance->Config->HideBans)
724 userrec::QuitUser(ServerInstance, u, "G-Lined", reason);
726 userrec::QuitUser(ServerInstance, u, reason);
730 if ((What & APPLY_KLINES) && pklines.size())
732 if ((check = matches_kline(u,true)))
734 snprintf(reason,MAXBUF,"K-Lined: %s",check->reason);
735 if (*ServerInstance->Config->MoronBanner)
736 u->WriteServ("NOTICE %s :*** %s", u->nick, ServerInstance->Config->MoronBanner);
737 if (ServerInstance->Config->HideBans)
738 userrec::QuitUser(ServerInstance, u, "K-Lined", reason);
740 userrec::QuitUser(ServerInstance, u, reason);
744 if ((What & APPLY_QLINES) && pqlines.size())
746 if ((check = matches_qline(u->nick,true)))
748 snprintf(reason,MAXBUF,"Q-Lined: %s",check->reason);
749 if (*ServerInstance->Config->MoronBanner)
750 u->WriteServ("NOTICE %s :*** %s", u->nick, ServerInstance->Config->MoronBanner);
751 if (ServerInstance->Config->HideBans)
752 userrec::QuitUser(ServerInstance, u, "Q-Lined", reason);
754 userrec::QuitUser(ServerInstance, u, reason);
758 if ((What & APPLY_ZLINES) && pzlines.size())
760 if ((check = matches_zline(u->GetIPString(),true)))
762 snprintf(reason,MAXBUF,"Z-Lined: %s",check->reason);
763 if (*ServerInstance->Config->MoronBanner)
764 u->WriteServ("NOTICE %s :*** %s", u->nick, ServerInstance->Config->MoronBanner);
765 if (ServerInstance->Config->HideBans)
766 userrec::QuitUser(ServerInstance, u, "Z-Lined", reason);
768 userrec::QuitUser(ServerInstance, u, reason);
777 if ((!glines.size()) && (!klines.size()) && (!zlines.size()) && (!qlines.size()) &&
778 (!pglines.size()) && (!pklines.size()) && (!pzlines.size()) && (!pqlines.size()))
782 for (std::vector<userrec*>::const_iterator u2 = ServerInstance->local_users.begin(); u2 != ServerInstance->local_users.end(); u2++)
784 userrec* u = (userrec*)(*u2);
786 if (elines.size() || pelines.size())
788 // ignore people matching exempts
789 if (matches_exception(u))
792 if ((What & APPLY_GLINES) && (glines.size() || pglines.size()))
794 if ((check = matches_gline(u)))
796 snprintf(reason,MAXBUF,"G-Lined: %s",check->reason);
797 if (*ServerInstance->Config->MoronBanner)
798 u->WriteServ("NOTICE %s :*** %s", u->nick, ServerInstance->Config->MoronBanner);
799 if (ServerInstance->Config->HideBans)
800 userrec::QuitUser(ServerInstance, u, "G-Lined", reason);
802 userrec::QuitUser(ServerInstance, u, reason);
805 if ((What & APPLY_KLINES) && (klines.size() || pklines.size()))
807 if ((check = matches_kline(u)))
809 snprintf(reason,MAXBUF,"K-Lined: %s",check->reason);
810 if (*ServerInstance->Config->MoronBanner)
811 u->WriteServ("NOTICE %s :*** %s", u->nick, ServerInstance->Config->MoronBanner);
812 if (ServerInstance->Config->HideBans)
813 userrec::QuitUser(ServerInstance, u, "K-Lined", reason);
815 userrec::QuitUser(ServerInstance, u, reason);
818 if ((What & APPLY_QLINES) && (qlines.size() || pqlines.size()))
820 if ((check = matches_qline(u->nick)))
822 snprintf(reason,MAXBUF,"Q-Lined: %s",check->reason);
823 if (*ServerInstance->Config->MoronBanner)
824 u->WriteServ("NOTICE %s :*** %s", u->nick, ServerInstance->Config->MoronBanner);
825 if (ServerInstance->Config->HideBans)
826 userrec::QuitUser(ServerInstance, u, "Q-Lined", reason);
828 userrec::QuitUser(ServerInstance, u, reason);
831 if ((What & APPLY_ZLINES) && (zlines.size() || pzlines.size()))
833 if ((check = matches_zline(u->GetIPString())))
835 snprintf(reason,MAXBUF,"Z-Lined: %s", check->reason);
836 if (*ServerInstance->Config->MoronBanner)
837 u->WriteServ("NOTICE %s :*** %s", u->nick, ServerInstance->Config->MoronBanner);
838 if (ServerInstance->Config->HideBans)
839 userrec::QuitUser(ServerInstance, u, "Z-Lined", reason);
841 userrec::QuitUser(ServerInstance, u, reason);
848 void XLineManager::stats_k(userrec* user, string_list &results)
850 std::string sn = ServerInstance->Config->ServerName;
851 for (std::vector<KLine*>::iterator i = klines.begin(); i != klines.end(); i++)
852 results.push_back(sn+" 216 "+user->nick+" :"+(*i)->identmask+"@"+(*i)->hostmask+" "+ConvToStr((*i)->set_time)+" "+ConvToStr((*i)->duration)+" "+(*i)->source+" :"+(*i)->reason);
853 for (std::vector<KLine*>::iterator i = pklines.begin(); i != pklines.end(); i++)
854 results.push_back(sn+" 216 "+user->nick+" :"+(*i)->identmask+"@"+(*i)->hostmask+" "+ConvToStr((*i)->set_time)+" "+ConvToStr((*i)->duration)+" "+(*i)->source+" :"+(*i)->reason);
857 void XLineManager::stats_g(userrec* user, string_list &results)
859 std::string sn = ServerInstance->Config->ServerName;
860 for (std::vector<GLine*>::iterator i = glines.begin(); i != glines.end(); i++)
861 results.push_back(sn+" 223 "+user->nick+" :"+(*i)->identmask+"@"+(*i)->hostmask+" "+ConvToStr((*i)->set_time)+" "+ConvToStr((*i)->duration)+" "+(*i)->source+" :"+(*i)->reason);
862 for (std::vector<GLine*>::iterator i = pglines.begin(); i != pglines.end(); i++)
863 results.push_back(sn+" 223 "+user->nick+" :"+(*i)->identmask+"@"+(*i)->hostmask+" "+ConvToStr((*i)->set_time)+" "+ConvToStr((*i)->duration)+" "+(*i)->source+" :"+(*i)->reason);
866 void XLineManager::stats_q(userrec* user, string_list &results)
868 std::string sn = ServerInstance->Config->ServerName;
869 for (std::vector<QLine*>::iterator i = qlines.begin(); i != qlines.end(); i++)
870 results.push_back(sn+" 217 "+user->nick+" :"+(*i)->nick+" "+ConvToStr((*i)->set_time)+" "+ConvToStr((*i)->duration)+" "+(*i)->source+" :"+(*i)->reason);
871 for (std::vector<QLine*>::iterator i = pqlines.begin(); i != pqlines.end(); i++)
872 results.push_back(sn+" 217 "+user->nick+" :"+(*i)->nick+" "+ConvToStr((*i)->set_time)+" "+ConvToStr((*i)->duration)+" "+(*i)->source+" :"+(*i)->reason);
875 void XLineManager::stats_z(userrec* user, string_list &results)
877 std::string sn = ServerInstance->Config->ServerName;
878 for (std::vector<ZLine*>::iterator i = zlines.begin(); i != zlines.end(); i++)
879 results.push_back(sn+" 223 "+user->nick+" :"+(*i)->ipaddr+" "+ConvToStr((*i)->set_time)+" "+ConvToStr((*i)->duration)+" "+(*i)->source+" :"+(*i)->reason);
880 for (std::vector<ZLine*>::iterator i = pzlines.begin(); i != pzlines.end(); i++)
881 results.push_back(sn+" 223 "+user->nick+" :"+(*i)->ipaddr+" "+ConvToStr((*i)->set_time)+" "+ConvToStr((*i)->duration)+" "+(*i)->source+" :"+(*i)->reason);
884 void XLineManager::stats_e(userrec* user, string_list &results)
886 std::string sn = ServerInstance->Config->ServerName;
887 for (std::vector<ELine*>::iterator i = elines.begin(); i != elines.end(); i++)
888 results.push_back(sn+" 223 "+user->nick+" :"+(*i)->identmask+"@"+(*i)->hostmask+" "+ConvToStr((*i)->set_time)+" "+ConvToStr((*i)->duration)+" "+(*i)->source+" :"+(*i)->reason);
889 for (std::vector<ELine*>::iterator i = pelines.begin(); i != pelines.end(); i++)
890 results.push_back(sn+" 223 "+user->nick+" :"+(*i)->identmask+"@"+(*i)->hostmask+" "+ConvToStr((*i)->set_time)+" "+ConvToStr((*i)->duration)+" "+(*i)->source+" :"+(*i)->reason);
893 XLineManager::XLineManager(InspIRCd* Instance) : ServerInstance(Instance)