summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-09-16 17:32:32 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-09-16 17:32:32 +0000
commit48d214c9bdeb0419667ef91c081e3686b9e40a74 (patch)
tree29fe8f09adc73d118120f551c8aec4735c3eab90 /src/modules
parentefd79c8977e51dec63d2a2c49a873cad004103ca (diff)
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
Diffstat (limited to 'src/modules')
-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)