/*
* InspIRCd -- Internet Relay Chat Daemon
*
- * Copyright (C) 2008 Robin Burchell <robin+git@viroteck.net>
+ * Copyright (C) 2017, 2020 Sadie Powell <sadie@witchery.services>
+ * Copyright (C) 2013, 2016 Attila Molnar <attilamolnar@hush.com>
+ * Copyright (C) 2012, 2019 Robby <robby@chatbelgie.be>
+ * Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
+ * Copyright (C) 2008, 2010 Craig Edwards <brain@inspircd.org>
* Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
- * Copyright (C) 2006 Craig Edwards <craigedwards@brainbox.cc>
+ * Copyright (C) 2006 Robin Burchell <robin+git@viroteck.net>
*
* 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
: ModeHandler(Creator, "snomask", 's', PARAM_SETONLY, MODETYPE_USER)
{
oper = true;
+ syntax = "(+|-)<snomasks>|*";
}
ModeAction ModeUserServerNoticeMask::OnModeChange(User* source, User* dest, Channel*, std::string ¶meter, bool adding)
return ret;
}
-void ModeUserServerNoticeMask::OnParameterMissing(User* user, User* dest, Channel* channel)
-{
- user->WriteNotice("*** The user mode +s requires a parameter (server notice mask). Please provide a parameter, e.g. '+s +*'.");
-}
-
std::string ModeUserServerNoticeMask::ProcessNoticeMasks(User* user, const std::string& input)
{
bool adding = true;
case '*':
for (size_t j = 0; j < 64; j++)
{
- if (ServerInstance->SNO->IsSnomaskUsable(j+'A'))
+ const char chr = j + 'A';
+ if (user->HasSnomaskPermission(chr) && ServerInstance->SNO->IsSnomaskUsable(chr))
curr[j] = adding;
}
break;
{
if (!ServerInstance->SNO->IsSnomaskUsable(*i))
{
- user->WriteNumeric(ERR_UNKNOWNSNOMASK, *i, "is unknown snomask char to me");
+ user->WriteNumeric(ERR_UNKNOWNSNOMASK, *i, "is an unknown snomask character");
+ continue;
+ }
+ else if (!user->HasSnomaskPermission(*i))
+ {
+ user->WriteNumeric(ERR_NOPRIVILEGES, InspIRCd::Format("Permission Denied - Oper type %s does not have access to snomask %c",
+ user->oper->name.c_str(), *i));
continue;
}
}