/*
* InspIRCd -- Internet Relay Chat Daemon
*
+ * Copyright (C) 2017 B00mX0r <b00mx0r@aureus.pw>
+ * Copyright (C) 2013-2014, 2016-2019 Sadie Powell <sadie@witchery.services>
+ * Copyright (C) 2013 Adam <Adam@anope.org>
+ * Copyright (C) 2012-2016, 2018 Attila Molnar <attilamolnar@hush.com>
+ * Copyright (C) 2012, 2019 Robby <robby@chatbelgie.be>
* Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
- * Copyright (C) 2006-2008 Robin Burchell <robin+git@viroteck.net>
- * Copyright (C) 2006, 2008 Oliver Lupton <oliverlupton@gmail.com>
- * Copyright (C) 2008 Pippijn van Steenhoven <pip88nl@gmail.com>
- * Copyright (C) 2003-2008 Craig Edwards <craigedwards@brainbox.cc>
- * Copyright (C) 2008 Thomas Stagner <aquanight@inspircd.org>
+ * Copyright (C) 2007-2009 Robin Burchell <robin+git@viroteck.net>
* Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
+ * Copyright (C) 2006-2008, 2010 Craig Edwards <brain@inspircd.org>
*
* 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
void Channel::SetMode(ModeHandler* mh, bool on)
{
- modes[mh->GetId()] = on;
+ if (mh && mh->GetId() != ModeParser::MODEID_MAX)
+ modes[mh->GetId()] = on;
}
void Channel::SetTopic(User* u, const std::string& ntopic, time_t topicts, const std::string* setter)
if (!override)
{
unsigned int maxchans = user->GetClass()->maxchans;
+ if (!maxchans)
+ maxchans = ServerInstance->Config->MaxChans;
if (user->IsOper())
{
- unsigned int opermaxchans = ConvToInt(user->oper->getConfig("maxchans"));
+ unsigned int opermaxchans = ConvToNum<unsigned int>(user->oper->getConfig("maxchans"));
// If not set, use 2.0's <channels:opers>, if that's not set either, use limit from CC
if (!opermaxchans && user->HasPrivPermission("channels/high-join-limit"))
opermaxchans = ServerInstance->Config->OperMaxChans;
{
if (chan->IsBanned(user))
{
- user->WriteNumeric(ERR_BANNEDFROMCHAN, chan->name, "Cannot join channel (You're banned)");
+ user->WriteNumeric(ERR_BANNEDFROMCHAN, chan->name, "Cannot join channel (you're banned)");
return NULL;
}
}
if (privs)
{
- // If the user was granted prefix modes (in the OnUserPreJoin hook, or he's a
- // remote user and his own server set the modes), then set them internally now
+ // If the user was granted prefix modes (in the OnUserPreJoin hook, or they're a
+ // remote user and their own server set the modes), then set them internally now
for (std::string::const_iterator i = privs->begin(); i != privs->end(); ++i)
{
PrefixMode* mh = ServerInstance->Modes->FindPrefixMode(*i);
}
}
-const char* Channel::ChanModes(bool showkey)
+const char* Channel::ChanModes(bool showsecret)
{
static std::string scratch;
std::string sparam;
if (!pm)
continue;
- if (n == 'k' - 65 && !showkey)
+ if (pm->IsParameterSecret() && !showsecret)
{
- sparam += " <key>";
+ sparam += " <" + pm->name + ">";
}
else
{
return scratch.c_str();
}
-void Channel::WriteNotice(const std::string& text)
+void Channel::WriteNotice(const std::string& text, char status)
{
- ClientProtocol::Messages::Privmsg privmsg(ClientProtocol::Messages::Privmsg::nocopy, ServerInstance->FakeClient, this, text, MSG_NOTICE);
+ ClientProtocol::Messages::Privmsg privmsg(ClientProtocol::Messages::Privmsg::nocopy, ServerInstance->FakeClient, this, text, MSG_NOTICE, status);
Write(ServerInstance->GetRFCEvents().privmsg, privmsg);
+ ServerInstance->PI->SendMessage(this, status, text, MSG_NOTICE);
}
/* returns the status character for a given user on a channel, e.g. @ for op,