/** Handles usermode +G
*/
-class CensorUser : public ModeHandler
+class CensorUser : public SimpleUserModeHandler
{
public:
- CensorUser(InspIRCd* Instance) : ModeHandler(Instance, 'G', 0, 0, false, MODETYPE_USER, false) { }
-
- ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool)
- {
- if (adding)
- {
- if (!dest->IsModeSet('G'))
- {
- dest->SetMode('G',true);
- return MODEACTION_ALLOW;
- }
- }
- else
- {
- if (dest->IsModeSet('G'))
- {
- dest->SetMode('G',false);
- return MODEACTION_ALLOW;
- }
- }
-
- return MODEACTION_DENY;
- }
+ CensorUser(InspIRCd* Instance) : SimpleUserModeHandler(Instance, 'G') { }
};
/** Handles channel mode +G
*/
-class CensorChannel : public ModeHandler
+class CensorChannel : public SimpleChannelModeHandler
{
public:
- CensorChannel(InspIRCd* Instance) : ModeHandler(Instance, 'G', 0, 0, false, MODETYPE_CHANNEL, false) { }
-
- ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool)
- {
- if (adding)
- {
- if (!channel->IsModeSet('G'))
- {
- channel->SetMode('G',true);
- return MODEACTION_ALLOW;
- }
- }
- else
- {
- if (channel->IsModeSet('G'))
- {
- channel->SetMode('G',false);
- return MODEACTION_ALLOW;
- }
- }
-
- return MODEACTION_DENY;
- }
+ CensorChannel(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'G') { }
};
class ModuleCensor : public Module
{
if (index->second.empty())
{
- user->WriteNumeric(936, "%s %s %s :Your message contained a censored word, and was blocked", user->nick, ((Channel*)dest)->name, index->first.c_str());
+ user->WriteNumeric(936, "%s %s %s :Your message contained a censored word, and was blocked", user->nick.c_str(), ((Channel*)dest)->name, index->first.c_str());
return 1;
}