From 8f8b1e46d670f45bafdc5c888bec3f005cc06c1f Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 6 Jul 2010 14:07:06 -0400 Subject: Fixed bug #1173, Made hs_request reject actually reject vhosts --- src/modules/hs_request.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'src/modules/hs_request.cpp') diff --git a/src/modules/hs_request.cpp b/src/modules/hs_request.cpp index 5399140bc..7ca2bc9ca 100644 --- a/src/modules/hs_request.cpp +++ b/src/modules/hs_request.cpp @@ -66,7 +66,7 @@ struct HostRequest time_t time; }; -std::map Requests; +std::map Requests; static Module *me; @@ -220,10 +220,11 @@ class CommandHSActivate : public Command if ((na = findnick(nick))) { - std::map::iterator it = Requests.find(na->nick); + std::map::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) @@ -275,9 +276,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::iterator it = Requests.find(nick); + std::map::iterator it = Requests.find(nick); if (it != Requests.end()) { + delete it->second; + Requests.erase(it); + if (HSRequestMemoUser) { if (reason) @@ -323,7 +327,7 @@ class HSListBase : public Command unsigned display_counter = 0; tm *tm; - for (std::map::iterator it = Requests.begin(), it_end = Requests.end(); it != it_end; ++it) + for (std::map::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) @@ -687,7 +691,7 @@ class HSRequest : public Module if (na) { - std::map::iterator it = Requests.find(na->nick); + std::map::iterator it = Requests.find(na->nick); if (it != Requests.end()) { @@ -716,7 +720,7 @@ class HSRequest : public Module void OnDatabaseWrite(void (*Write)(const std::string &)) { - for (std::map::iterator it = Requests.begin(), it_end = Requests.end(); it != it_end; ++it) + for (std::map::iterator it = Requests.begin(), it_end = Requests.end(); it != it_end; ++it) { HostRequest *hr = it->second; std::stringstream buf; @@ -801,9 +805,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::iterator it = Requests.find(nick); + std::map::iterator it = Requests.find(nick); if (it != Requests.end()) + { + delete it->second; Requests.erase(it); + } Requests.insert(std::make_pair(nick, hr)); } -- cgit