/*
* InspIRCd -- Internet Relay Chat Daemon
*
+ * Copyright (C) 2013, 2017-2018 Sadie Powell <sadie@witchery.services>
+ * Copyright (C) 2012, 2014 Attila Molnar <attilamolnar@hush.com>
+ * Copyright (C) 2012 Robby <robby@chatbelgie.be>
+ * Copyright (C) 2009 Uli Schlachter <psychon@inspircd.org>
* Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
- * Copyright (C) 2007-2008 Robin Burchell <robin+git@viroteck.net>
+ * Copyright (C) 2008 Robin Burchell <robin+git@viroteck.net>
* Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
- * Copyright (C) 2005-2007 Craig Edwards <craigedwards@brainbox.cc>
+ * Copyright (C) 2005, 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
#include "inspircd.h"
-/* $ModDesc: Sets (and unsets) modes on opers when they oper up */
-
class ModuleModesOnOper : public Module
{
public:
- ModuleModesOnOper()
- {
- ServerInstance->Modules->Attach(I_OnPostOper, this);
- }
-
- virtual ~ModuleModesOnOper()
- {
- }
-
- virtual Version GetVersion()
+ Version GetVersion() CXX11_OVERRIDE
{
- return Version("Sets (and unsets) modes on opers when they oper up", VF_VENDOR);
+ return Version("Allows the server administrator to set user modes on server operators when they log into their server operator account.", VF_VENDOR);
}
- virtual void OnPostOper(User* user, const std::string &opertype, const std::string &opername)
+ void OnPostOper(User* user, const std::string &opertype, const std::string &opername) CXX11_OVERRIDE
{
if (!IS_LOCAL(user))
return;
smodes = "+" + smodes;
std::string buf;
- std::stringstream ss(smodes);
- std::vector<std::string> modes;
+ irc::spacesepstream ss(smodes);
+ CommandBase::Params modes;
modes.push_back(u->nick);
// split into modes and mode params
- while (ss >> buf)
+ while (ss.GetToken(buf))
modes.push_back(buf);
- ServerInstance->SendMode(modes, u);
+ ServerInstance->Parser.CallHandler("MODE", modes, u);
}
};