summaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/channels.cpp34
-rw-r--r--src/cull_list.cpp2
-rw-r--r--src/modules.cpp6
3 files changed, 29 insertions, 13 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);
}
diff --git a/src/cull_list.cpp b/src/cull_list.cpp
index f6ea2e0f1..b0bf74ccb 100644
--- a/src/cull_list.cpp
+++ b/src/cull_list.cpp
@@ -109,9 +109,9 @@ int CullList::Apply()
if (a->GetUser()->registered == REG_ALL)
{
+ FOREACH_MOD_I(ServerInstance,I_OnUserQuit,OnUserQuit(a->GetUser(), reason, oper_reason));
a->GetUser()->PurgeEmptyChannels();
a->GetUser()->WriteCommonQuit(reason, oper_reason);
- FOREACH_MOD_I(ServerInstance,I_OnUserQuit,OnUserQuit(a->GetUser(), reason, oper_reason));
}
FOREACH_MOD_I(ServerInstance,I_OnUserDisconnect,OnUserDisconnect(a->GetUser()));
diff --git a/src/modules.cpp b/src/modules.cpp
index aa2d5f82a..f4cc5d3b9 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -106,9 +106,9 @@ std::string Event::GetEventID()
void Module::OnUserConnect(userrec* user) { }
void Module::OnUserQuit(userrec* user, const std::string& message, const std::string &oper_message) { }
void Module::OnUserDisconnect(userrec* user) { }
-void Module::OnUserJoin(userrec* user, chanrec* channel) { }
+void Module::OnUserJoin(userrec* user, chanrec* channel, bool &silent) { }
void Module::OnPostJoin(userrec* user, chanrec* channel) { }
-void Module::OnUserPart(userrec* user, chanrec* channel, const std::string &partmessage) { }
+void Module::OnUserPart(userrec* user, chanrec* channel, const std::string &partmessage, bool &silent) { }
void Module::OnRehash(userrec* user, const std::string &parameter) { }
void Module::OnServerRaw(std::string &raw, bool inbound, userrec* user) { }
int Module::OnUserPreJoin(userrec* user, chanrec* chan, const char* cname, std::string &privs) { return 0; }
@@ -134,7 +134,7 @@ void Module::OnPostCommand(const std::string &command, const char** parameters,
bool Module::OnCheckReady(userrec* user) { return true; };
int Module::OnUserRegister(userrec* user) { return 0; };
int Module::OnUserPreKick(userrec* source, userrec* user, chanrec* chan, const std::string &reason) { return 0; };
-void Module::OnUserKick(userrec* source, userrec* user, chanrec* chan, const std::string &reason) { };
+void Module::OnUserKick(userrec* source, userrec* user, chanrec* chan, const std::string &reason, bool &silent) { };
int Module::OnCheckInvite(userrec* user, chanrec* chan) { return 0; };
int Module::OnCheckKey(userrec* user, chanrec* chan, const std::string &keygiven) { return 0; };
int Module::OnCheckLimit(userrec* user, chanrec* chan) { return 0; };