*/
+/* $ModDesc: Provides channel-specific censor lists (like mode +G but varies from channel to channel) */
+
#define _CRT_SECURE_NO_DEPRECATE
#define _SCL_SECURE_NO_DEPRECATE
#include "inspircd.h"
-#include "u_listmode.h"
-
-/* $ModDesc: Provides channel-specific censor lists (like mode +G but varies from channel to channel) */
+#include "listmode.h"
/** Handles channel mode +g
*/
return true;
}
- virtual bool TellListTooLong(User* user, Channel* chan, std::string &word)
+ virtual void TellListTooLong(User* user, Channel* chan, std::string &word)
{
user->WriteNumeric(939, "%s %s %s :Channel spamfilter list is full", user->nick.c_str(), chan->name.c_str(), word.c_str());
- return true;
}
virtual void TellAlreadyOnList(User* user, Channel* chan, std::string &word)
ModuleChanFilter()
: cf(this)
{
- if (!ServerInstance->Modes->AddMode(&cf))
- throw ModuleException("Could not add new modes!");
+ }
+
+ void init()
+ {
+ ServerInstance->Modules->AddService(cf);
cf.DoImplements(this);
Implementation eventlist[] = { I_OnRehash, I_OnUserPreMessage, I_OnUserPreNotice, I_OnSyncChannel };
- ServerInstance->Modules->Attach(eventlist, this, 4);
+ ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
OnRehash(NULL);
}
virtual void OnRehash(User* user)
{
- ConfigReader Conf;
- hidemask = Conf.ReadFlag("chanfilter", "hidemask", 0);
+ hidemask = ServerInstance->Config->ConfValue("chanfilter")->getBool("hidemask");
cf.DoRehash();
}
if (!IS_LOCAL(user) || res == MOD_RES_ALLOW)
return MOD_RES_PASSTHRU;
- modelist* list = cf.extItem.get(chan);
+ ListModeBase::ModeList* list = cf.GetList(chan);
if (list)
{
- for (modelist::iterator i = list->begin(); i != list->end(); i++)
+ for (ListModeBase::ModeList::iterator i = list->begin(); i != list->end(); i++)
{
if (InspIRCd::Match(text, i->mask))
{
return MOD_RES_PASSTHRU;
}
- virtual void OnCleanup(int target_type, void* item)
- {
- cf.DoCleanup(target_type, item);
- }
-
virtual ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
return OnUserPreMessage(user,dest,target_type,text,status,exempt_list);
{
return Version("Provides channel-specific censor lists (like mode +G but varies from channel to channel)", VF_VENDOR);
}
-
- virtual ~ModuleChanFilter()
- {
- }
};
MODULE_INIT(ModuleChanFilter)