]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_operprefix.cpp
Add a snotice when a user tries to use WEBIRC without matching any configured blocks.
[user/henk/code/inspircd.git] / src / modules / m_operprefix.cpp
index 5c051c9169376ba565cb69cedfd7786e262eef0c..bb0b3ac631be47efe4de02490df2b16195c251f0 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
  * See: http://www.inspircd.org/wiki/index.php/Credits
  *
  * This program is free but copyrighted software; see
  * ---------------------------------------------------
  */
 
-/* 
-   by Chernov-Phoenix Alexey (Phoenix@RusNet) mailto:phoenix /email address separator/ pravmail.ru */
+/*
+ * Originally by Chernov-Phoenix Alexey (Phoenix@RusNet) mailto:phoenix /email address separator/ pravmail.ru
+ */
+/* $ModDesc: Gives opers cmode +y which provides a staff prefix. */
 
 #include "inspircd.h"
 
@@ -50,6 +53,11 @@ class OperPrefixMode : public ModeHandler
        public:
                OperPrefixMode(InspIRCd* Instance) : ModeHandler(Instance, 'y', 1, 1, true, MODETYPE_CHANNEL, false, prefixchar) { }
 
+               unsigned int GetPrefixRank()
+               {
+                       return 40000;
+               }
+
                ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding, bool servermode)
                {
                        if (servermode || (source && ServerInstance->ULine(source->server)))
@@ -111,8 +119,8 @@ class ModuleOperPrefixMode : public Module
                if ((!ServerInstance->Modes->AddMode(opm)))
                        throw ModuleException("Could not add a new mode!");
                        
-               Implementation eventlist[] = { I_OnPostJoin, I_OnCleanup, I_OnUserQuit, I_OnUserKick, I_OnUserPart };
-               ServerInstance->Modules->Attach(eventlist, this, 5);
+               Implementation eventlist[] = { I_OnPostJoin, I_OnCleanup, I_OnUserQuit, I_OnUserKick, I_OnUserPart, I_OnOper };
+               ServerInstance->Modules->Attach(eventlist, this, 6);
        }
 
        virtual void PushChanMode(Channel* channel, User* user, bool negate = false)
@@ -157,6 +165,17 @@ class ModuleOperPrefixMode : public Module
                return 0;
        }
 
+       virtual void OnOper(User *user, const std::string&)
+       {
+               if (user && IS_LOCAL(user) && !user->IsModeSet('H'))
+               {
+                       for (UCListIter v = user->chans.begin(); v != user->chans.end(); v++)
+                       {
+                               PushChanMode(v->first, user);
+                       }
+               }
+       }
+
        virtual ~ModuleOperPrefixMode()
        {
                ServerInstance->Modes->DelMode(opm);
@@ -215,7 +234,7 @@ class ModuleOperPrefixMode : public Module
 
        virtual Version GetVersion()
        {
-               return Version("$Id$", VF_COMMON, API_VERSION);
+               return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION);
        }
 };