]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_opermodes.cpp
Add support for blocking tag messages with the deaf mode.
[user/henk/code/inspircd.git] / src / modules / m_opermodes.cpp
index d029fda64e8de92b3ed2e43c53e7b3d483c02b81..2f93ec5f1731efd953a0522bd5d503ba8c8020da 100644 (file)
@@ -1,10 +1,14 @@
 /*
  * 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()
-       {
-               Implementation eventlist[] = { I_OnPostOper, I_OnRehash };
-               ServerInstance->Modules->Attach(eventlist, this, 2);
-       }
-
-
-       virtual void OnRehash(User* user)
-       {
-       }
-
-       virtual ~ModuleModesOnOper()
+       Version GetVersion() CXX11_OVERRIDE
        {
+               return Version("Allows the server administrator to set user modes on server operators when they log into their server operator account.", VF_VENDOR);
        }
 
-       virtual Version GetVersion()
+       void OnPostOper(User* user, const std::string &opertype, const std::string &opername) CXX11_OVERRIDE
        {
-               return Version("Sets (and unsets) modes on opers when they oper up", VF_VENDOR);
-       }
+               if (!IS_LOCAL(user))
+                       return;
 
-       virtual void OnPostOper(User* user, const std::string &opertype, const std::string &opername)
-       {
                // whenever a user opers, go through the oper types, find their <type:modes>,
                // and if they have one apply their modes. The mode string can contain +modes
                // to add modes to the user or -modes to take modes from the user.
@@ -66,23 +56,15 @@ class ModuleModesOnOper : public Module
                        smodes = "+" + smodes;
 
                std::string buf;
-               std::stringstream ss(smodes);
-               std::vector<std::string> tokens;
-
-               // split into modes and mode params
-               while (ss >> buf)
-                       tokens.push_back(buf);
+               irc::spacesepstream ss(smodes);
+               CommandBase::Params modes;
 
-               std::vector<std::string> modes;
                modes.push_back(u->nick);
+               // split into modes and mode params
+               while (ss.GetToken(buf))
+                       modes.push_back(buf);
 
-               // process mode params
-               for (unsigned int k = 0; k < tokens.size(); k++)
-               {
-                       modes.push_back(tokens[k]);
-               }
-
-               ServerInstance->SendGlobalMode(modes, u);
+               ServerInstance->Parser.CallHandler("MODE", modes, u);
        }
 };