]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_nonotice.cpp
Some more to fix still, modules probably wont load correctly atm
[user/henk/code/inspircd.git] / src / modules / m_nonotice.cpp
index e536328bc0b0b65a51c5d98a8d686a9be70d7ca7..258dcab0fb871d320e48079505ddb2e10770e1dd 100644 (file)
@@ -20,7 +20,7 @@ class NoNotice : public ModeHandler
  public:
        NoNotice(InspIRCd* Instance) : ModeHandler(Instance, 'T', 0, 0, false, MODETYPE_CHANNEL, false) { }
 
-       ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
+       ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding)
        {
                if (adding)
                {
@@ -54,8 +54,10 @@ class ModuleNoNotice : public Module
        {
                
                nt = new NoNotice(ServerInstance);
-               if (!ServerInstance->AddMode(nt, 'T'))
+               if (!ServerInstance->AddMode(nt))
                        throw ModuleException("Could not add new modes!");
+               Implementation eventlist[] = { I_OnUserPreNotice };
+               ServerInstance->Modules->Attach(eventlist, this, 1);
        }
 
        void Implements(char* List)
@@ -63,11 +65,11 @@ class ModuleNoNotice : public Module
                List[I_OnUserPreNotice] = 1;
        }
        
-       virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+       virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
        {
                if ((target_type == TYPE_CHANNEL) && (IS_LOCAL(user)))
                {
-                       chanrec* c = (chanrec*)dest;
+                       Channel* c = (Channel*)dest;
                        if (c->IsModeSet('T'))
                        {
                                if ((ServerInstance->ULine(user->server)) || (c->GetStatus(user) == STATUS_OP) || (c->GetStatus(user) == STATUS_HOP))
@@ -88,7 +90,7 @@ class ModuleNoNotice : public Module
        virtual ~ModuleNoNotice()
        {
                ServerInstance->Modes->DelMode(nt);
-               DELETE(nt);
+               delete nt;
        }
        
        virtual Version GetVersion()