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 * ---------------------------------------------------
20 /* Version two, now with optimized expiry!
22 * Because the old way was horrendously slow, the new way of expiring xlines is very
23 * very efficient. I have improved the efficiency of the algorithm in two ways:
25 * (1) There are now two lists of items for each linetype. One list holds temporary
26 * items, and the other list holds permanent items (ones which will expire).
27 * Items which are on the permanent list are NEVER checked at all by the
28 * expire_lines() function.
29 * (2) The temporary xline lists are always kept in strict numerical order, keyed by
30 * current time + duration. This means that the line which is due to expire the
31 * soonest is always pointed at by vector::begin(), so a simple while loop can
32 * very efficiently, very quickly and above all SAFELY pick off the first few
33 * items in the vector which need zapping.
38 bool InitXLine(ServerConfig* conf, const char* tag)
43 bool DoneZLine(ServerConfig* conf, const char* tag)
45 conf->GetInstance()->XLines->apply_lines(APPLY_ZLINES|APPLY_PERM_ONLY);
49 bool DoneQLine(ServerConfig* conf, const char* tag)
51 conf->GetInstance()->XLines->apply_lines(APPLY_QLINES|APPLY_PERM_ONLY);
55 bool DoneKLine(ServerConfig* conf, const char* tag)
57 conf->GetInstance()->XLines->apply_lines(APPLY_KLINES|APPLY_PERM_ONLY);
61 bool DoneELine(ServerConfig* conf, const char* tag)
63 /* Yes, this is supposed to do nothing, we dont 'apply' these */
67 bool DoZLine(ServerConfig* conf, const char* tag, char** entries, ValueList &values, int* types)
69 const char* reason = values[0].GetString();
70 const char* ipmask = values[1].GetString();
72 conf->GetInstance()->XLines->add_zline(0,"<Config>",reason,ipmask);
76 bool DoQLine(ServerConfig* conf, const char* tag, char** entries, ValueList &values, int* types)
78 const char* reason = values[0].GetString();
79 const char* nick = values[1].GetString();
81 conf->GetInstance()->XLines->add_qline(0,"<Config>",reason,nick);
85 bool DoKLine(ServerConfig* conf, const char* tag, char** entries, ValueList &values, int* types)
87 const char* reason = values[0].GetString();
88 const char* host = values[1].GetString();
90 conf->GetInstance()->XLines->add_kline(0,"<Config>",reason,host);
94 bool DoELine(ServerConfig* conf, const char* tag, char** entries, ValueList &values, int* types)
96 const char* reason = values[0].GetString();
97 const char* host = values[1].GetString();
99 conf->GetInstance()->XLines->add_eline(0,"<Config>",reason,host);
103 IdentHostPair XLineManager::IdentSplit(const std::string &ident_and_host)
105 IdentHostPair n = std::make_pair<std::string,std::string>("*","*");
106 std::string::size_type x = ident_and_host.find('@');
107 if (x != std::string::npos)
109 n.second = ident_and_host.substr(x + 1,ident_and_host.length());
110 n.first = ident_and_host.substr(0, x);
111 if (!n.first.length())
113 if (!n.second.length())
114 n.second.assign("*");
118 n.second = ident_and_host;
126 bool XLineManager::add_gline(long duration, const char* source,const char* reason,const char* hostmask)
128 IdentHostPair ih = IdentSplit(hostmask);
130 if (del_gline(hostmask, true))
133 GLine* item = new GLine(ServerInstance->Time(), duration, source, reason, ih.first.c_str(), ih.second.c_str());
137 glines.push_back(item);
138 sort(glines.begin(), glines.end(),XLineManager::GSortComparison);
142 pglines.push_back(item);
148 // adds an e:line (exception to bans)
150 bool XLineManager::add_eline(long duration, const char* source, const char* reason, const char* hostmask)
152 IdentHostPair ih = IdentSplit(hostmask);
154 if (del_eline(hostmask, true))
157 ELine* item = new ELine(ServerInstance->Time(), duration, source, reason, ih.first.c_str(), ih.second.c_str());
161 elines.push_back(item);
162 sort(elines.begin(), elines.end(),XLineManager::ESortComparison);
166 pelines.push_back(item);
173 bool XLineManager::add_qline(long duration, const char* source, const char* reason, const char* nickname)
175 if (del_qline(nickname, true))
178 QLine* item = new QLine(ServerInstance->Time(), duration, source, reason, nickname);
182 qlines.push_back(item);
183 sort(qlines.begin(), qlines.end(),XLineManager::QSortComparison);
187 pqlines.push_back(item);
194 bool XLineManager::add_zline(long duration, const char* source, const char* reason, const char* ipaddr)
196 if (strchr(ipaddr,'@'))
198 while (*ipaddr != '@')
203 if (del_zline(ipaddr, true))
206 ZLine* item = new ZLine(ServerInstance->Time(), duration, source, reason, ipaddr);
210 zlines.push_back(item);
211 sort(zlines.begin(), zlines.end(),XLineManager::ZSortComparison);
215 pzlines.push_back(item);
222 bool XLineManager::add_kline(long duration, const char* source, const char* reason, const char* hostmask)
224 IdentHostPair ih = IdentSplit(hostmask);
226 if (del_kline(hostmask, true))
229 KLine* item = new KLine(ServerInstance->Time(), duration, source, reason, ih.first.c_str(), ih.second.c_str());
233 klines.push_back(item);
234 sort(klines.begin(), klines.end(),XLineManager::KSortComparison);
238 pklines.push_back(item);
243 // deletes a g:line, returns true if the line existed and was removed
245 bool XLineManager::del_gline(const char* hostmask, bool simulate)
247 IdentHostPair ih = IdentSplit(hostmask);
248 for (std::vector<GLine*>::iterator i = glines.begin(); i != glines.end(); i++)
250 if (!strcasecmp(ih.first.c_str(),(*i)->identmask) && !strcasecmp(ih.second.c_str(),(*i)->hostmask))
260 for (std::vector<GLine*>::iterator i = pglines.begin(); i != pglines.end(); i++)
262 if (!strcasecmp(ih.first.c_str(),(*i)->identmask) && !strcasecmp(ih.second.c_str(),(*i)->hostmask))
275 // deletes a e:line, returns true if the line existed and was removed
277 bool XLineManager::del_eline(const char* hostmask, bool simulate)
279 IdentHostPair ih = IdentSplit(hostmask);
280 for (std::vector<ELine*>::iterator i = elines.begin(); i != elines.end(); i++)
282 if (!strcasecmp(ih.first.c_str(),(*i)->identmask) && !strcasecmp(ih.second.c_str(),(*i)->hostmask))
292 for (std::vector<ELine*>::iterator i = pelines.begin(); i != pelines.end(); i++)
294 if (!strcasecmp(ih.first.c_str(),(*i)->identmask) && !strcasecmp(ih.second.c_str(),(*i)->hostmask))
307 // deletes a q:line, returns true if the line existed and was removed
309 bool XLineManager::del_qline(const char* nickname, bool simulate)
311 for (std::vector<QLine*>::iterator i = qlines.begin(); i != qlines.end(); i++)
313 if (!strcasecmp(nickname,(*i)->nick))
323 for (std::vector<QLine*>::iterator i = pqlines.begin(); i != pqlines.end(); i++)
325 if (!strcasecmp(nickname,(*i)->nick))
338 // deletes a z:line, returns true if the line existed and was removed
340 bool XLineManager::del_zline(const char* ipaddr, bool simulate)
342 for (std::vector<ZLine*>::iterator i = zlines.begin(); i != zlines.end(); i++)
344 if (!strcasecmp(ipaddr,(*i)->ipaddr))
354 for (std::vector<ZLine*>::iterator i = pzlines.begin(); i != pzlines.end(); i++)
356 if (!strcasecmp(ipaddr,(*i)->ipaddr))
369 // deletes a k:line, returns true if the line existed and was removed
371 bool XLineManager::del_kline(const char* hostmask, bool simulate)
373 IdentHostPair ih = IdentSplit(hostmask);
374 for (std::vector<KLine*>::iterator i = klines.begin(); i != klines.end(); i++)
376 if (!strcasecmp(ih.first.c_str(),(*i)->identmask) && !strcasecmp(ih.second.c_str(),(*i)->hostmask))
386 for (std::vector<KLine*>::iterator i = pklines.begin(); i != pklines.end(); i++)
388 if (!strcasecmp(ih.first.c_str(),(*i)->identmask) && !strcasecmp(ih.second.c_str(),(*i)->hostmask))
401 // returns a pointer to the reason if a nickname matches a qline, NULL if it didnt match
403 QLine* XLineManager::matches_qline(const char* nick, bool permonly)
405 if ((qlines.empty()) && (pqlines.empty()))
409 for (std::vector<QLine*>::iterator i = qlines.begin(); i != qlines.end(); i++)
410 if (match(nick,(*i)->nick))
413 for (std::vector<QLine*>::iterator i = pqlines.begin(); i != pqlines.end(); i++)
414 if (match(nick,(*i)->nick))
419 // returns a pointer to the reason if a host matches a gline, NULL if it didnt match
421 GLine* XLineManager::matches_gline(userrec* user, bool permonly)
423 if ((glines.empty()) && (pglines.empty()))
427 for (std::vector<GLine*>::iterator i = glines.begin(); i != glines.end(); i++)
429 if ((match(user->ident,(*i)->identmask)))
431 if ((match(user->host,(*i)->hostmask, true)) || (match(user->GetIPString(),(*i)->hostmask, true)))
438 for (std::vector<GLine*>::iterator i = pglines.begin(); i != pglines.end(); i++)
440 if ((match(user->ident,(*i)->identmask)))
442 if ((match(user->host,(*i)->hostmask, true)) || (match(user->GetIPString(),(*i)->hostmask, true)))
451 ELine* XLineManager::matches_exception(userrec* user, bool permonly)
453 if ((elines.empty()) && (pelines.empty()))
456 snprintf(host2,MAXBUF,"*@%s",user->host);
459 for (std::vector<ELine*>::iterator i = elines.begin(); i != elines.end(); i++)
461 if ((match(user->ident,(*i)->identmask)))
463 if ((match(user->host,(*i)->hostmask, true)) || (match(user->GetIPString(),(*i)->hostmask, true)))
470 for (std::vector<ELine*>::iterator i = pelines.begin(); i != pelines.end(); i++)
472 if ((match(user->ident,(*i)->identmask)))
474 if ((match(user->host,(*i)->hostmask, true)) || (match(user->GetIPString(),(*i)->hostmask, true)))
484 void XLineManager::gline_set_creation_time(const char* host, time_t create_time)
486 for (std::vector<GLine*>::iterator i = glines.begin(); i != glines.end(); i++)
488 if (!strcasecmp(host,(*i)->hostmask))
490 (*i)->set_time = create_time;
491 (*i)->expiry = create_time + (*i)->duration;
495 for (std::vector<GLine*>::iterator i = pglines.begin(); i != pglines.end(); i++)
497 if (!strcasecmp(host,(*i)->hostmask))
499 (*i)->set_time = create_time;
506 void XLineManager::eline_set_creation_time(const char* host, time_t create_time)
508 for (std::vector<ELine*>::iterator i = elines.begin(); i != elines.end(); i++)
510 if (!strcasecmp(host,(*i)->hostmask))
512 (*i)->set_time = create_time;
513 (*i)->expiry = create_time + (*i)->duration;
517 for (std::vector<ELine*>::iterator i = pelines.begin(); i != pelines.end(); i++)
519 if (!strcasecmp(host,(*i)->hostmask))
521 (*i)->set_time = create_time;
528 void XLineManager::qline_set_creation_time(const char* nick, time_t create_time)
530 for (std::vector<QLine*>::iterator i = qlines.begin(); i != qlines.end(); i++)
532 if (!strcasecmp(nick,(*i)->nick))
534 (*i)->set_time = create_time;
535 (*i)->expiry = create_time + (*i)->duration;
539 for (std::vector<QLine*>::iterator i = pqlines.begin(); i != pqlines.end(); i++)
541 if (!strcasecmp(nick,(*i)->nick))
543 (*i)->set_time = create_time;
550 void XLineManager::zline_set_creation_time(const char* ip, time_t create_time)
552 for (std::vector<ZLine*>::iterator i = zlines.begin(); i != zlines.end(); i++)
554 if (!strcasecmp(ip,(*i)->ipaddr))
556 (*i)->set_time = create_time;
557 (*i)->expiry = create_time + (*i)->duration;
561 for (std::vector<ZLine*>::iterator i = pzlines.begin(); i != pzlines.end(); i++)
563 if (!strcasecmp(ip,(*i)->ipaddr))
565 (*i)->set_time = create_time;
572 // returns a pointer to the reason if an ip address matches a zline, NULL if it didnt match
574 ZLine* XLineManager::matches_zline(const char* ipaddr, bool permonly)
576 if ((zlines.empty()) && (pzlines.empty()))
580 for (std::vector<ZLine*>::iterator i = zlines.begin(); i != zlines.end(); i++)
581 if (match(ipaddr,(*i)->ipaddr, true))
584 for (std::vector<ZLine*>::iterator i = pzlines.begin(); i != pzlines.end(); i++)
585 if (match(ipaddr,(*i)->ipaddr, true))
590 // returns a pointer to the reason if a host matches a kline, NULL if it didnt match
592 KLine* XLineManager::matches_kline(userrec* user, bool permonly)
594 if ((klines.empty()) && (pklines.empty()))
598 for (std::vector<KLine*>::iterator i = klines.begin(); i != klines.end(); i++)
600 if ((match(user->ident,(*i)->identmask)))
602 if ((match(user->host,(*i)->hostmask, true)) || (match(user->GetIPString(),(*i)->hostmask, true)))
609 for (std::vector<KLine*>::iterator i = pklines.begin(); i != pklines.end(); i++)
611 if ((match(user->ident,(*i)->identmask)))
613 if ((match(user->host,(*i)->hostmask, true)) || (match(user->GetIPString(),(*i)->hostmask, true)))
622 bool XLineManager::GSortComparison ( const GLine* one, const GLine* two )
624 return (one->expiry) < (two->expiry);
627 bool XLineManager::ESortComparison ( const ELine* one, const ELine* two )
629 return (one->expiry) < (two->expiry);
632 bool XLineManager::ZSortComparison ( const ZLine* one, const ZLine* two )
634 return (one->expiry) < (two->expiry);
637 bool XLineManager::KSortComparison ( const KLine* one, const KLine* two )
639 return (one->expiry) < (two->expiry);
642 bool XLineManager::QSortComparison ( const QLine* one, const QLine* two )
644 return (one->expiry) < (two->expiry);
647 // removes lines that have expired
649 void XLineManager::expire_lines()
651 time_t current = ServerInstance->Time();
653 /* Because we now store all our XLines in sorted order using ((*i)->duration + (*i)->set_time) as a key, this
654 * means that to expire the XLines we just need to do a while, picking off the top few until there are
655 * none left at the head of the queue that are after the current time.
658 while ((glines.size()) && (current > (*glines.begin())->expiry))
660 std::vector<GLine*>::iterator i = glines.begin();
661 ServerInstance->SNO->WriteToSnoMask('x',"Expiring timed G-Line %s@%s (set by %s %d seconds ago)",(*i)->identmask,(*i)->hostmask,(*i)->source,(*i)->duration);
665 while ((elines.size()) && (current > (*elines.begin())->expiry))
667 std::vector<ELine*>::iterator i = elines.begin();
668 ServerInstance->SNO->WriteToSnoMask('x',"Expiring timed E-Line %s@%s (set by %s %d seconds ago)",(*i)->identmask,(*i)->hostmask,(*i)->source,(*i)->duration);
672 while ((zlines.size()) && (current > (*zlines.begin())->expiry))
674 std::vector<ZLine*>::iterator i = zlines.begin();
675 ServerInstance->SNO->WriteToSnoMask('x',"Expiring timed Z-Line %s (set by %s %d seconds ago)",(*i)->ipaddr,(*i)->source,(*i)->duration);
679 while ((klines.size()) && (current > (*klines.begin())->expiry))
681 std::vector<KLine*>::iterator i = klines.begin();
682 ServerInstance->SNO->WriteToSnoMask('x',"Expiring timed K-Line %s@%s (set by %s %d seconds ago)",(*i)->identmask,(*i)->hostmask,(*i)->source,(*i)->duration);
686 while ((qlines.size()) && (current > (*qlines.begin())->expiry))
688 std::vector<QLine*>::iterator i = qlines.begin();
689 ServerInstance->SNO->WriteToSnoMask('x',"Expiring timed Q-Line %s (set by %s %d seconds ago)",(*i)->nick,(*i)->source,(*i)->duration);
695 // applies lines, removing clients and changing nicks etc as applicable
697 void XLineManager::apply_lines(const int What)
702 if (What & APPLY_PERM_ONLY)
706 if ((!pglines.size()) && (!pklines.size()) && (!pzlines.size()) && (!pqlines.size()))
710 for (std::vector<userrec*>::const_iterator u2 = ServerInstance->local_users.begin(); u2 != ServerInstance->local_users.end(); u2++)
712 userrec* u = (userrec*)(*u2);
714 if (elines.size() || pelines.size())
715 if (matches_exception(u))
718 if ((What & APPLY_GLINES) && pglines.size())
720 if ((check = matches_gline(u,true)))
722 snprintf(reason,MAXBUF,"G-Lined: %s",check->reason);
723 if (*ServerInstance->Config->MoronBanner)
724 u->WriteServ("NOTICE %s :*** %s", u->nick, ServerInstance->Config->MoronBanner);
725 if (ServerInstance->Config->HideBans)
726 userrec::QuitUser(ServerInstance, u, "G-Lined", reason);
728 userrec::QuitUser(ServerInstance, u, reason);
732 if ((What & APPLY_KLINES) && pklines.size())
734 if ((check = matches_kline(u,true)))
736 snprintf(reason,MAXBUF,"K-Lined: %s",check->reason);
737 if (*ServerInstance->Config->MoronBanner)
738 u->WriteServ("NOTICE %s :*** %s", u->nick, ServerInstance->Config->MoronBanner);
739 if (ServerInstance->Config->HideBans)
740 userrec::QuitUser(ServerInstance, u, "K-Lined", reason);
742 userrec::QuitUser(ServerInstance, u, reason);
746 if ((What & APPLY_QLINES) && pqlines.size())
748 if ((check = matches_qline(u->nick,true)))
750 snprintf(reason,MAXBUF,"Q-Lined: %s",check->reason);
751 if (*ServerInstance->Config->MoronBanner)
752 u->WriteServ("NOTICE %s :*** %s", u->nick, ServerInstance->Config->MoronBanner);
753 if (ServerInstance->Config->HideBans)
754 userrec::QuitUser(ServerInstance, u, "Q-Lined", reason);
756 userrec::QuitUser(ServerInstance, u, reason);
760 if ((What & APPLY_ZLINES) && pzlines.size())
762 if ((check = matches_zline(u->GetIPString(),true)))
764 snprintf(reason,MAXBUF,"Z-Lined: %s",check->reason);
765 if (*ServerInstance->Config->MoronBanner)
766 u->WriteServ("NOTICE %s :*** %s", u->nick, ServerInstance->Config->MoronBanner);
767 if (ServerInstance->Config->HideBans)
768 userrec::QuitUser(ServerInstance, u, "Z-Lined", reason);
770 userrec::QuitUser(ServerInstance, u, reason);
779 if ((!glines.size()) && (!klines.size()) && (!zlines.size()) && (!qlines.size()) &&
780 (!pglines.size()) && (!pklines.size()) && (!pzlines.size()) && (!pqlines.size()))
784 for (std::vector<userrec*>::const_iterator u2 = ServerInstance->local_users.begin(); u2 != ServerInstance->local_users.end(); u2++)
786 userrec* u = (userrec*)(*u2);
788 if (elines.size() || pelines.size())
790 // ignore people matching exempts
791 if (matches_exception(u))
794 if ((What & APPLY_GLINES) && (glines.size() || pglines.size()))
796 if ((check = matches_gline(u)))
798 snprintf(reason,MAXBUF,"G-Lined: %s",check->reason);
799 if (*ServerInstance->Config->MoronBanner)
800 u->WriteServ("NOTICE %s :*** %s", u->nick, ServerInstance->Config->MoronBanner);
801 if (ServerInstance->Config->HideBans)
802 userrec::QuitUser(ServerInstance, u, "G-Lined", reason);
804 userrec::QuitUser(ServerInstance, u, reason);
807 if ((What & APPLY_KLINES) && (klines.size() || pklines.size()))
809 if ((check = matches_kline(u)))
811 snprintf(reason,MAXBUF,"K-Lined: %s",check->reason);
812 if (*ServerInstance->Config->MoronBanner)
813 u->WriteServ("NOTICE %s :*** %s", u->nick, ServerInstance->Config->MoronBanner);
814 if (ServerInstance->Config->HideBans)
815 userrec::QuitUser(ServerInstance, u, "K-Lined", reason);
817 userrec::QuitUser(ServerInstance, u, reason);
820 if ((What & APPLY_QLINES) && (qlines.size() || pqlines.size()))
822 if ((check = matches_qline(u->nick)))
824 snprintf(reason,MAXBUF,"Q-Lined: %s",check->reason);
825 if (*ServerInstance->Config->MoronBanner)
826 u->WriteServ("NOTICE %s :*** %s", u->nick, ServerInstance->Config->MoronBanner);
827 if (ServerInstance->Config->HideBans)
828 userrec::QuitUser(ServerInstance, u, "Q-Lined", reason);
830 userrec::QuitUser(ServerInstance, u, reason);
833 if ((What & APPLY_ZLINES) && (zlines.size() || pzlines.size()))
835 if ((check = matches_zline(u->GetIPString())))
837 snprintf(reason,MAXBUF,"Z-Lined: %s", check->reason);
838 if (*ServerInstance->Config->MoronBanner)
839 u->WriteServ("NOTICE %s :*** %s", u->nick, ServerInstance->Config->MoronBanner);
840 if (ServerInstance->Config->HideBans)
841 userrec::QuitUser(ServerInstance, u, "Z-Lined", reason);
843 userrec::QuitUser(ServerInstance, u, reason);
850 void XLineManager::stats_k(userrec* user, string_list &results)
852 std::string sn = ServerInstance->Config->ServerName;
853 for (std::vector<KLine*>::iterator i = klines.begin(); i != klines.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);
855 for (std::vector<KLine*>::iterator i = pklines.begin(); i != pklines.end(); i++)
856 results.push_back(sn+" 216 "+user->nick+" :"+(*i)->identmask+"@"+(*i)->hostmask+" "+ConvToStr((*i)->set_time)+" "+ConvToStr((*i)->duration)+" "+(*i)->source+" :"+(*i)->reason);
859 void XLineManager::stats_g(userrec* user, string_list &results)
861 std::string sn = ServerInstance->Config->ServerName;
862 for (std::vector<GLine*>::iterator i = glines.begin(); i != glines.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);
864 for (std::vector<GLine*>::iterator i = pglines.begin(); i != pglines.end(); i++)
865 results.push_back(sn+" 223 "+user->nick+" :"+(*i)->identmask+"@"+(*i)->hostmask+" "+ConvToStr((*i)->set_time)+" "+ConvToStr((*i)->duration)+" "+(*i)->source+" :"+(*i)->reason);
868 void XLineManager::stats_q(userrec* user, string_list &results)
870 std::string sn = ServerInstance->Config->ServerName;
871 for (std::vector<QLine*>::iterator i = qlines.begin(); i != qlines.end(); i++)
872 results.push_back(sn+" 217 "+user->nick+" :"+(*i)->nick+" "+ConvToStr((*i)->set_time)+" "+ConvToStr((*i)->duration)+" "+(*i)->source+" :"+(*i)->reason);
873 for (std::vector<QLine*>::iterator i = pqlines.begin(); i != pqlines.end(); i++)
874 results.push_back(sn+" 217 "+user->nick+" :"+(*i)->nick+" "+ConvToStr((*i)->set_time)+" "+ConvToStr((*i)->duration)+" "+(*i)->source+" :"+(*i)->reason);
877 void XLineManager::stats_z(userrec* user, string_list &results)
879 std::string sn = ServerInstance->Config->ServerName;
880 for (std::vector<ZLine*>::iterator i = zlines.begin(); i != zlines.end(); i++)
881 results.push_back(sn+" 223 "+user->nick+" :"+(*i)->ipaddr+" "+ConvToStr((*i)->set_time)+" "+ConvToStr((*i)->duration)+" "+(*i)->source+" :"+(*i)->reason);
882 for (std::vector<ZLine*>::iterator i = pzlines.begin(); i != pzlines.end(); i++)
883 results.push_back(sn+" 223 "+user->nick+" :"+(*i)->ipaddr+" "+ConvToStr((*i)->set_time)+" "+ConvToStr((*i)->duration)+" "+(*i)->source+" :"+(*i)->reason);
886 void XLineManager::stats_e(userrec* user, string_list &results)
888 std::string sn = ServerInstance->Config->ServerName;
889 for (std::vector<ELine*>::iterator i = elines.begin(); i != elines.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);
891 for (std::vector<ELine*>::iterator i = pelines.begin(); i != pelines.end(); i++)
892 results.push_back(sn+" 223 "+user->nick+" :"+(*i)->identmask+"@"+(*i)->hostmask+" "+ConvToStr((*i)->set_time)+" "+ConvToStr((*i)->duration)+" "+(*i)->source+" :"+(*i)->reason);
895 XLineManager::XLineManager(InspIRCd* Instance) : ServerInstance(Instance)