+/* +------------------------------------+
+ * | Inspire Internet Relay Chat Daemon |
+ * +------------------------------------+
+ *
+ * InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ * See: http://www.inspircd.org/wiki/index.php/Credits
+ *
+ * This program is free but copyrighted software; see
+ * the file COPYING for details.
+ *
+ * ---------------------------------------------------
+ */
+
#ifndef INSPIRCD_LISTMODE_PROVIDER
#define INSPIRCD_LISTMODE_PROVIDER
: ModeHandler(Instance, modechar, 1, 1, true, MODETYPE_CHANNEL, false), listnumeric(lnum), endoflistnumeric(eolnum), endofliststring(eolstr), tidy(autotidy), configtag(ctag)
{
this->DoRehash();
- infokey = "exceptionbase_mode_" + std::string(1, mode) + "_list";
+ infokey = "listbase_mode_" + std::string(1, mode) + "_list";
}
std::pair<bool,std::string> ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter)
if (el)
{
ServerInstance->Log(DEBUG,"Channel is extended with a list");
- char moderemove[MAXBUF];
+ irc::modestacker modestack(false);
+ std::deque<std::string> stackresult;
+ const char* mode_junk[MAXMODES+1];
+ mode_junk[0] = channel->name;
userrec* n = new userrec(ServerInstance);
n->SetFd(FD_MAGIC_NUMBER);
- modelist copy;
- /* Make a copy of it, because we cant change the list whilst iterating over it */
for(modelist::iterator it = el->begin(); it != el->end(); it++)
{
- copy.push_back(*it);
+ modestack.Push(this->GetModeChar(), it->mask);
}
- for(modelist::iterator it = copy.begin(); it != copy.end(); it++)
+ while (modestack.GetStackedLine(stackresult))
{
- ServerInstance->Log(DEBUG,"Remove item %s",it->mask.c_str());
- sprintf(moderemove,"-%c",this->GetModeChar());
- const char* parameters[] = { channel->name, moderemove, it->mask.c_str() };
- ServerInstance->SendMode(parameters, 3, n);
+ for (size_t j = 0; j < stackresult.size(); j++)
+ {
+ mode_junk[j+1] = stackresult[j].c_str();
+ }
+ ServerInstance->SendMode(mode_junk, stackresult.size() + 1, n);
}
+
delete n;
}
}
{
irc::stringjoiner mode_join(" ", stackresult, 0, stackresult.size() - 1);
std::string line = mode_join.GetJoined();
- proto->ProtoSendMode(opaque,TYPE_CHANNEL,chan, line);
+ proto->ProtoSendMode(opaque, TYPE_CHANNEL, chan, line);
}
}