mirror of
https://github.com/znc/znc.git
synced 2026-08-05 00:13:22 +02:00
Make CNick network aware
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
#include "Nick.h"
|
||||
#include "Chan.h"
|
||||
#include "IRCSock.h"
|
||||
#include "User.h"
|
||||
#include "IRCNetwork.h"
|
||||
|
||||
CNick::CNick() {
|
||||
Reset();
|
||||
@@ -24,7 +24,7 @@ CNick::~CNick() {}
|
||||
|
||||
void CNick::Reset() {
|
||||
m_sChanPerms.clear();
|
||||
m_pUser = NULL;
|
||||
m_pNetwork = NULL;
|
||||
}
|
||||
|
||||
void CNick::Parse(const CString& sNickMask) {
|
||||
@@ -48,10 +48,10 @@ void CNick::Parse(const CString& sNickMask) {
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int CNick::GetCommonChans(vector<CChan*>& vRetChans, CUser* pUser) const {
|
||||
unsigned int CNick::GetCommonChans(vector<CChan*>& vRetChans, CIRCNetwork* pNetwork) const {
|
||||
vRetChans.clear();
|
||||
|
||||
const vector<CChan*>& vChans = pUser->GetChans();
|
||||
const vector<CChan*>& vChans = pNetwork->GetChans();
|
||||
|
||||
for (unsigned int a = 0; a < vChans.size(); a++) {
|
||||
CChan* pChan = vChans[a];
|
||||
@@ -68,7 +68,7 @@ unsigned int CNick::GetCommonChans(vector<CChan*>& vRetChans, CUser* pUser) cons
|
||||
return vRetChans.size();
|
||||
}
|
||||
|
||||
void CNick::SetUser(CUser* pUser) { m_pUser = pUser; }
|
||||
void CNick::SetNetwork(CIRCNetwork* pNetwork) { m_pNetwork = pNetwork; }
|
||||
void CNick::SetNick(const CString& s) { m_sNick = s; }
|
||||
void CNick::SetIdent(const CString& s) { m_sIdent = s; }
|
||||
void CNick::SetHost(const CString& s) { m_sHost = s; }
|
||||
@@ -99,7 +99,7 @@ bool CNick::RemPerm(unsigned char uPerm) {
|
||||
}
|
||||
|
||||
unsigned char CNick::GetPermChar() const {
|
||||
CIRCSock* pIRCSock = (!m_pUser) ? NULL : m_pUser->GetIRCSock();
|
||||
CIRCSock* pIRCSock = (!m_pNetwork) ? NULL : m_pNetwork->GetIRCSock();
|
||||
const CString& sChanPerms = (!pIRCSock) ? "@+" : pIRCSock->GetPerms();
|
||||
|
||||
for (unsigned int a = 0; a < sChanPerms.size(); a++) {
|
||||
@@ -113,7 +113,7 @@ unsigned char CNick::GetPermChar() const {
|
||||
}
|
||||
|
||||
CString CNick::GetPermStr() const {
|
||||
CIRCSock* pIRCSock = (!m_pUser) ? NULL : m_pUser->GetIRCSock();
|
||||
CIRCSock* pIRCSock = (!m_pNetwork) ? NULL : m_pNetwork->GetIRCSock();
|
||||
const CString& sChanPerms = (!pIRCSock) ? "@+" : pIRCSock->GetPerms();
|
||||
CString sRet;
|
||||
|
||||
@@ -162,5 +162,5 @@ void CNick::Clone(const CNick& SourceNick) {
|
||||
SetHost(SourceNick.GetHost());
|
||||
|
||||
m_sChanPerms = SourceNick.m_sChanPerms;
|
||||
m_pUser = SourceNick.m_pUser;
|
||||
m_pNetwork = SourceNick.m_pNetwork;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ using std::vector;
|
||||
using std::set;
|
||||
|
||||
// Forward Decl
|
||||
class CUser;
|
||||
class CIRCNetwork;
|
||||
class CChan;
|
||||
// !Forward Decl
|
||||
|
||||
@@ -32,10 +32,10 @@ public:
|
||||
void Reset();
|
||||
void Parse(const CString& sNickMask);
|
||||
CString GetHostMask() const;
|
||||
unsigned int GetCommonChans(vector<CChan*>& vChans, CUser* pUser) const;
|
||||
unsigned int GetCommonChans(vector<CChan*>& vChans, CIRCNetwork* pNetwork) const;
|
||||
|
||||
// Setters
|
||||
void SetUser(CUser* pUser);
|
||||
void SetNetwork(CIRCNetwork* pNetwork);
|
||||
void SetNick(const CString& s);
|
||||
void SetIdent(const CString& s);
|
||||
void SetHost(const CString& s);
|
||||
@@ -56,11 +56,11 @@ public:
|
||||
void Clone(const CNick& SourceNick);
|
||||
private:
|
||||
protected:
|
||||
CString m_sChanPerms;
|
||||
CUser* m_pUser;
|
||||
CString m_sNick;
|
||||
CString m_sIdent;
|
||||
CString m_sHost;
|
||||
CString m_sChanPerms;
|
||||
CIRCNetwork* m_pNetwork;
|
||||
CString m_sNick;
|
||||
CString m_sIdent;
|
||||
CString m_sHost;
|
||||
};
|
||||
|
||||
#endif // !_NICK_H
|
||||
|
||||
Reference in New Issue
Block a user