#include "inspircd.h"
/* $ModDesc: Provides channel-specific censor lists (like mode +G but varies from channel to channel) */
+/* $ModDep: ../../include/u_listmode.h */
-
-
+/** Handles channel mode +g
+ */
class ChanFilter : public ListModeBase
{
public:
virtual bool ValidateParam(userrec* user, chanrec* chan, std::string &word)
{
- if (word.length() > 35)
+ if ((word.length() > 35) || (word.empty()))
{
- user->WriteServ( "935 %s %s %s :word is too long for censor list",user->nick, chan->name,word.c_str());
+ user->WriteServ("935 %s %s %s :word is too %s for censor list",user->nick, chan->name,word.c_str(), (word.empty() ? "short" : "long"));
return false;
}
return 0;
}
- virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text, char status)
+ virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
if (target_type == TYPE_CHANNEL)
{
cf->DoCleanup(target_type, item);
}
- virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text, char status)
+ virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
- return OnUserPreMessage(user,dest,target_type,text,status);
+ return OnUserPreMessage(user,dest,target_type,text,status,exempt_list);
}
virtual void OnSyncChannel(chanrec* chan, Module* proto, void* opaque)
virtual Version GetVersion()
{
- return Version(1,0,0,1,VF_STATIC|VF_VENDOR);
+ return Version(1, 1, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION);
}
virtual ~ModuleChanFilter()
{
+ ServerInstance->Modes->DelMode(cf);
DELETE(cf);
}
};