summaryrefslogtreecommitdiff
path: root/src/modules/m_cloaking.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/m_cloaking.cpp')
-rw-r--r--src/modules/m_cloaking.cpp18
1 files changed, 17 insertions, 1 deletions
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<User*>::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)