diff options
Diffstat (limited to 'modules/webcpanel/pages/chanserv/utils.cpp')
-rw-r--r-- | modules/webcpanel/pages/chanserv/utils.cpp | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/modules/webcpanel/pages/chanserv/utils.cpp b/modules/webcpanel/pages/chanserv/utils.cpp index 5c055f722..bdf0b92ec 100644 --- a/modules/webcpanel/pages/chanserv/utils.cpp +++ b/modules/webcpanel/pages/chanserv/utils.cpp @@ -1,17 +1,29 @@ /* - * (C) 2003-2016 Anope Team - * Contact us at team@anope.org + * Anope IRC Services * - * Please read COPYING and README for further details. + * Copyright (C) 2012-2016 Anope Team <team@anope.org> + * + * This file is part of Anope. Anope is free software; you can + * redistribute it and/or modify it under the terms of the GNU + * General Public License as published by the Free Software + * Foundation, version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see see <http://www.gnu.org/licenses/>. */ #include "../../webcpanel.h" namespace { - bool ChannelSort(ChannelInfo *ci1, ChannelInfo *ci2) + bool ChannelSort(ChanServ::Channel *ci1, ChanServ::Channel *ci2) { - return ci::less()(ci1->name, ci2->name); + return ci::less()(ci1->GetName(), ci2->GetName()); } } @@ -21,21 +33,18 @@ namespace WebCPanel namespace ChanServ { -void BuildChanList(NickAlias *na, TemplateFileServer::Replacements &replacements) +void BuildChanList(::NickServ::Nick *na, TemplateFileServer::Replacements &replacements) { - std::deque<ChannelInfo *> queue; - na->nc->GetChannelReferences(queue); - std::sort(queue.begin(), queue.end(), ChannelSort); + std::vector<::ChanServ::Channel *> chans = na->GetAccount()->GetRefs<::ChanServ::Channel *>(); + std::sort(chans.begin(), chans.end(), ChannelSort); - for (unsigned i = 0; i < queue.size(); ++i) + for (::ChanServ::Channel *ci : chans) { - ChannelInfo *ci = queue[i]; - - if (na->nc != ci->GetFounder() && ci->AccessFor(na->nc).empty()) + if (na->GetAccount() != ci->GetFounder() && ci->AccessFor(na->GetAccount()).empty()) continue; - replacements["CHANNEL_NAMES"] = ci->name; - replacements["ESCAPED_CHANNEL_NAMES"] = HTTPUtils::URLEncode(ci->name); + replacements["CHANNEL_NAMES"] = ci->GetName(); + replacements["ESCAPED_CHANNEL_NAMES"] = HTTPUtils::URLEncode(ci->GetName()); } } |