diff options
author | Adam <Adam@anope.org> | 2010-07-06 14:07:06 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-07-06 14:10:31 -0400 |
commit | 5ec1ca86b43828599d46e4b5c7a3d5f64ff1ef37 (patch) | |
tree | 909d69e9139b836ab2fd989a1ef7bdc74c9536aa | |
parent | e29014c00ac249b2ed764310c28061c98193df77 (diff) |
Fixed bug #1173, Made hs_request reject actually reject vhosts
-rw-r--r-- | src/modules/hs_request.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/modules/hs_request.c b/src/modules/hs_request.c index fdacc91a2..ffb100f76 100644 --- a/src/modules/hs_request.c +++ b/src/modules/hs_request.c @@ -65,7 +65,7 @@ struct HostRequest time_t time; }; -std::map<std::string, HostRequest *> Requests; +std::map<ci::string, HostRequest *> Requests; static Module *me; @@ -221,10 +221,11 @@ class CommandHSActivate : public Command if ((na = findnick(nick))) { - std::map<std::string, HostRequest *>::iterator it = Requests.find(na->nick); + std::map<ci::string, HostRequest *>::iterator it = Requests.find(na->nick); if (it != Requests.end()) { - na->hostinfo.SetVhost(it->second->ident, it->second->host, u->nick, it->second->time); + na->hostinfo.SetVhost(it->second->ident, it->second->host, u->nick, it->second->time); + delete it->second; Requests.erase(it); if (HSRequestMemoUser) @@ -271,9 +272,12 @@ class CommandHSReject : public Command const char *nick = params[0].c_str(); const char *reason = params.size() > 1 ? params[1].c_str() : NULL; - std::map<std::string, HostRequest *>::iterator it = Requests.find(nick); + std::map<ci::string, HostRequest *>::iterator it = Requests.find(nick); if (it != Requests.end()) { + delete it->second; + Requests.erase(it); + if (HSRequestMemoUser) { if (reason) @@ -319,7 +323,7 @@ class HSListBase : public Command unsigned display_counter = 0; tm *tm; - for (std::map<std::string, HostRequest *>::iterator it = Requests.begin(); it != Requests.end(); ++it) + for (std::map<ci::string, HostRequest *>::iterator it = Requests.begin(), it_end = Requests.end(); it != it_end; ++it) { HostRequest *hr = it->second; if (((counter >= from && counter <= to) || (!from && !to)) && display_counter < Config.NSListMax) @@ -684,7 +688,7 @@ class HSRequest : public Module if (na) { - std::map<std::string, HostRequest *>::iterator it = Requests.find(na->nick); + std::map<ci::string, HostRequest *>::iterator it = Requests.find(na->nick); if (it != Requests.end()) { @@ -719,7 +723,7 @@ class HSRequest : public Module void OnDatabaseWrite(void (*Write)(const std::string &)) { - for (std::map<std::string, HostRequest *>::iterator it = Requests.begin(); it != Requests.end(); ++it) + for (std::map<ci::string, HostRequest *>::iterator it = Requests.begin(), it_end = Requests.end(); it != it_end; ++it) { HostRequest *hr = it->second; std::stringstream buf; @@ -806,9 +810,12 @@ void my_add_host_request(char *nick, char *vIdent, char *vhost, char *creator, t hr->ident = vIdent ? vIdent : ""; hr->host = vhost; hr->time = tmp_time; - std::map<std::string, HostRequest *>::iterator it = Requests.find(nick); + std::map<ci::string, HostRequest *>::iterator it = Requests.find(nick); if (it != Requests.end()) + { + delete it->second; Requests.erase(it); + } Requests.insert(std::make_pair(nick, hr)); } |