mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Fixed issues with key when joining a 'trying' chan
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@347 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
11
Chan.cpp
11
Chan.cpp
@@ -44,10 +44,11 @@ void CChan::Cycle() const {
|
||||
m_pUser->PutIRC("PART " + GetName() + "\r\nJOIN " + GetName() + " " + GetKey());
|
||||
}
|
||||
|
||||
void CChan::JoinUser(bool bForce) {
|
||||
void CChan::JoinUser(bool bForce, const CString& sKey) {
|
||||
if (!bForce && (!IsOn() || !IsDetached())) {
|
||||
IncClientRequests();
|
||||
m_pUser->PutIRC("JOIN " + GetName());
|
||||
|
||||
m_pUser->PutIRC("JOIN " + GetName() + " " + ((sKey.empty()) ? GetKey() : sKey));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -124,7 +125,7 @@ CString CChan::GetModeString() const {
|
||||
void CChan::SetModes(const CString& sModes) {
|
||||
m_musModes.clear();
|
||||
m_uLimit = 0;
|
||||
m_sKey = "";
|
||||
m_sCurKey = "";
|
||||
ModeChange(sModes);
|
||||
}
|
||||
|
||||
@@ -244,6 +245,10 @@ void CChan::ModeChange(const CString& sModes, const CString& sOpNick) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (uMode == M_Key) {
|
||||
m_sCurKey = (bAdd) ? sArg : "";
|
||||
}
|
||||
|
||||
(bAdd) ? AddMode(uMode, sArg) : RemMode(uMode, sArg);
|
||||
}
|
||||
}
|
||||
|
||||
6
Chan.h
6
Chan.h
@@ -1,6 +1,7 @@
|
||||
#ifndef _CHAN_H
|
||||
#define _CHAN_H
|
||||
|
||||
#include "main.h"
|
||||
#include "Nick.h"
|
||||
#include "String.h"
|
||||
#include <vector>
|
||||
@@ -45,7 +46,7 @@ public:
|
||||
void Reset();
|
||||
void Joined();
|
||||
void Cycle() const;
|
||||
void JoinUser(bool bForce = false);
|
||||
void JoinUser(bool bForce = false, const CString& sKey = "");
|
||||
void DetachUser();
|
||||
void SendBuffer();
|
||||
|
||||
@@ -110,7 +111,7 @@ public:
|
||||
const bool IsOn() const { return m_bIsOn; }
|
||||
const CString& GetName() const { return m_sName; }
|
||||
const map<unsigned char, CString>& GetModes() const { return m_musModes; }
|
||||
const CString& GetKey() const { return m_sKey; }
|
||||
const CString& GetKey() const { return (!m_sCurKey.empty()) ? m_sCurKey : m_sKey; }
|
||||
unsigned int GetLimit() const { return m_uLimit; }
|
||||
const CString& GetTopic() const { return m_sTopic; }
|
||||
const CString& GetTopicOwner() const { return m_sTopicOwner; }
|
||||
@@ -134,6 +135,7 @@ protected:
|
||||
bool m_bAutoCycle;
|
||||
CString m_sName;
|
||||
CString m_sKey;
|
||||
CString m_sCurKey;
|
||||
CString m_sTopic;
|
||||
CString m_sTopicOwner;
|
||||
unsigned long m_ulTopicDate;
|
||||
|
||||
@@ -112,6 +112,8 @@ void CUserSock::ReadLine(const CString& sData) {
|
||||
return; // Don't forward this msg. ZNC has already registered us.
|
||||
} else if (sCommand.CaseCmp("JOIN") == 0) {
|
||||
CString sChan = sLine.Token(1);
|
||||
CString sKey = sLine.Token(2);
|
||||
|
||||
if (sChan.Left(1) == ":") {
|
||||
sChan.LeftChomp();
|
||||
}
|
||||
@@ -120,7 +122,7 @@ void CUserSock::ReadLine(const CString& sData) {
|
||||
CChan* pChan = m_pUser->FindChan(sChan);
|
||||
|
||||
if (pChan) {
|
||||
pChan->JoinUser();
|
||||
pChan->JoinUser(false, sKey);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -524,11 +526,11 @@ void CUserSock::UserCommand(const CString& sLine) {
|
||||
Table.SetCell("Buf", CString((pChan->KeepBuffer()) ? "*" : "") + CString::ToString(pChan->GetBufferCount()));
|
||||
|
||||
CString sModes = pChan->GetModeString();
|
||||
unsigned int uLimit = pChan->GetLimit();
|
||||
/*unsigned int uLimit = pChan->GetLimit();
|
||||
const CString& sKey = pChan->GetKey();
|
||||
|
||||
if (uLimit) { sModes += " " + CString::ToString(uLimit); }
|
||||
if (!sKey.empty()) { sModes += " " + sKey; }
|
||||
if (!sKey.empty()) { sModes += " " + sKey; }*/
|
||||
|
||||
Table.SetCell("Modes", sModes);
|
||||
Table.SetCell("Users", CString::ToString(pChan->GetNickCount()));
|
||||
|
||||
Reference in New Issue
Block a user