mirror of
https://github.com/znc/znc.git
synced 2026-07-05 09:21:31 +02:00
Fixed some issues with setting op/voice status
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@36 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
void CChan::Reset() {
|
||||
m_bWhoDone = false;
|
||||
m_bIsOn = false;
|
||||
m_bIsOp = false;
|
||||
m_bIsVoice = false;
|
||||
m_uOpCount = 0;
|
||||
m_uVoiceCount = 0;
|
||||
m_uModes = 0;
|
||||
@@ -182,9 +184,17 @@ bool CChan::AddNick(const string& sNick) {
|
||||
if ((bIsOp) && (!pNick->IsOp())) {
|
||||
IncOpCount();
|
||||
pNick->SetOp(true);
|
||||
|
||||
if (strcasecmp(pNick->GetNick().c_str(), m_pUser->GetCurNick().c_str()) == 0) {
|
||||
SetOpped(true);
|
||||
}
|
||||
} else if ((bIsVoice) && (!pNick->IsVoice())) {
|
||||
IncVoiceCount();
|
||||
pNick->SetVoice(true);
|
||||
|
||||
if (strcasecmp(pNick->GetNick().c_str(), m_pUser->GetCurNick().c_str()) == 0) {
|
||||
SetVoiced(true);
|
||||
}
|
||||
}
|
||||
|
||||
m_msNicks[pNick->GetNick()] = pNick;
|
||||
@@ -240,17 +250,21 @@ void CChan::OnOp(const string& sOpNick, const string& sNick, bool bOpped) {
|
||||
if (pNick) {
|
||||
bool bNoChange = (pNick->IsOp() == bOpped);
|
||||
#ifdef _MODULES
|
||||
CNick* pOpNick = FindNick(sOpNick);
|
||||
CNick* pOpNick = FindNick(sOpNick);
|
||||
|
||||
if (pOpNick) {
|
||||
if (bOpped) {
|
||||
m_pUser->GetModules().OnOp(*pOpNick, *pNick, *this, bNoChange);
|
||||
} else {
|
||||
m_pUser->GetModules().OnDeop(*pOpNick, *pNick, *this, bNoChange);
|
||||
if (pOpNick) {
|
||||
if (bOpped) {
|
||||
m_pUser->GetModules().OnOp(*pOpNick, *pNick, *this, bNoChange);
|
||||
} else {
|
||||
m_pUser->GetModules().OnDeop(*pOpNick, *pNick, *this, bNoChange);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (strcasecmp(sNick.c_str(), m_pUser->GetCurNick().c_str()) == 0) {
|
||||
SetOpped(bOpped);
|
||||
}
|
||||
|
||||
if (bNoChange) {
|
||||
// If no change, return
|
||||
return;
|
||||
@@ -279,6 +293,10 @@ void CChan::OnVoice(const string& sOpNick, const string& sNick, bool bVoiced) {
|
||||
}
|
||||
#endif
|
||||
|
||||
if (strcasecmp(sNick.c_str(), m_pUser->GetCurNick().c_str()) == 0) {
|
||||
SetVoiced(bVoiced);
|
||||
}
|
||||
|
||||
if (bNoChange) {
|
||||
// If no change, return
|
||||
return;
|
||||
|
||||
@@ -71,6 +71,8 @@ public:
|
||||
|
||||
// Setters
|
||||
void SetIsOn(bool b) { m_bIsOn = b; if (!b) { Reset(); } else { Joined(); } }
|
||||
void SetOpped(bool b) { m_bIsOp = b; }
|
||||
void SetVoiced(bool b) { m_bIsVoice = b; }
|
||||
void SetKey(const string& s) { m_sKey = s; }
|
||||
void SetTopic(const string& s) { m_sTopic = s; }
|
||||
void SetDefaultModes(const string& s) { m_sDefaultModes = s; }
|
||||
@@ -87,6 +89,8 @@ public:
|
||||
|
||||
// Getters
|
||||
const bool IsOn() const { return m_bIsOn; }
|
||||
const bool IsOp() const { return m_bIsOp; }
|
||||
const bool IsVoice() const { return m_bIsVoice; }
|
||||
const string& GetName() const { return m_sName; }
|
||||
unsigned int GetModes() const { return m_uModes; }
|
||||
const string& GetKey() const { return m_sKey; }
|
||||
@@ -109,6 +113,8 @@ private:
|
||||
protected:
|
||||
bool m_bDetached;
|
||||
bool m_bIsOn;
|
||||
bool m_bIsOp;
|
||||
bool m_bIsVoice;
|
||||
bool m_bWhoDone;
|
||||
bool m_bKeepBuffer;
|
||||
bool m_bAutoCycle;
|
||||
|
||||
Reference in New Issue
Block a user