diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-10-02 22:27:03 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-10-02 22:27:03 +0000 |
commit | a95616f608aefc38250a620087639dcc6407567f (patch) | |
tree | f4356ceb06e6a02fea26456c6a63261efc86fb19 | |
parent | 2a88309abe3f5757b7638e32d44bc89b7d4f5b0e (diff) |
Fix for bug #601
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10614 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | include/modules.h | 8 | ||||
-rw-r--r-- | src/modules.cpp | 1 | ||||
-rw-r--r-- | src/modules/m_auditorium.cpp | 9 | ||||
-rw-r--r-- | src/modules/m_delayjoin.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_invisible.cpp | 6 | ||||
-rw-r--r-- | src/users.cpp | 12 |
6 files changed, 38 insertions, 4 deletions
diff --git a/include/modules.h b/include/modules.h index e9ada30ff..a625a082c 100644 --- a/include/modules.h +++ b/include/modules.h @@ -400,7 +400,7 @@ enum Implementation I_OnRawSocketAccept, I_OnRawSocketClose, I_OnRawSocketWrite, I_OnRawSocketRead, I_OnChangeLocalUserGECOS, I_OnUserRegister, I_OnChannelPreDelete, I_OnChannelDelete, I_OnPostOper, I_OnSyncOtherMetaData, I_OnSetAway, I_OnUserList, I_OnPostCommand, I_OnPostJoin, I_OnWhoisLine, I_OnBuildExemptList, I_OnRawSocketConnect, I_OnGarbageCollect, I_OnBufferFlushed, - I_OnText, I_OnPassCompare, I_OnRunTestSuite, I_OnNamesListItem, I_OnNumeric, I_OnHookUserIO, + I_OnText, I_OnPassCompare, I_OnRunTestSuite, I_OnNamesListItem, I_OnNumeric, I_OnHookUserIO, I_OnHostCycle, I_END }; @@ -1385,6 +1385,12 @@ class CoreExport Module : public Extensible virtual void OnNamesListItem(User* issuer, User* user, Channel* channel, std::string &prefixes, std::string &nick); virtual int OnNumeric(User* user, unsigned int numeric, const std::string &text); + + /** Called for every time the user's host or ident changes, to indicate wether or not the 'Changing host' + * message should be sent, if enabled. Certain modules such as auditorium may opt to hide this message + * even if it is enabled. + */ + virtual bool OnHostCycle(User* user); }; diff --git a/src/modules.cpp b/src/modules.cpp index 9e0e1fae5..6d04a8b17 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -196,6 +196,7 @@ void Module::OnRunTestSuite() { } void Module::OnNamesListItem(User*, User*, Channel*, std::string&, std::string&) { } int Module::OnNumeric(User*, unsigned int, const std::string&) { return 0; } void Module::OnHookUserIO(User*, const std::string&) { } +bool Module::OnHostCycle(User* user) { return false; } ModuleManager::ModuleManager(InspIRCd* Ins) : ModCount(0), Instance(Ins) { diff --git a/src/modules/m_auditorium.cpp b/src/modules/m_auditorium.cpp index 023cb7adf..f898c19c9 100644 --- a/src/modules/m_auditorium.cpp +++ b/src/modules/m_auditorium.cpp @@ -157,6 +157,15 @@ class ModuleAuditorium : public Module } } + bool OnHostCycle(User* user) + { + for (UCListIter f = user->chans.begin(); f != user->chans.end(); f++) + if (f->first->IsModeSet('u')) + return true; + + return false; + } + void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message) { Command* parthandler = ServerInstance->Parser->GetHandler("PART"); diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp index 613fe6f37..23e6317ad 100644 --- a/src/modules/m_delayjoin.cpp +++ b/src/modules/m_delayjoin.cpp @@ -43,6 +43,7 @@ class ModuleDelayJoin : public Module virtual Version GetVersion(); virtual void OnNamesListItem(User* issuer, User* user, Channel* channel, std::string &prefixes, std::string &nick); virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent); + bool OnHostCycle(User* user); void OnUserPart(User* user, Channel* channel, std::string &partmessage, bool &silent); void OnUserKick(User* source, User* user, Channel* chan, const std::string &reason, bool &silent); void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message); @@ -155,6 +156,11 @@ void ModuleDelayJoin::OnUserKick(User* source, User* user, Channel* chan, const } } +bool ModuleDelayJoin::OnHostCycle(User* user) +{ + return user->GetExt("delayjoin"); +} + void ModuleDelayJoin::OnUserQuit(User* user, const std::string &reason, const std::string &oper_message) { Command* parthandler = ServerInstance->Parser->GetHandler("PART"); diff --git a/src/modules/m_invisible.cpp b/src/modules/m_invisible.cpp index 836369b8f..6a1dd700d 100644 --- a/src/modules/m_invisible.cpp +++ b/src/modules/m_invisible.cpp @@ -187,6 +187,7 @@ class ModuleInvisible : public Module virtual void OnRehash(User* user, const std::string ¶meter); void OnUserPart(User* user, Channel* channel, std::string &partmessage, bool &silent); void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message); + bool OnHostCycle(User* user); /* No privmsg response when hiding - submitted by Eric at neowin */ virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list); virtual int OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list); @@ -250,6 +251,11 @@ void ModuleInvisible::OnUserQuit(User* user, const std::string &reason, const st } } +bool ModuleInvisible::OnHostCycle(User* user) +{ + return user->IsModeSet('Q'); +} + /* No privmsg response when hiding - submitted by Eric at neowin */ int ModuleInvisible::OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) { diff --git a/src/users.cpp b/src/users.cpp index 33b8cdc7c..386a64b82 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -1606,6 +1606,9 @@ bool User::ChangeDisplayedHost(const char* shost) FOREACH_MOD(I_OnChangeHost,OnChangeHost(this,shost)); } + int MOD_RESULT = 0; + FOREACH_RESULT(I_OnHostCycle, OnHostCycle(this)); + if (this->ServerInstance->Config->CycleHosts) this->WriteCommonExcept("QUIT :Changing hosts"); @@ -1614,7 +1617,7 @@ bool User::ChangeDisplayedHost(const char* shost) this->InvalidateCache(); - if (this->ServerInstance->Config->CycleHosts) + if (this->ServerInstance->Config->CycleHosts && !MOD_RESULT) { for (UCListIter i = this->chans.begin(); i != this->chans.end(); i++) { @@ -1633,9 +1636,12 @@ bool User::ChangeDisplayedHost(const char* shost) bool User::ChangeIdent(const char* newident) { - if (!this->ident.compare(newident)) + if (this->ident == newident) return true; + int MOD_RESULT = 0; + FOREACH_RESULT(I_OnHostCycle, OnHostCycle(this)); + if (this->ServerInstance->Config->CycleHosts) this->WriteCommonExcept("%s","QUIT :Changing ident"); @@ -1643,7 +1649,7 @@ bool User::ChangeIdent(const char* newident) this->InvalidateCache(); - if (this->ServerInstance->Config->CycleHosts) + if (this->ServerInstance->Config->CycleHosts && !MOD_RESULT) { for (UCListIter i = this->chans.begin(); i != this->chans.end(); i++) { |