summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/channels.cpp8
-rw-r--r--src/modules/m_blockcaps.cpp4
-rw-r--r--src/modules/m_blockcolor.cpp4
-rw-r--r--src/modules/m_botmode.cpp25
-rw-r--r--src/users.cpp7
5 files changed, 39 insertions, 9 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index c4948c2e2..a25b2927c 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -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);
diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp
index 4cad8ebc2..017217073 100644
--- a/src/modules/m_blockcaps.cpp
+++ b/src/modules/m_blockcaps.cpp
@@ -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;
}
}
diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp
index 04c621ac0..f517ba215 100644
--- a/src/modules/m_blockcolor.cpp
+++ b/src/modules/m_blockcolor.cpp
@@ -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;
}
}
diff --git a/src/modules/m_botmode.cpp b/src/modules/m_botmode.cpp
index 612eb3b9c..d5757c002 100644
--- a/src/modules/m_botmode.cpp
+++ b/src/modules/m_botmode.cpp
@@ -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;
diff --git a/src/users.cpp b/src/users.cpp
index 40594c8a9..f51656a55 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -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];