mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Revise CChan::JoinUser() & AttachUser()
The old AttachUser() that sent JOIN without topic or names replies would leave clients in incomplete/broken state. JoinUser() was doing two things; depending on passed arguments it was either joining user on the channel on IRC, or attaching clients (properly). Now JoinUser() joins the user on IRC, and AttachUser() attaches as expected from the method names.
This commit is contained in:
20
src/Chan.cpp
20
src/Chan.cpp
@@ -116,7 +116,7 @@ void CChan::Clone(CChan& chan) {
|
||||
// and only attach if we are on the channel)
|
||||
if (IsOn()) {
|
||||
if (IsDetached()) {
|
||||
JoinUser(false, "");
|
||||
AttachUser();
|
||||
} else {
|
||||
DetachUser();
|
||||
}
|
||||
@@ -129,13 +129,18 @@ void CChan::Cycle() const {
|
||||
m_pNetwork->PutIRC("PART " + GetName() + "\r\nJOIN " + GetName() + " " + GetKey());
|
||||
}
|
||||
|
||||
void CChan::JoinUser(bool bForce, const CString& sKey, CClient* pClient) {
|
||||
if (!bForce && (!IsOn() || !IsDetached())) {
|
||||
m_pNetwork->PutIRC("JOIN " + GetName() + " " + ((sKey.empty()) ? GetKey() : sKey));
|
||||
void CChan::JoinUser(const CString& sKey) {
|
||||
if (!sKey.empty()) {
|
||||
SetKey(sKey);
|
||||
}
|
||||
if (!IsOn() || !IsDetached()) {
|
||||
m_pNetwork->PutIRC("JOIN " + GetName() + " " + GetKey());
|
||||
SetDetached(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void CChan::AttachUser(CClient* pClient) {
|
||||
m_pNetwork->PutUser(":" + m_pNetwork->GetIRCNick().GetNickMask() + " JOIN :" + GetName(), pClient);
|
||||
|
||||
if (!GetTopic().empty()) {
|
||||
@@ -199,13 +204,6 @@ void CChan::DetachUser() {
|
||||
}
|
||||
}
|
||||
|
||||
void CChan::AttachUser() {
|
||||
if (m_bDetached) {
|
||||
m_pNetwork->PutUser(":" + m_pNetwork->GetIRCNick().GetNickMask() + " JOIN " + GetName());
|
||||
m_bDetached = false;
|
||||
}
|
||||
}
|
||||
|
||||
CString CChan::GetModeString() const {
|
||||
CString sModes, sArgs;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user