anope

- supernets anope source code & configuration
git clone git://git.acid.vegas/anope.git
Log | Files | Refs | Archive | README

utils.cpp (818B)

      1 /*
      2  * (C) 2003-2022 Anope Team
      3  * Contact us at team@anope.org
      4  *
      5  * Please read COPYING and README for further details.
      6  */
      7 
      8 #include "../../webcpanel.h"
      9 
     10 namespace
     11 {
     12 	bool ChannelSort(ChannelInfo *ci1, ChannelInfo *ci2)
     13 	{
     14 		return ci::less()(ci1->name, ci2->name);
     15 	}
     16 }
     17 
     18 namespace WebCPanel
     19 {
     20 
     21 namespace ChanServ
     22 {
     23 
     24 void BuildChanList(NickAlias *na, TemplateFileServer::Replacements &replacements)
     25 {
     26 	std::deque<ChannelInfo *> queue;
     27 	na->nc->GetChannelReferences(queue);
     28 	std::sort(queue.begin(), queue.end(), ChannelSort);
     29 
     30 	for (unsigned i = 0; i < queue.size(); ++i)
     31 	{
     32 		ChannelInfo *ci = queue[i];
     33 
     34 		if (na->nc != ci->GetFounder() && ci->AccessFor(na->nc).empty())
     35 			continue;
     36 
     37 		replacements["CHANNEL_NAMES"] = ci->name;
     38 		replacements["ESCAPED_CHANNEL_NAMES"] = HTTPUtils::URLEncode(ci->name);
     39 	}
     40 }
     41 
     42 }
     43 
     44 }