-/* +------------------------------------+
- * | Inspire Internet Relay Chat Daemon |
- * +------------------------------------+
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
*
- * InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
+ * Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
*
- * This program is free but copyrighted software; see
- * the file COPYING for details.
+ * This file is part of InspIRCd. InspIRCd 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 <http://www.gnu.org/licenses/>.
*/
+
#ifndef INSPIRCD_LISTMODE_PROVIDER
#define INSPIRCD_LISTMODE_PROVIDER
/** An item in a listmode's list
*/
-class ListItem : public classbase
+class ListItem
{
public:
std::string nick;
/** The number of items a listmode's list may contain
*/
-class ListLimit : public classbase
+class ListLimit
{
public:
std::string mask;
{
list = true;
this->DoRehash();
- Extensible::Register(&extItem);
+ ServerInstance->Extensions.Register(&extItem);
}
/** See mode.h
*/
virtual void DoRehash()
{
- ConfigReader Conf;
+ ConfigTagList tags = ServerInstance->Config->ConfTags(configtag);
chanlimits.clear();
- for (int i = 0; i < Conf.Enumerate(configtag); i++)
+ for (ConfigIter i = tags.first; i != tags.second; i++)
{
// For each <banlist> tag
+ ConfigTag* c = i->second;
ListLimit limit;
- limit.mask = Conf.ReadValue(configtag, "chan", i);
- limit.limit = Conf.ReadInteger(configtag, "limit", i, true);
+ limit.mask = c->getString("chan");
+ limit.limit = c->getInt("limit");
if (limit.mask.size() && limit.limit > 0)
chanlimits.push_back(limit);
*/
virtual void DoImplements(Module* m)
{
- Implementation eventlist[] = { I_OnChannelDelete, I_OnSyncChannel, I_OnRehash };
- ServerInstance->Modules->Attach(eventlist, m, 3);
+ Implementation eventlist[] = { I_OnSyncChannel, I_OnRehash };
+ ServerInstance->Modules->Attach(eventlist, m, 2);
}
/** Handle the list mode.
if (adding)
{
+ if (tidy)
+ ModeParser::CleanMask(parameter);
+
+ if (parameter.length() > 250)
+ return MODEACTION_DENY;
+
// If there was no list
if (!el)
{
extItem.set(channel, el);
}
- // Clean the mask up
- if (this->tidy)
- ModeParser::CleanMask(parameter);
-
// Check if the item already exists in the list
for (modelist::iterator it = el->begin(); it != el->end(); it++)
{
{
// We have a pattern matching the channel...
maxsize = el->size();
- if (IS_LOCAL(source) || (maxsize < it->limit))
+ if (!IS_LOCAL(source) || (maxsize < it->limit))
{
/* Ok, it *could* be allowed, now give someone subclassing us
* a chance to validate the parameter.