本文整理汇总了C++中CChan::SetInConfig方法的典型用法代码示例。如果您正苦于以下问题:C++ CChan::SetInConfig方法的具体用法?C++ CChan::SetInConfig怎么用?C++ CChan::SetInConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CChan
的用法示例。
在下文中一共展示了CChan::SetInConfig方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnPart
void OnPart(const CNick& Nick, CChan& Channel,
const CString& sMessage) override {
if (Channel.InConfig() &&
GetNetwork()->GetIRCNick().NickEquals(Nick.GetNick())) {
Channel.SetInConfig(false);
}
}
示例2: SetChan
void SetChan(const CString& sLine) {
const CString var = sLine.Token(1).AsLower();
CString username = sLine.Token(2);
CString chan = sLine.Token(3);
CString value = sLine.Token(4, true);
if (value.empty()) {
PutModule("Usage: setchan <variable> <username> <chan> <value>");
return;
}
CUser* user = GetUser(username);
if (!user)
return;
CChan* pChan = user->FindChan(chan);
if (!pChan) {
PutModule("Error: Channel not found: " + chan);
return;
}
if (var == "defmodes") {
pChan->SetDefaultModes(value);
PutModule("DefModes = " + value);
} else if (var == "buffer") {
unsigned int i = value.ToUInt();
pChan->SetBufferCount(i);
PutModule("Buffer = " + CString(i));
} else if (var == "inconfig") {
bool b = value.ToBool();
pChan->SetInConfig(b);
PutModule("InConfig = " + CString(b));
} else if (var == "keepbuffer") {
bool b = value.ToBool();
pChan->SetKeepBuffer(b);
PutModule("KeepBuffer = " + CString(b));
} else if (var == "detached") {
bool b = value.ToBool();
if (pChan->IsDetached() != b) {
if (b)
pChan->DetachUser();
else
pChan->AttachUser();
}
PutModule("Detached = " + CString(b));
} else
PutModule("Error: Unknown variable");
}
示例3: Clone
void CIRCNetwork::Clone(const CIRCNetwork& Network, bool bCloneName) {
if (bCloneName) {
m_sName = Network.GetName();
}
m_fFloodRate = Network.GetFloodRate();
m_uFloodBurst = Network.GetFloodBurst();
m_uJoinDelay = Network.GetJoinDelay();
SetNick(Network.GetNick());
SetAltNick(Network.GetAltNick());
SetIdent(Network.GetIdent());
SetRealName(Network.GetRealName());
SetBindHost(Network.GetBindHost());
SetEncoding(Network.GetEncoding());
SetQuitMsg(Network.GetQuitMsg());
m_ssTrustedFingerprints = Network.m_ssTrustedFingerprints;
// Servers
const vector<CServer*>& vServers = Network.GetServers();
CString sServer;
CServer* pCurServ = GetCurrentServer();
if (pCurServ) {
sServer = pCurServ->GetName();
}
DelServers();
for (CServer* pServer : vServers) {
AddServer(pServer->GetName(), pServer->GetPort(), pServer->GetPass(), pServer->IsSSL());
}
m_uServerIdx = 0;
for (size_t a = 0; a < m_vServers.size(); a++) {
if (sServer.Equals(m_vServers[a]->GetName())) {
m_uServerIdx = a + 1;
break;
}
}
if (m_uServerIdx == 0) {
m_uServerIdx = m_vServers.size();
CIRCSock* pSock = GetIRCSock();
if (pSock) {
PutStatus("Jumping servers because this server is no longer in the list");
pSock->Quit();
}
}
// !Servers
// Chans
const vector<CChan*>& vChans = Network.GetChans();
for (CChan* pNewChan : vChans) {
CChan* pChan = FindChan(pNewChan->GetName());
if (pChan) {
pChan->SetInConfig(pNewChan->InConfig());
} else {
AddChan(pNewChan->GetName(), pNewChan->InConfig());
}
}
for (CChan* pChan : m_vChans) {
CChan* pNewChan = Network.FindChan(pChan->GetName());
if (!pNewChan) {
pChan->SetInConfig(false);
} else {
pChan->Clone(*pNewChan);
}
}
// !Chans
// Modules
set<CString> ssUnloadMods;
CModules& vCurMods = GetModules();
const CModules& vNewMods = Network.GetModules();
for (CModule* pNewMod : vNewMods) {
CString sModRet;
CModule* pCurMod = vCurMods.FindModule(pNewMod->GetModName());
if (!pCurMod) {
vCurMods.LoadModule(pNewMod->GetModName(), pNewMod->GetArgs(), CModInfo::NetworkModule, m_pUser, this, sModRet);
} else if (pNewMod->GetArgs() != pCurMod->GetArgs()) {
vCurMods.ReloadModule(pNewMod->GetModName(), pNewMod->GetArgs(), m_pUser, this, sModRet);
}
}
for (CModule* pCurMod : vCurMods) {
CModule* pNewMod = vNewMods.FindModule(pCurMod->GetModName());
if (!pNewMod) {
ssUnloadMods.insert(pCurMod->GetModName());
}
}
for (const CString& sMod : ssUnloadMods) {
vCurMods.UnloadModule(sMod);
//.........这里部分代码省略.........
示例4: Clone
void CIRCNetwork::Clone(const CIRCNetwork& Network) {
m_sName = Network.GetName();
SetNick(Network.GetNick());
SetAltNick(Network.GetAltNick());
SetIdent(Network.GetIdent());
SetRealName(Network.GetRealName());
// Servers
const vector<CServer*>& vServers = Network.GetServers();
CString sServer;
CServer* pCurServ = GetCurrentServer();
if (pCurServ) {
sServer = pCurServ->GetName();
}
DelServers();
unsigned int a;
for (a = 0; a < vServers.size(); a++) {
CServer* pServer = vServers[a];
AddServer(pServer->GetName(), pServer->GetPort(), pServer->GetPass(), pServer->IsSSL());
}
m_uServerIdx = 0;
for (a = 0; a < m_vServers.size(); a++) {
if (sServer.Equals(m_vServers[a]->GetName())) {
m_uServerIdx = a + 1;
break;
}
}
if (m_uServerIdx == 0) {
m_uServerIdx = m_vServers.size();
CIRCSock* pSock = GetIRCSock();
if (pSock) {
PutStatus("Jumping servers because this server is no longer in the list");
pSock->Quit();
}
}
// !Servers
// Chans
const vector<CChan*>& vChans = Network.GetChans();
for (a = 0; a < vChans.size(); a++) {
CChan* pNewChan = vChans[a];
CChan* pChan = FindChan(pNewChan->GetName());
if (pChan) {
pChan->SetInConfig(pNewChan->InConfig());
} else {
AddChan(pNewChan->GetName(), pNewChan->InConfig());
}
}
for (a = 0; a < m_vChans.size(); a++) {
CChan* pChan = m_vChans[a];
CChan* pNewChan = Network.FindChan(pChan->GetName());
if (!pNewChan) {
pChan->SetInConfig(false);
} else {
pChan->Clone(*pNewChan);
}
}
// !Chans
// Modules
set<CString> ssUnloadMods;
CModules& vCurMods = GetModules();
const CModules& vNewMods = Network.GetModules();
for (a = 0; a < vNewMods.size(); a++) {
CString sModRet;
CModule* pNewMod = vNewMods[a];
CModule* pCurMod = vCurMods.FindModule(pNewMod->GetModName());
if (!pCurMod) {
vCurMods.LoadModule(pNewMod->GetModName(), pNewMod->GetArgs(), CModInfo::NetworkModule, m_pUser, this, sModRet);
} else if (pNewMod->GetArgs() != pCurMod->GetArgs()) {
vCurMods.ReloadModule(pNewMod->GetModName(), pNewMod->GetArgs(), m_pUser, this, sModRet);
}
}
for (a = 0; a < vCurMods.size(); a++) {
CModule* pCurMod = vCurMods[a];
CModule* pNewMod = vNewMods.FindModule(pCurMod->GetModName());
if (!pNewMod) {
ssUnloadMods.insert(pCurMod->GetModName());
}
}
for (set<CString>::iterator it = ssUnloadMods.begin(); it != ssUnloadMods.end(); ++it) {
vCurMods.UnloadModule(*it);
}
// !Modules
SetIRCConnectEnabled(Network.GetIRCConnectEnabled());
//.........这里部分代码省略.........
示例5: OnJoin
virtual void OnJoin(const CNick& Nick, CChan& Channel) override {
if (!Channel.InConfig() && GetNetwork()->GetIRCNick().NickEquals(Nick.GetNick())) {
Channel.SetInConfig(true);
}
}
示例6: Clone
bool CUser::Clone(const CUser& User, CString& sErrorRet, bool bCloneChans) {
unsigned int a = 0;
sErrorRet.clear();
if (!User.IsValid(sErrorRet, true)) {
return false;
}
// user names can only specified for the constructor, changing it later
// on breaks too much stuff (e.g. lots of paths depend on the user name)
if (GetUserName() != User.GetUserName()) {
DEBUG("Ignoring username in CUser::Clone(), old username [" << GetUserName()
<< "]; New username [" << User.GetUserName() << "]");
}
if (!User.GetPass().empty()) {
SetPass(User.GetPass(), User.GetPassHashType(), User.GetPassSalt());
}
SetNick(User.GetNick(false));
SetAltNick(User.GetAltNick(false));
SetIdent(User.GetIdent(false));
SetRealName(User.GetRealName());
SetStatusPrefix(User.GetStatusPrefix());
SetBindHost(User.GetBindHost());
SetDCCBindHost(User.GetDCCBindHost());
SetQuitMsg(User.GetQuitMsg());
SetSkinName(User.GetSkinName());
SetDefaultChanModes(User.GetDefaultChanModes());
SetBufferCount(User.GetBufferCount(), true);
SetJoinTries(User.JoinTries());
SetMaxJoins(User.MaxJoins());
// Allowed Hosts
m_ssAllowedHosts.clear();
const set<CString>& ssHosts = User.GetAllowedHosts();
for (set<CString>::const_iterator it = ssHosts.begin(); it != ssHosts.end(); ++it) {
AddAllowedHost(*it);
}
for (a = 0; a < m_vClients.size(); a++) {
CClient* pSock = m_vClients[a];
if (!IsHostAllowed(pSock->GetRemoteIP())) {
pSock->PutStatusNotice("You are being disconnected because your IP is no longer allowed to connect to this user");
pSock->Close();
}
}
// !Allowed Hosts
// Servers
const vector<CServer*>& vServers = User.GetServers();
CString sServer;
CServer* pCurServ = GetCurrentServer();
if (pCurServ) {
sServer = pCurServ->GetName();
}
DelServers();
for (a = 0; a < vServers.size(); a++) {
CServer* pServer = vServers[a];
AddServer(pServer->GetName(), pServer->GetPort(), pServer->GetPass(), pServer->IsSSL());
}
m_uServerIdx = 0;
for (a = 0; a < m_vServers.size(); a++) {
if (sServer.Equals(m_vServers[a]->GetName())) {
m_uServerIdx = a + 1;
break;
}
}
if (m_uServerIdx == 0) {
m_uServerIdx = m_vServers.size();
CIRCSock* pSock = GetIRCSock();
if (pSock) {
PutStatus("Jumping servers because this server is no longer in the list");
pSock->Quit();
}
}
// !Servers
// Chans
const vector<CChan*>& vChans = User.GetChans();
for (a = 0; a < vChans.size(); a++) {
CChan* pNewChan = vChans[a];
CChan* pChan = FindChan(pNewChan->GetName());
if (pChan) {
pChan->SetInConfig(pNewChan->InConfig());
} else {
AddChan(pNewChan->GetName(), pNewChan->InConfig());
}
}
for (a = 0; a < m_vChans.size(); a++) {
CChan* pChan = m_vChans[a];
//.........这里部分代码省略.........
示例7: OnPart
virtual void OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage) {
if (Nick.GetNick() == m_pUser->GetIRCNick().GetNick()) {
Channel.SetInConfig(false);
CZNC::Get().WriteConfig();
}
}
示例8: OnJoin
virtual void OnJoin(const CNick& Nick, CChan& Channel) {
if (Nick.GetNick() == m_pUser->GetIRCNick().GetNick()) {
Channel.SetInConfig(true);
CZNC::Get().WriteConfig();
}
}