* @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
*/
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.
*/
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);
{
if (!channel->IsModeSet('P'))
{
- channel->SetCustomMode('P',true);
+ channel->SetMode('P',true);
return MODEACTION_ALLOW;
}
}
{
if (channel->IsModeSet('P'))
{
- channel->SetCustomMode('P',false);
+ channel->SetMode('P',false);
return MODEACTION_ALLOW;
}
}
{
if (!channel->IsModeSet('c'))
{
- channel->SetCustomMode('c',true);
+ channel->SetMode('c',true);
return MODEACTION_ALLOW;
}
}
{
if (channel->IsModeSet('c'))
{
- channel->SetCustomMode('c',false);
+ channel->SetMode('c',false);
return MODEACTION_ALLOW;
}
}
/* $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 ¶meter, 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;
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];