]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_delaymsg.cpp
Attach to events and register services in init()
[user/henk/code/inspircd.git] / src / modules / m_delaymsg.cpp
index cc09629e358f434385f215104991241caf9e90c4..63da04a63cedfb7cfe27378a93c31b787d94585c 100644 (file)
@@ -45,6 +45,10 @@ class ModuleDelayMsg : public Module
        DelayMsgMode djm;
  public:
        ModuleDelayMsg() : djm(this)
+       {
+       }
+
+       void init()
        {
                if (!ServerInstance->Modes->AddMode(&djm))
                        throw ModuleException("Could not add new modes!");
@@ -96,7 +100,7 @@ Version ModuleDelayMsg::GetVersion()
 
 void ModuleDelayMsg::OnUserJoin(Membership* memb, bool sync, bool created, CUList&)
 {
-       if (memb->chan->IsModeSet('d'))
+       if ((IS_LOCAL(memb->user)) && (memb->chan->IsModeSet('d')))
        {
                djm.jointime.set(memb, ServerInstance->Time());
        }
@@ -105,7 +109,7 @@ void ModuleDelayMsg::OnUserJoin(Membership* memb, bool sync, bool created, CULis
 ModResult ModuleDelayMsg::OnUserPreMessage(User* user, void* dest, int target_type, std::string &text, char status, CUList &exempt_list)
 {
        /* Server origin */
-       if (!user)
+       if ((!user) || (!IS_LOCAL(user)))
                return MOD_RES_PASSTHRU;
 
        if (target_type != TYPE_CHANNEL)