summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/u_listmode.h9
-rw-r--r--src/modules/m_banredirect.cpp5
-rw-r--r--src/modules/m_chanprotect.cpp6
-rw-r--r--src/modules/m_samode.cpp6
-rw-r--r--src/modules/m_spanningtree/treesocket1.cpp15
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp6
-rw-r--r--src/modules/m_timedbans.cpp13
7 files changed, 15 insertions, 45 deletions
diff --git a/include/u_listmode.h b/include/u_listmode.h
index 24fbc9a42..6b4fba889 100644
--- a/include/u_listmode.h
+++ b/include/u_listmode.h
@@ -186,22 +186,21 @@ class ListModeBase : public ModeHandler
std::deque<std::string> stackresult;
const char* mode_junk[MAXMODES+2];
mode_junk[0] = channel->name;
- userrec* n = new userrec(ServerInstance);
- n->SetFd(FD_MAGIC_NUMBER);
+
for (modelist::iterator it = el->begin(); it != el->end(); it++)
{
modestack.Push(this->GetModeChar(), assign(it->mask));
}
+
while (modestack.GetStackedLine(stackresult))
{
for (size_t j = 0; j < stackresult.size(); j++)
{
mode_junk[j+1] = stackresult[j].c_str();
}
- ServerInstance->SendMode(mode_junk, stackresult.size() + 1, n);
- }
- delete n;
+ ServerInstance->SendMode(mode_junk, stackresult.size() + 1, ServerInstance->FakeClient);
+ }
}
}
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
{