summaryrefslogtreecommitdiff
path: root/src/channels.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-05-03 21:57:58 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-05-03 21:57:58 +0000
commit3ec7995bf4981119115d14ce2cfce0cb5795f803 (patch)
tree358fa606d92ba5d6002021c7fe7ad14f4f9995cd /src/channels.cpp
parent2c04423995da525bd762dea2bbde9d3bb522f8c2 (diff)
DO NOT USE THIS COMMIT - if you do, most of the modules wont work.
DEVS: Please fix all modules that have warnings to use the new parameters to OnUserJoin, OnUserPart and OnUserKick (bool &silent) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6858 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/channels.cpp')
-rw-r--r--src/channels.cpp34
1 files changed, 25 insertions, 9 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index ce7cbb45c..23aeb32a1 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -341,6 +341,7 @@ chanrec* chanrec::ForceChan(InspIRCd* Instance, chanrec* Ptr, userrec* user, con
{
userrec* dummyuser = new userrec(Instance);
std::string nick = user->nick;
+ bool silent = false;
dummyuser->SetFd(FD_MAGIC_NUMBER);
Ptr->AddUser(user);
@@ -383,7 +384,10 @@ chanrec* chanrec::ForceChan(InspIRCd* Instance, chanrec* Ptr, userrec* user, con
delete dummyuser;
- Ptr->WriteChannel(user,"JOIN :%s",Ptr->name);
+ FOREACH_MOD_I(Instance,I_OnUserJoin,OnUserJoin(user, Ptr, silent));
+
+ if (!silent)
+ Ptr->WriteChannel(user,"JOIN :%s",Ptr->name);
/* Theyre not the first ones in here, make sure everyone else sees the modes we gave the user */
std::string ms = Instance->Modes->ModeString(user, Ptr);
@@ -400,8 +404,7 @@ chanrec* chanrec::ForceChan(InspIRCd* Instance, chanrec* Ptr, userrec* user, con
}
Ptr->UserList(user);
}
- FOREACH_MOD_I(Instance,I_OnUserJoin,OnUserJoin(user,Ptr));
- FOREACH_MOD_I(Instance,I_OnPostJoin,OnPostJoin(user,Ptr));
+ FOREACH_MOD_I(Instance,I_OnPostJoin,OnPostJoin(user, Ptr));
return Ptr;
}
@@ -434,14 +437,19 @@ bool chanrec::IsBanned(userrec* user)
*/
long chanrec::PartUser(userrec *user, const char* reason)
{
+ bool silent = false;
+
if (!user)
return this->GetUserCounter();
UCListIter i = user->chans.find(this);
if (i != user->chans.end())
{
- FOREACH_MOD(I_OnUserPart,OnUserPart(user, this, reason ? reason : ""));
- this->WriteChannel(user, "PART %s%s%s", this->name, reason ? " :" : "", reason ? reason : "");
+ FOREACH_MOD(I_OnUserPart,OnUserPart(user, this, reason ? reason : "", silent));
+
+ if (!silent)
+ this->WriteChannel(user, "PART %s%s%s", this->name, reason ? " :" : "", reason ? reason : "");
+
user->chans.erase(i);
this->RemoveAllPrefixes(user);
}
@@ -463,6 +471,8 @@ long chanrec::PartUser(userrec *user, const char* reason)
long chanrec::ServerKickUser(userrec* user, const char* reason, bool triggerevents)
{
+ bool silent = false;
+
if (!user || !reason)
return this->GetUserCounter();
@@ -477,13 +487,15 @@ long chanrec::ServerKickUser(userrec* user, const char* reason, bool triggereven
if (triggerevents)
{
- FOREACH_MOD(I_OnUserKick,OnUserKick(NULL,user,this,reason));
+ FOREACH_MOD(I_OnUserKick,OnUserKick(NULL, user, this, reason, silent));
}
UCListIter i = user->chans.find(this);
if (i != user->chans.end())
{
- this->WriteChannelWithServ(ServerInstance->Config->ServerName, "KICK %s %s :%s", this->name, user->nick, reason);
+ if (!silent)
+ this->WriteChannelWithServ(ServerInstance->Config->ServerName, "KICK %s %s :%s", this->name, user->nick, reason);
+
user->chans.erase(i);
this->RemoveAllPrefixes(user);
}
@@ -505,6 +517,8 @@ long chanrec::ServerKickUser(userrec* user, const char* reason, bool triggereven
long chanrec::KickUser(userrec *src, userrec *user, const char* reason)
{
+ bool silent = false;
+
if (!src || !user || !reason)
return this->GetUserCounter();
@@ -549,13 +563,15 @@ long chanrec::KickUser(userrec *src, userrec *user, const char* reason)
}
}
- FOREACH_MOD(I_OnUserKick,OnUserKick(src,user,this,reason));
+ FOREACH_MOD(I_OnUserKick,OnUserKick(src, user, this, reason, silent));
UCListIter i = user->chans.find(this);
if (i != user->chans.end())
{
/* zap it from the channel list of the user */
- this->WriteChannel(src, "KICK %s %s :%s", this->name, user->nick, reason);
+ if (!silent)
+ this->WriteChannel(src, "KICK %s %s :%s", this->name, user->nick, reason);
+
user->chans.erase(i);
this->RemoveAllPrefixes(user);
}