From 48d214c9bdeb0419667ef91c081e3686b9e40a74 Mon Sep 17 00:00:00 2001 From: brain Date: Tue, 16 Sep 2008 17:32:32 +0000 Subject: Shrink users properly on quit, and make cloaks for all existing users on load, for situations where the cloaking module is loaded after the ircd is booted. Thanks Ankit git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10546 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_cloaking.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index 6163b41b7..278b74541 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -292,8 +292,10 @@ class ModuleCloaking : public Module ServerInstance->Modules->UseInterface("HashRequest"); - Implementation eventlist[] = { I_OnRehash, I_OnUserDisconnect, I_OnCleanup, I_OnCheckBan, I_OnUserConnect, I_OnSyncUserMetaData }; + Implementation eventlist[] = { I_OnRehash, I_OnUserDisconnect, I_OnCleanup, I_OnCheckBan, I_OnUserConnect, I_OnSyncUserMetaData, I_OnCleanup }; ServerInstance->Modules->Attach(eventlist, this, 6); + + CloakExistingUsers(); } void OnSyncUserMetaData(User* user, Module* proto,void* opaque, const std::string &extname, bool displayable) @@ -306,6 +308,17 @@ class ModuleCloaking : public Module } } + void CloakExistingUsers() + { + std::string* cloak; + for (std::vector::iterator u = ServerInstance->Users->local_users.begin(); u != ServerInstance->Users->local_users.end(); u++) + { + if (!(*u)->GetExt("cloaked_host", cloak)) + { + OnUserConnect(*u); + } + } + } virtual int OnCheckBan(User* user, Channel* chan) { @@ -338,7 +351,10 @@ class ModuleCloaking : public Module { std::string* tofree; if (user->GetExt("cloaked_host", tofree)) + { delete tofree; + user->Shrink("cloaked_host"); + } } virtual void OnCleanup(int target_type, void* item) -- cgit v1.2.3