* ---------------------------------------------------
*/
-#include <stdio.h>
-#include <sstream>
-#include "users.h"
-#include "channels.h"
-#include "modules.h"
#include "inspircd.h"
/* $ModDesc: Provides support for unreal-style channel mode +c */
BlockColor *bc;
public:
- ModuleBlockColour(InspIRCd* Me) : Module::Module(Me)
+ ModuleBlockColour(InspIRCd* Me) : Module(Me)
{
bc = new BlockColor(ServerInstance);
if (!ServerInstance->AddMode(bc, 'c'))
throw ModuleException("Could not add new modes!");
-
- OnRehash(NULL, "");
}
void Implements(char* List)
{
- List[I_OnRehash] = List[I_OnUserPreMessage] = List[I_OnUserPreNotice] = 1;
+ List[I_OnUserPreMessage] = List[I_OnUserPreNotice] = 1;
}
- virtual void OnRehash(userrec* user, const std::string ¶meter)
- {
- ConfigReader Conf(ServerInstance);
-
- AllowChanOps = Conf.ReadFlag("blockcolor", "allowchanops", 0);
- }
-
virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
{
if ((target_type == TYPE_CHANNEL) && (IS_LOCAL(user)))
if(c->IsModeSet('c'))
{
- if (!AllowChanOps || AllowChanOps && c->GetStatus(user) != STATUS_OP)
+ if (!CHANOPS_EXEMPT(ServerInstance, 'c') || CHANOPS_EXEMPT(ServerInstance, 'c') && c->GetStatus(user) != STATUS_OP)
{
for (std::string::iterator i = text.begin(); i != text.end(); i++)
{
}
};
-
-class ModuleBlockColourFactory : public ModuleFactory
-{
- public:
- ModuleBlockColourFactory()
- {
- }
-
- ~ModuleBlockColourFactory()
- {
- }
-
- virtual Module * CreateModule(InspIRCd* Me)
- {
- return new ModuleBlockColour(Me);
- }
-
-};
-
-
-extern "C" void * init_module( void )
-{
- return new ModuleBlockColourFactory;
-}
+MODULE_INIT(ModuleBlockColour)