]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_cloaking.cpp
Fix the cloaking module on C++98 compilers.
[user/henk/code/inspircd.git] / src / modules / m_cloaking.cpp
index f3818d6234217be24211e744c3409a5eb0bf971c..daa04cf9bd2a6a4da5d77cfd2bf3cc6dc41e3322 100644 (file)
@@ -1,19 +1,20 @@
 /*
  * InspIRCd -- Internet Relay Chat Daemon
  *
- *   Copyright (C) 2017-2019 B00mX0r <b00mx0r@aureus.pw>
+ *   Copyright (C) 20172019 B00mX0r <b00mx0r@aureus.pw>
  *   Copyright (C) 2017 Sheogorath <sheogorath@shivering-isles.com>
  *   Copyright (C) 2016 Adam <Adam@anope.org>
  *   Copyright (C) 2014 Thomas Fargeix <t.fargeix@gmail.com>
  *   Copyright (C) 2013, 2018 Attila Molnar <attilamolnar@hush.com>
- *   Copyright (C) 2013, 2016-2019 Sadie Powell <sadie@witchery.services>
+ *   Copyright (C) 2013, 2016-2020 Sadie Powell <sadie@witchery.services>
  *   Copyright (C) 2012 Robby <robby@chatbelgie.be>
  *   Copyright (C) 2011 jackmcbarn <jackmcbarn@inspircd.org>
  *   Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
  *   Copyright (C) 2007-2009 Robin Burchell <robin+git@viroteck.net>
- *   Copyright (C) 2007-2008, 2010 Craig Edwards <brain@inspircd.org>
  *   Copyright (C) 2007-2008 Dennis Friis <peavey@inspircd.org>
+ *   Copyright (C) 2007 John Brooks <special@inspircd.org>
  *   Copyright (C) 2006 Oliver Lupton <om@inspircd.org>
+ *   Copyright (C) 2003, 2007-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
@@ -80,13 +81,25 @@ struct CloakInfo
 
 typedef std::vector<std::string> CloakList;
 
-/** Handles user mode +x
- */
+class CloakExtItem : public SimpleExtItem<CloakList>
+{
+ public:
+       CloakExtItem(Module* Creator)
+               : SimpleExtItem("cloaks", ExtensionItem::EXT_USER, Creator)
+       {
+       }
+
+       std::string ToHuman(const Extensible* container, void* item) const CXX11_OVERRIDE
+       {
+               return stdalgo::string::join(*static_cast<CloakList*>(item), ' ');
+       }
+};
+
 class CloakUser : public ModeHandler
 {
  public:
        bool active;
-       SimpleExtItem<CloakList> ext;
+       CloakExtItem ext;
        std::string debounce_uid;
        time_t debounce_ts;
        int debounce_count;
@@ -94,7 +107,7 @@ class CloakUser : public ModeHandler
        CloakUser(Module* source)
                : ModeHandler(source, "cloak", 'x', PARAM_NONE, MODETYPE_USER)
                , active(false)
-               , ext("cloaked_host", ExtensionItem::EXT_USER, source)
+               , ext(source)
                , debounce_ts(0)
                , debounce_count(0)
        {
@@ -493,7 +506,7 @@ class ModuleCloaking : public Module
        void OnSetUserIP(LocalUser* user) CXX11_OVERRIDE
        {
                // Connecting users are handled in OnUserConnect not here.
-               if (user->registered != REG_ALL)
+               if (user->registered != REG_ALL || user->quitting)
                        return;
 
                // Remove the cloaks and generate new ones.