- OnRehash(NULL,"");
- cu = new CensorUser(ServerInstance);
- cc = new CensorChannel(ServerInstance);
- if (!ServerInstance->AddMode(cu, 'G') || !ServerInstance->AddMode(cc, 'G'))
- throw ModuleException("Could not add new modes!");
- }
-
- void Implements(char* List)
- {
- List[I_OnRehash] = List[I_OnUserPreMessage] = List[I_OnUserPreNotice] = 1;
- }
-
- virtual ~ModuleCensor()
- {
- ServerInstance->Modes->DelMode(cu);
- ServerInstance->Modes->DelMode(cc);
- DELETE(cu);
- DELETE(cc);
- }
-
- virtual void ReplaceLine(irc::string &text, irc::string pattern, irc::string replace)
- {
- if ((!pattern.empty()) && (!text.empty()))
- {
- std::string::size_type pos;
- while ((pos = text.find(pattern)) != irc::string::npos)
- {
- text.erase(pos,pattern.length());
- text.insert(pos,replace);
- }
- }
+ OnRehash(NULL);
+ ServerInstance->Modules->AddService(cu);
+ ServerInstance->Modules->AddService(cc);
+ Implementation eventlist[] = { I_OnRehash, I_OnUserPreMessage, I_OnUserPreNotice };
+ ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));