]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules.cpp
Merge insp20
[user/henk/code/inspircd.git] / src / modules.cpp
index 92f619743d11f0b640c57539f8eb0765b49b9a8a..23aceb3e11e442c524e5eb8f15ce44e2ef619eba 100644 (file)
@@ -132,7 +132,6 @@ void                Module::OnPostConnect(User*) { DetachEvent(I_OnPostConnect); }
 void           Module::OnUserMessage(User*, void*, int, const std::string&, char, const CUList&, MessageType) { DetachEvent(I_OnUserMessage); }
 void           Module::OnUserInvite(User*, User*, Channel*, time_t) { DetachEvent(I_OnUserInvite); }
 void           Module::OnPostTopicChange(User*, Channel*, const std::string&) { DetachEvent(I_OnPostTopicChange); }
-void           Module::OnGetServerDescription(const std::string&, std::string&) { DetachEvent(I_OnGetServerDescription); }
 void           Module::OnSyncUser(User*, ProtocolInterface::Server&) { DetachEvent(I_OnSyncUser); }
 void           Module::OnSyncChannel(Channel*, ProtocolInterface::Server&) { DetachEvent(I_OnSyncChannel); }
 void           Module::OnSyncNetwork(ProtocolInterface::Server&) { DetachEvent(I_OnSyncNetwork); }
@@ -389,18 +388,23 @@ void ModuleManager::DoSafeUnload(Module* mod)
        std::vector<reference<ExtensionItem> > items;
        ServerInstance->Extensions.BeginUnregister(modfind->second, items);
        /* Give the module a chance to tidy out all its metadata */
-       for (chan_hash::iterator c = ServerInstance->chanlist->begin(); c != ServerInstance->chanlist->end(); c++)
+       for (chan_hash::iterator c = ServerInstance->chanlist->begin(); c != ServerInstance->chanlist->end(); )
        {
-               mod->OnCleanup(TYPE_CHANNEL,c->second);
-               c->second->doUnhookExtensions(items);
-               const UserMembList* users = c->second->GetUsers();
+               Channel* chan = c->second;
+               ++c;
+               mod->OnCleanup(TYPE_CHANNEL, chan);
+               chan->doUnhookExtensions(items);
+               const UserMembList* users = chan->GetUsers();
                for(UserMembCIter mi = users->begin(); mi != users->end(); mi++)
                        mi->second->doUnhookExtensions(items);
        }
-       for (user_hash::iterator u = ServerInstance->Users->clientlist->begin(); u != ServerInstance->Users->clientlist->end(); u++)
+       for (user_hash::iterator u = ServerInstance->Users->clientlist->begin(); u != ServerInstance->Users->clientlist->end(); )
        {
-               mod->OnCleanup(TYPE_USER,u->second);
-               u->second->doUnhookExtensions(items);
+               User* user = u->second;
+               // The module may quit the user (e.g. SSL mod unloading) and that will remove it from the container
+               ++u;
+               mod->OnCleanup(TYPE_USER, user);
+               user->doUnhookExtensions(items);
        }
        for(char m='A'; m <= 'z'; m++)
        {
@@ -550,6 +554,8 @@ void ModuleManager::LoadAll()
                }
        }
 
+       this->NewServices = NULL;
+
        if (!PrioritizeHooks())
                ServerInstance->Exit(EXIT_STATUS_MODULE);
 }