Anope IRC Services  Version 2.0
utils.cpp
Go to the documentation of this file.
1 /*
2  * (C) 2003-2014 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 
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 }
45 
Serialize::Reference< NickCore > nc
Definition: account.h:47
Definition: hashcomp.h:84
Anope::string name
Definition: regchannel.h:63
void BuildChanList(NickAlias *na, TemplateFileServer::Replacements &replacements)
Definition: utils.cpp:24
Anope::string URLEncode(const Anope::string &url)
Definition: httpd.h:187
static bool ChannelSort(ChannelInfo *ci1, ChannelInfo *ci2)
Definition: alist.cpp:10
NickCore * GetFounder() const
Definition: regchannel.cpp:364
AccessGroup AccessFor(const User *u)
Definition: regchannel.cpp:413