diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-08-28 13:48:28 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-08-28 13:48:28 +0000 |
commit | 19157777c5f977fddbcfdc8cdad78e12bf0d6bbb (patch) | |
tree | e3e860f214483978dbd01fa8526b3e1fdf4db053 /src/modules | |
parent | de97b98a41109a517a8e677bf9b48400038f702d (diff) |
Remove the last uses of localised fake clients. This removes a lot of allocations (and uses of UIDs), and cleans things up a bit
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7943 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_banredirect.cpp | 5 | ||||
-rw-r--r-- | src/modules/m_chanprotect.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_samode.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treesocket1.cpp | 15 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treesocket2.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_timedbans.cpp | 13 |
6 files changed, 11 insertions, 40 deletions
diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index 9fa36b516..78cd24233 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -221,8 +221,6 @@ class ModuleBanRedirect : public Module irc::modestacker modestack(false); StringDeque stackresult; const char* mode_junk[MAXMODES+2]; - userrec* myhorriblefakeuser = new userrec(ServerInstance); - myhorriblefakeuser->SetFd(FD_MAGIC_NUMBER); mode_junk[0] = chan->name; @@ -244,10 +242,9 @@ class ModuleBanRedirect : public Module mode_junk[i+1] = stackresult[i].c_str(); } - ServerInstance->SendMode(mode_junk, stackresult.size() + 1, myhorriblefakeuser); + ServerInstance->SendMode(mode_junk, stackresult.size() + 1, ServerInstance->FakeClient); } - DELETE(myhorriblefakeuser); DELETE(redirects); chan->Shrink("banredirects"); } diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp index 0798e1947..8adeefb0b 100644 --- a/src/modules/m_chanprotect.cpp +++ b/src/modules/m_chanprotect.cpp @@ -78,11 +78,10 @@ class FounderProtectBase CUList* cl = channel->GetUsers(); std::string item = extend + std::string(channel->name); const char* mode_junk[MAXMODES+2]; - userrec* n = new userrec(MyInstance); - n->SetFd(FD_MAGIC_NUMBER); mode_junk[0] = channel->name; irc::modestacker modestack(false); std::deque<std::string> stackresult; + for (CUList::iterator i = cl->begin(); i != cl->end(); i++) { if (i->first->GetExt(item, dummyptr)) @@ -97,10 +96,9 @@ class FounderProtectBase { mode_junk[j+1] = stackresult[j].c_str(); } - MyInstance->SendMode(mode_junk, stackresult.size() + 1, n); + MyInstance->SendMode(mode_junk, stackresult.size() + 1, MyInstance->FakeClient); } - delete n; unload_kludge = false; } diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp index b49efd35e..0f5813edc 100644 --- a/src/modules/m_samode.cpp +++ b/src/modules/m_samode.cpp @@ -31,11 +31,7 @@ class cmd_samode : public command_t /* * Handles an SAMODE request. Notifies all +s users. */ - - userrec* n = new userrec(ServerInstance); - n->SetFd(FD_MAGIC_NUMBER); - ServerInstance->SendMode(parameters,pcnt,n); - delete n; + ServerInstance->SendMode(parameters, pcnt, ServerInstance->FakeClient); if (ServerInstance->Modes->GetLastParse().length()) { diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index 1a7531074..872b1d72f 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -640,9 +640,8 @@ bool TreeSocket::ForceMode(const std::string &source, std::deque<std::string> &p } else { - /* FMODE from a server, create a fake user to receive mode feedback */ - who = new userrec(this->Instance); - who->SetFd(FD_MAGIC_NUMBER); + /* FMODE from a server, use a fake user to receive mode feedback */ + who = this->Instance->FakeClient; smode = true; /* Setting this flag tells us we should free the userrec later */ sourceserv = source; /* Set sourceserv to the actual source string */ } @@ -714,10 +713,6 @@ bool TreeSocket::ForceMode(const std::string &source, std::deque<std::string> &p } /* If the TS is greater than ours, we drop the mode and dont pass it anywhere. */ - - if (smode) - DELETE(who); - return true; } @@ -896,8 +891,6 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p { std::deque<std::string> stackresult; const char* mode_junk[MAXMODES+2]; - userrec* n = new userrec(Instance); - n->SetFd(FD_MAGIC_NUMBER); mode_junk[0] = channel.c_str(); while (modestack.GetStackedLine(stackresult)) @@ -906,10 +899,8 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p { mode_junk[j+1] = stackresult[j].c_str(); } - Instance->SendMode(mode_junk, stackresult.size() + 1, n); + Instance->SendMode(mode_junk, stackresult.size() + 1, Instance->FakeClient); } - - delete n; } return true; diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 9a52e63f2..1c6761ea1 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -1480,11 +1480,7 @@ bool TreeSocket::ProcessLine(std::string &line) const char* modelist[MAXPARAMETERS]; for (size_t i = 0; i < params.size(); i++) modelist[i] = params[i].c_str(); - userrec* fake = new userrec(Instance); - fake->SetFd(FD_MAGIC_NUMBER); - this->Instance->SendMode(modelist, params.size(), fake); - - delete fake; + this->Instance->SendMode(modelist, params.size(), this->Instance->FakeClient); /* Hot potato! pass it on! */ return Utils->DoOneToAllButSenderRaw(line,sourceserv,prefix,command,params); } diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index 40f740922..58dffbbe4 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -161,22 +161,15 @@ class ModuleTimedBans : public Module setban[0] = i->channel.c_str(); setban[1] = "-b"; setban[2] = i->mask.c_str(); - // kludge alert! - // ::SendMode expects a userrec* to send the numeric replies - // back to, so we create it a fake user that isnt in the user - // hash and set its descriptor to FD_MAGIC_NUMBER so the data - // falls into the abyss :p - userrec* temp = new userrec(ServerInstance); - temp->SetFd(FD_MAGIC_NUMBER); - /* FIX: Send mode remotely*/ + + /* Send mode remotely*/ std::deque<std::string> n; n.push_back(setban[0]); n.push_back("-b"); n.push_back(setban[2]); - ServerInstance->SendMode(setban,3,temp); + ServerInstance->SendMode(setban,3, ServerInstance->FakeClient); Event rmode((char *)&n, NULL, "send_mode"); rmode.Send(ServerInstance); - DELETE(temp); } else { |