summaryrefslogtreecommitdiff
path: root/src/modes
diff options
context:
space:
mode:
Diffstat (limited to 'src/modes')
-rw-r--r--src/modes/cmode_k.cpp6
-rw-r--r--src/modes/cmode_l.cpp9
-rw-r--r--src/modes/cmode_o.cpp36
-rw-r--r--src/modes/cmode_v.cpp36
-rw-r--r--src/modes/umode_o.cpp3
-rw-r--r--src/modes/umode_s.cpp7
6 files changed, 9 insertions, 88 deletions
diff --git a/src/modes/cmode_k.cpp b/src/modes/cmode_k.cpp
index e14f93a77..980b3215a 100644
--- a/src/modes/cmode_k.cpp
+++ b/src/modes/cmode_k.cpp
@@ -21,9 +21,6 @@
#include "inspircd.h"
-#include "mode.h"
-#include "channels.h"
-#include "users.h"
#include "builtinmodes.h"
ModeChannelKey::ModeChannelKey()
@@ -55,7 +52,8 @@ ModeAction ModeChannelKey::OnModeChange(User* source, User*, Channel* channel, s
channel->SetMode(this, adding);
if (adding)
{
- parameter = parameter.substr(0, 32);
+ if (parameter.length() > maxkeylen)
+ parameter.erase(maxkeylen);
ext.set(channel, parameter);
}
else
diff --git a/src/modes/cmode_l.cpp b/src/modes/cmode_l.cpp
index 128854b50..d61b2597b 100644
--- a/src/modes/cmode_l.cpp
+++ b/src/modes/cmode_l.cpp
@@ -20,9 +20,6 @@
#include "inspircd.h"
-#include "mode.h"
-#include "channels.h"
-#include "users.h"
#include "builtinmodes.h"
ModeChannelLimit::ModeChannelLimit()
@@ -38,7 +35,11 @@ bool ModeChannelLimit::ResolveModeConflict(std::string &their_param, const std::
ModeAction ModeChannelLimit::OnSet(User* user, Channel* chan, std::string& parameter)
{
- ext.set(chan, ConvToInt(parameter));
+ int limit = ConvToInt(parameter);
+ if (limit < 0)
+ return MODEACTION_DENY;
+
+ ext.set(chan, limit);
return MODEACTION_ALLOW;
}
diff --git a/src/modes/cmode_o.cpp b/src/modes/cmode_o.cpp
deleted file mode 100644
index 6e96afa67..000000000
--- a/src/modes/cmode_o.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * InspIRCd -- Internet Relay Chat Daemon
- *
- * Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
- * Copyright (C) 2007 Robin Burchell <robin+git@viroteck.net>
- * Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
- * Copyright (C) 2006 Craig Edwards <craigedwards@brainbox.cc>
- *
- * 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/>.
- */
-
-
-#include "inspircd.h"
-#include "configreader.h"
-#include "mode.h"
-#include "channels.h"
-#include "users.h"
-#include "modules.h"
-#include "builtinmodes.h"
-
-ModeChannelOp::ModeChannelOp() : PrefixMode(NULL, "op", 'o')
-{
- prefix = '@';
- levelrequired = OP_VALUE;
- prefixrank = OP_VALUE;
-}
diff --git a/src/modes/cmode_v.cpp b/src/modes/cmode_v.cpp
deleted file mode 100644
index c8ce30ab1..000000000
--- a/src/modes/cmode_v.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * InspIRCd -- Internet Relay Chat Daemon
- *
- * Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
- * Copyright (C) 2007 Robin Burchell <robin+git@viroteck.net>
- * Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
- * Copyright (C) 2006 Craig Edwards <craigedwards@brainbox.cc>
- *
- * 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/>.
- */
-
-
-#include "inspircd.h"
-#include "configreader.h"
-#include "mode.h"
-#include "channels.h"
-#include "users.h"
-#include "modules.h"
-#include "builtinmodes.h"
-
-ModeChannelVoice::ModeChannelVoice() : PrefixMode(NULL, "voice", 'v')
-{
- prefix = '+';
- levelrequired = HALFOP_VALUE;
- prefixrank = VOICE_VALUE;
-}
diff --git a/src/modes/umode_o.cpp b/src/modes/umode_o.cpp
index affd6b50c..6e9517a4f 100644
--- a/src/modes/umode_o.cpp
+++ b/src/modes/umode_o.cpp
@@ -19,9 +19,6 @@
#include "inspircd.h"
-#include "mode.h"
-#include "channels.h"
-#include "users.h"
#include "builtinmodes.h"
ModeUserOperator::ModeUserOperator() : ModeHandler(NULL, "oper", 'o', PARAM_NONE, MODETYPE_USER)
diff --git a/src/modes/umode_s.cpp b/src/modes/umode_s.cpp
index b355cb824..ffad21662 100644
--- a/src/modes/umode_s.cpp
+++ b/src/modes/umode_s.cpp
@@ -20,9 +20,6 @@
#include "inspircd.h"
-#include "mode.h"
-#include "channels.h"
-#include "users.h"
#include "builtinmodes.h"
ModeUserServerNoticeMask::ModeUserServerNoticeMask() : ModeHandler(NULL, "snomask", 's', PARAM_SETONLY, MODETYPE_USER)
@@ -53,7 +50,7 @@ ModeAction ModeUserServerNoticeMask::OnModeChange(User* source, User* dest, Chan
return MODEACTION_DENY;
}
-std::string ModeUserServerNoticeMask::GetUserParameter(User* user)
+std::string ModeUserServerNoticeMask::GetUserParameter(const User* user) const
{
std::string ret;
if (!user->IsModeSet(this))
@@ -102,7 +99,7 @@ std::string ModeUserServerNoticeMask::ProcessNoticeMasks(User* user, const std::
{
if (!ServerInstance->SNO->IsSnomaskUsable(*i))
{
- user->WriteNumeric(ERR_UNKNOWNSNOMASK, "%c :is unknown snomask char to me", *i);
+ user->WriteNumeric(ERR_UNKNOWNSNOMASK, *i, "is unknown snomask char to me");
continue;
}
}