summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2007-08-28 13:40:21 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2007-08-28 13:40:21 +0000
commit2829ce8112ead4808969808b1f3ae216aae55d05 (patch)
tree866a78170cc3d53dfa0db51f6f901b372e049ecd
parent67b09fde7b19fbf63b419b7ee42cc4be910ddcf1 (diff)
Remove some fake client stuff, make it use the global record
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7941 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/channels.cpp13
-rw-r--r--src/mode.cpp8
-rw-r--r--src/modes/cmode_b.cpp7
-rw-r--r--src/modes/cmode_h.cpp7
-rw-r--r--src/modes/cmode_k.cpp8
-rw-r--r--src/modes/cmode_o.cpp6
-rw-r--r--src/modes/cmode_v.cpp6
7 files changed, 13 insertions, 42 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index d33caa34c..4b5cb7fc3 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -177,9 +177,6 @@ void chanrec::SetDefaultModes()
list.GetToken(modeseq);
- userrec* dummyuser = new userrec(ServerInstance);
- dummyuser->SetFd(FD_MAGIC_NUMBER);
-
for (std::string::iterator n = modeseq.begin(); n != modeseq.end(); ++n)
{
ModeHandler* mode = ServerInstance->Modes->FindMode(*n, MODETYPE_CHANNEL);
@@ -190,11 +187,9 @@ void chanrec::SetDefaultModes()
else
parameter.clear();
- mode->OnModeChange(dummyuser, dummyuser, this, parameter, true);
+ mode->OnModeChange(ServerInstance->FakeClient, ServerInstance->FakeClient, this, parameter, true);
}
}
-
- delete dummyuser;
}
/*
@@ -367,11 +362,9 @@ chanrec* chanrec::JoinUser(InspIRCd* Instance, userrec *user, const char* cn, bo
chanrec* chanrec::ForceChan(InspIRCd* Instance, chanrec* Ptr, userrec* user, const std::string &privs)
{
- userrec* dummyuser = new userrec(Instance);
std::string nick = user->nick;
bool silent = false;
- dummyuser->SetFd(FD_MAGIC_NUMBER);
Ptr->AddUser(user);
/* Just in case they have no permissions */
@@ -385,7 +378,7 @@ chanrec* chanrec::ForceChan(InspIRCd* Instance, chanrec* Ptr, userrec* user, con
{
Ptr->SetPrefix(user, status, mh->GetPrefixRank(), true);
/* Make sure that the mode handler knows this mode was now set */
- mh->OnModeChange(dummyuser, dummyuser, Ptr, nick, true);
+ mh->OnModeChange(Instance->FakeClient, Instance->FakeClient, Ptr, nick, true);
switch (mh->GetPrefix())
{
@@ -410,8 +403,6 @@ chanrec* chanrec::ForceChan(InspIRCd* Instance, chanrec* Ptr, userrec* user, con
}
}
- delete dummyuser;
-
FOREACH_MOD_I(Instance,I_OnUserJoin,OnUserJoin(user, Ptr, silent));
if (!silent)
diff --git a/src/mode.cpp b/src/mode.cpp
index 7321d11c4..421183740 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -1018,14 +1018,8 @@ void ModeHandler::RemoveMode(chanrec* channel)
if (channel->IsModeSet(this->GetModeChar()))
{
- userrec* n = new userrec(ServerInstance);
-
sprintf(moderemove,"-%c",this->GetModeChar());
- n->SetFd(FD_MAGIC_NUMBER);
-
- ServerInstance->SendMode(parameters, 2, n);
-
- delete n;
+ ServerInstance->SendMode(parameters, 2, ServerInstance->FakeClient);
}
}
diff --git a/src/modes/cmode_b.cpp b/src/modes/cmode_b.cpp
index f82c1296b..1c6fe3fa5 100644
--- a/src/modes/cmode_b.cpp
+++ b/src/modes/cmode_b.cpp
@@ -53,21 +53,18 @@ void ModeChannelBan::RemoveMode(chanrec* channel)
{
BanList copy;
char moderemove[MAXBUF];
- userrec* n = new userrec(ServerInstance);
- n->SetFd(FD_MAGIC_NUMBER);
for (BanList::iterator i = channel->bans.begin(); i != channel->bans.end(); i++)
{
copy.push_back(*i);
}
+
for (BanList::iterator i = copy.begin(); i != copy.end(); i++)
{
sprintf(moderemove,"-%c",this->GetModeChar());
const char* parameters[] = { channel->name, moderemove, i->data };
- ServerInstance->SendMode(parameters, 3, n);
+ ServerInstance->SendMode(parameters, 3, ServerInstance->FakeClient);
}
-
- delete n;
}
void ModeChannelBan::RemoveMode(userrec* user)
diff --git a/src/modes/cmode_h.cpp b/src/modes/cmode_h.cpp
index ecee93388..831ec809c 100644
--- a/src/modes/cmode_h.cpp
+++ b/src/modes/cmode_h.cpp
@@ -50,21 +50,20 @@ void ModeChannelHalfOp::RemoveMode(chanrec* channel)
CUList* list = channel->GetHalfoppedUsers();
CUList copy;
char moderemove[MAXBUF];
- userrec* n = new userrec(ServerInstance);
- n->SetFd(FD_MAGIC_NUMBER);
for (CUList::iterator i = list->begin(); i != list->end(); i++)
{
userrec* n = i->first;
copy.insert(std::make_pair(n,n->nick));
}
+
for (CUList::iterator i = copy.begin(); i != copy.end(); i++)
{
sprintf(moderemove,"-%c",this->GetModeChar());
const char* parameters[] = { channel->name, moderemove, i->first->nick };
- ServerInstance->SendMode(parameters, 3, n);
+ ServerInstance->SendMode(parameters, 3, ServerInstance->FakeClient);
}
- delete n;
+
}
void ModeChannelHalfOp::RemoveMode(userrec* user)
diff --git a/src/modes/cmode_k.cpp b/src/modes/cmode_k.cpp
index eb59714f7..f6a29af35 100644
--- a/src/modes/cmode_k.cpp
+++ b/src/modes/cmode_k.cpp
@@ -43,14 +43,8 @@ void ModeChannelKey::RemoveMode(chanrec* channel)
if (channel->IsModeSet(this->GetModeChar()))
{
- userrec* n = new userrec(ServerInstance);
-
sprintf(moderemove,"-%c",this->GetModeChar());
- n->SetFd(FD_MAGIC_NUMBER);
-
- ServerInstance->SendMode(parameters, 3, n);
-
- delete n;
+ ServerInstance->SendMode(parameters, 3, ServerInstance->FakeClient);
}
}
diff --git a/src/modes/cmode_o.cpp b/src/modes/cmode_o.cpp
index 47d191ff8..27bc62100 100644
--- a/src/modes/cmode_o.cpp
+++ b/src/modes/cmode_o.cpp
@@ -51,21 +51,19 @@ void ModeChannelOp::RemoveMode(chanrec* channel)
CUList* list = channel->GetOppedUsers();
CUList copy;
char moderemove[MAXBUF];
- userrec* n = new userrec(ServerInstance);
- n->SetFd(FD_MAGIC_NUMBER);
for (CUList::iterator i = list->begin(); i != list->end(); i++)
{
userrec* n = i->first;
copy.insert(std::make_pair(n,n->nick));
}
+
for (CUList::iterator i = copy.begin(); i != copy.end(); i++)
{
sprintf(moderemove,"-%c",this->GetModeChar());
const char* parameters[] = { channel->name, moderemove, i->first->nick };
- ServerInstance->SendMode(parameters, 3, n);
+ ServerInstance->SendMode(parameters, 3, ServerInstance->FakeClient);
}
- delete n;
}
void ModeChannelOp::RemoveMode(userrec* user)
diff --git a/src/modes/cmode_v.cpp b/src/modes/cmode_v.cpp
index 1e244c606..0ea887073 100644
--- a/src/modes/cmode_v.cpp
+++ b/src/modes/cmode_v.cpp
@@ -50,21 +50,19 @@ void ModeChannelVoice::RemoveMode(chanrec* channel)
CUList* list = channel->GetVoicedUsers();
CUList copy;
char moderemove[MAXBUF];
- userrec* n = new userrec(ServerInstance);
- n->SetFd(FD_MAGIC_NUMBER);
for (CUList::iterator i = list->begin(); i != list->end(); i++)
{
userrec* n = i->first;
copy.insert(std::make_pair(n,n->nick));
}
+
for (CUList::iterator i = copy.begin(); i != copy.end(); i++)
{
sprintf(moderemove,"-%c",this->GetModeChar());
const char* parameters[] = { channel->name, moderemove, i->first->nick };
- ServerInstance->SendMode(parameters, 3, n);
+ ServerInstance->SendMode(parameters, 3, ServerInstance->FakeClient);
}
- delete n;
}
void ModeChannelVoice::RemoveMode(userrec* user)