]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_botmode.cpp
WHEEEEE!!!!!
[user/henk/code/inspircd.git] / src / modules / m_botmode.cpp
index 7120c36c714e64041cf666c1c2ac3a0a301ddf3e..1d3d225750d6445d4bd57c0f8e1eca977a052102 100644 (file)
@@ -21,6 +21,7 @@ using namespace std;
 #include "users.h"
 #include "channels.h"
 #include "modules.h"
+#include "inspircd.h"
 
 /* $ModDesc: Provides support for unreal-style umode +B */
 
@@ -31,6 +32,10 @@ class BotMode : public ModeHandler
 
        ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
        {
+               /* Only opers can change other users modes */
+               if ((source != dest) && (!*source->oper))
+                       return MODEACTION_DENY;
+
                if (adding)
                {
                        if (!dest->IsModeSet('B'))
@@ -72,6 +77,7 @@ class ModuleBotMode : public Module
        
        virtual ~ModuleBotMode()
        {
+               DELETE(bm);
        }
        
        virtual Version GetVersion()
@@ -83,7 +89,7 @@ class ModuleBotMode : public Module
        {
                if (dst->IsModeSet('B'))
                {
-                       Srv->SendTo(NULL,src,"335 "+std::string(src->nick)+" "+std::string(dst->nick)+" :is a \2bot\2 on "+Srv->GetNetworkName());
+                       src->WriteServ("335 "+std::string(src->nick)+" "+std::string(dst->nick)+" :is a \2bot\2 on "+Srv->GetNetworkName());
                }
        }