]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/coremods/core_channel/core_channel.cpp
spanningtree: use bindip aftype as a hint for dns lookup type
[user/henk/code/inspircd.git] / src / coremods / core_channel / core_channel.cpp
index 9febdf1e75c6fb65bb3b9bf188fe4dcf3b3b64ce..aba4d97690ddb28d6270cc05357850b68e4300b3 100644 (file)
 
 #include "inspircd.h"
 #include "core_channel.h"
+#include "invite.h"
 
 class CoreModChannel : public Module
 {
+       Invite::APIImpl invapi;
        CommandInvite cmdinvite;
        CommandJoin cmdjoin;
        CommandKick cmdkick;
@@ -31,14 +33,15 @@ class CoreModChannel : public Module
        ModResult IsInvited(User* user, Channel* chan)
        {
                LocalUser* localuser = IS_LOCAL(user);
-               if ((localuser) && (localuser->IsInvited(chan)))
+               if ((localuser) && (invapi.IsInvited(localuser, chan)))
                        return MOD_RES_ALLOW;
                return MOD_RES_PASSTHRU;
        }
 
  public:
        CoreModChannel()
-               : cmdinvite(this), cmdjoin(this), cmdkick(this), cmdnames(this), cmdtopic(this)
+               : invapi(this)
+               , cmdinvite(this, invapi), cmdjoin(this), cmdkick(this), cmdnames(this), cmdtopic(this)
        {
        }
 
@@ -62,7 +65,7 @@ class CoreModChannel : public Module
                if (localuser)
                {
                        // Remove existing invite, if any
-                       localuser->RemoveInvite(chan);
+                       invapi.Remove(localuser, chan);
 
                        if (chan->topicset)
                                Topic::ShowTopic(localuser, chan);
@@ -96,6 +99,17 @@ class CoreModChannel : public Module
                return IsInvited(user, chan);
        }
 
+       void OnUserDisconnect(LocalUser* user) CXX11_OVERRIDE
+       {
+               invapi.RemoveAll(user);
+       }
+
+       void OnChannelDelete(Channel* chan) CXX11_OVERRIDE
+       {
+               // Make sure the channel won't appear in invite lists from now on, don't wait for cull to unset the ext
+               invapi.RemoveAll(chan);
+       }
+
        void Prioritize() CXX11_OVERRIDE
        {
                ServerInstance->Modules.SetPriority(this, I_OnPostJoin, PRIORITY_FIRST);