Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:znc/znc

  • Loading branch information...
commit c5578f875d4c824e5fa2c7559c764808347d82e1 2 parents ceeebf7 + 7683592
Alexey Sokolov authored
Showing with 22 additions and 0 deletions.
  1. +1 −0  Chan.cpp
  2. +3 −0  Chan.h
  3. +18 −0 IRCSock.cpp
1  Chan.cpp
View
@@ -55,6 +55,7 @@ CChan::~CChan() {
void CChan::Reset() {
m_bIsOn = false;
+ m_bModeKnown = false;
m_musModes.clear();
m_sTopic = "";
m_sTopicOwner = "";
3  Chan.h
View
@@ -101,6 +101,7 @@ class CChan {
// !wrappers
// Setters
+ void SetModeKnown(bool b) { m_bModeKnown = b; }
void SetIsOn(bool b) { m_bIsOn = b; if (!b) { Reset(); } }
void SetKey(const CString& s) { m_sKey = s; }
void SetTopic(const CString& s) { m_sTopic = s; }
@@ -119,6 +120,7 @@ class CChan {
// !Setters
// Getters
+ bool IsModeKnown() const { return m_bModeKnown; }
bool HasMode(unsigned char uMode) const;
CString GetOptions() const;
CString GetModeArg(unsigned char uMode) const;
@@ -163,6 +165,7 @@ class CChan {
unsigned int m_uBufferCount;
vector<CString> m_vsBuffer;
+ bool m_bModeKnown;
map<unsigned char, CString> m_musModes;
};
18 IRCSock.cpp
View
@@ -193,6 +193,15 @@ void CIRCSock::ReadLine(const CString& sData) {
if (pChan) {
pChan->SetModes(sRest.Token(1, true));
+
+ // We don't SetModeKnown(true) here,
+ // because a 329 will follow
+ if (!pChan->IsModeKnown()) {
+ // When we JOIN, we send a MODE
+ // request. This makes sure the
+ // reply isn't forwarded.
+ return;
+ }
}
}
break;
@@ -203,6 +212,14 @@ void CIRCSock::ReadLine(const CString& sData) {
if (pChan) {
unsigned long ulDate = sLine.Token(4).ToULong();
pChan->SetCreationDate(ulDate);
+
+ if (!pChan->IsModeKnown()) {
+ pChan->SetModeKnown(true);
+ // When we JOIN, we send a MODE
+ // request. This makes sure the
+ // reply isn't forwarded.
+ return;
+ }
}
}
break;
@@ -436,6 +453,7 @@ void CIRCSock::ReadLine(const CString& sData) {
pChan->ResetJoinTries();
pChan->Enable();
pChan->SetIsOn(true);
+ PutIRC("MODE " + sChan);
}
} else {
pChan = m_pNetwork->FindChan(sChan);
Please sign in to comment.
Something went wrong with that request. Please try again.