]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Did some renaming so that the methods for modes in chanrec and userrec are identical.
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sat, 8 Jul 2006 21:37:16 +0000 (21:37 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sat, 8 Jul 2006 21:37:16 +0000 (21:37 +0000)
bool IsModeSet(const unsigned char c);
void SetMode(const unsigned char c, bool value);
Fixed m_botmode for new api

git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4194 e03df62e-2008-0410-955e-edbf42e46eb7

include/channels.h
include/users.h
src/channels.cpp
src/modules/m_blockcaps.cpp
src/modules/m_blockcolor.cpp
src/modules/m_botmode.cpp
src/users.cpp

index 76b60466887fe0ab6ac1b686a2cc7a386d2b4e5c..ade28470946ca8937319303448bf0d49e3ea3c5d 100644 (file)
@@ -166,14 +166,14 @@ class chanrec : public Extensible
         * @param mode The mode character to set or unset
         * @param mode_on True if you want to set the mode or false if you want to remove it
         */
-       void SetCustomMode(char mode,bool mode_on);
+       void SetMode(char mode,bool mode_on);
 
        /** Sets or unsets the parameters for a custom mode in a channels info
         * @param mode The mode character to set or unset
         * @param parameter The parameter string to associate with this mode character
         * @param mode_on True if you want to set the mode or false if you want to remove it
         */
-       void SetCustomModeParam(char mode,char* parameter,bool mode_on);
+       void SetModeParam(char mode,char* parameter,bool mode_on);
  
        /** Returns true if a mode is set on a channel
          * @param mode The mode character you wish to query
index 2b3f74742e11a42da1e6d6e13d61d005b73bc9d2..a7d1c92505cbacb08ff57b517fae7916b0312b28 100644 (file)
@@ -269,7 +269,9 @@ class userrec : public connection
         */
        const char* FormatModes();
 
-       bool HasMode(unsigned char m);
+       bool IsModeSet(unsigned char m);
+
+       void SetMode(unsigned char m, bool value);
        
        /** Returns true if a user is invited to a channel.
         */
index c4948c2e213f14145e3918482c683628c734cc5e..a25b2927c7ea0a3b7f196496adf00cde04ecba2d 100644 (file)
@@ -57,17 +57,17 @@ chanrec::chanrec()
        memset(&modes,0,64);
 }
 
-void chanrec::SetCustomMode(char mode,bool mode_on)
+void chanrec::SetMode(char mode,bool mode_on)
 {
        modes[mode-65] = mode_on;
        if (!mode_on)
-               this->SetCustomModeParam(mode,"",false);
+               this->SetModeParam(mode,"",false);
 }
 
 
-void chanrec::SetCustomModeParam(char mode,char* parameter,bool mode_on)
+void chanrec::SetModeParam(char mode,char* parameter,bool mode_on)
 {
-       log(DEBUG,"SetCustomModeParam called");
+       log(DEBUG,"SetModeParam called");
        
        CustomModeList::iterator n = custom_mode_params.find(mode);     
 
index 4cad8ebc2bcd624721d3b41c78f38036293a9e95..017217073793421339cc504bc43ab9eaa146c048 100644 (file)
@@ -33,7 +33,7 @@ class BlockCaps : public ModeHandler
                {
                        if (!channel->IsModeSet('P'))
                        {
-                               channel->SetCustomMode('P',true);
+                               channel->SetMode('P',true);
                                return MODEACTION_ALLOW;
                        }
                }
@@ -41,7 +41,7 @@ class BlockCaps : public ModeHandler
                {
                        if (channel->IsModeSet('P'))
                        {
-                               channel->SetCustomMode('P',false);
+                               channel->SetMode('P',false);
                                return MODEACTION_ALLOW;
                        }
                }
index 04c621ac0313d668e5acf157cb3d2abec35985e0..f517ba215d2564ec07a16c0379071c45a2c515f4 100644 (file)
@@ -36,7 +36,7 @@ class BlockColor : public ModeHandler
                {
                        if (!channel->IsModeSet('c'))
                        {
-                               channel->SetCustomMode('c',true);
+                               channel->SetMode('c',true);
                                return MODEACTION_ALLOW;
                        }
                }
@@ -44,7 +44,7 @@ class BlockColor : public ModeHandler
                {
                        if (channel->IsModeSet('c'))
                        {
-                               channel->SetCustomMode('c',false);
+                               channel->SetMode('c',false);
                                return MODEACTION_ALLOW;
                        }
                }
index 612eb3b9c0af5bd5a9ad22d1c10111d18feb75fb..d5757c002c2e1c5990b4d19e6d0bea5a0cb84c03 100644 (file)
@@ -24,6 +24,31 @@ using namespace std;
 
 /* $ModDesc: Provides support for unreal-style umode +B */
 
+class BotMode : public ModeHandler
+{
+       BotMode() : ModeHandler('B', 0, 0, false, MODETYPE_USER, false) { }
+
+       ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
+       {
+               if (adding)
+               {
+                       if (!dest->IsModeSet('B'))
+                       {
+                               user->SetMode('B',true);
+                               return MODEACTION_ALLOW;
+                       }
+               }
+               else
+               {
+                       if (dest->IsModeSet('B'))
+                       {
+                               user->SetMode('B',false);
+                               return MODEACTION_ALLOW;
+                       }
+               }
+       }
+};
+
 class ModuleBotMode : public Module
 {
        Server *Srv; 
index 40594c8a9b787c0d617735d4a0c8b1b36fb3ccc2..f51656a55f388e791ced3d559dc10e90da79871d 100644 (file)
@@ -110,11 +110,16 @@ bool DoneClassesAndTypes(const char* tag)
        return true;
 }
 
-bool userrec::HasMode(unsigned char m)
+bool userrec::IsModeSet(unsigned char m)
 {
        return (modes[m-65]);
 }
 
+void userrec::SetMode(unsigned char m, bool value)
+{
+       modes[m-65] = value;
+}
+
 const char* userrec::FormatModes()
 {
        static char data[MAXBUF];