diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/channels.cpp | 34 | ||||
-rw-r--r-- | src/cull_list.cpp | 2 | ||||
-rw-r--r-- | src/modules.cpp | 6 |
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 ¶meter) { } 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; }; |