本文整理汇总了C++中CChan::InConfig方法的典型用法代码示例。如果您正苦于以下问题:C++ CChan::InConfig方法的具体用法?C++ CChan::InConfig怎么用?C++ CChan::InConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CChan
的用法示例。
在下文中一共展示了CChan::InConfig方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: ToConfig
CConfig CIRCNetwork::ToConfig() {
CConfig config;
if (!m_sNick.empty()) {
config.AddKeyValuePair("Nick", m_sNick);
}
if (!m_sAltNick.empty()) {
config.AddKeyValuePair("AltNick", m_sAltNick);
}
if (!m_sIdent.empty()) {
config.AddKeyValuePair("Ident", m_sIdent);
}
if (!m_sRealName.empty()) {
config.AddKeyValuePair("RealName", m_sRealName);
}
if (!m_sBindHost.empty()) {
config.AddKeyValuePair("BindHost", m_sBindHost);
}
config.AddKeyValuePair("IRCConnectEnabled", CString(GetIRCConnectEnabled()));
config.AddKeyValuePair("FloodRate", CString(GetFloodRate()));
config.AddKeyValuePair("FloodBurst", CString(GetFloodBurst()));
// Modules
CModules& Mods = GetModules();
if (!Mods.empty()) {
for (unsigned int a = 0; a < Mods.size(); a++) {
CString sArgs = Mods[a]->GetArgs();
if (!sArgs.empty()) {
sArgs = " " + sArgs;
}
config.AddKeyValuePair("LoadModule", Mods[a]->GetModName() + sArgs);
}
}
// Servers
for (unsigned int b = 0; b < m_vServers.size(); b++) {
config.AddKeyValuePair("Server", m_vServers[b]->GetString());
}
// Chans
for (unsigned int c = 0; c < m_vChans.size(); c++) {
CChan* pChan = m_vChans[c];
if (pChan->InConfig()) {
config.AddSubConfig("Chan", pChan->GetName(), pChan->ToConfig());
}
}
return config;
}
示例3: GetChan
void GetChan(const CString& sLine) {
const CString var = sLine.Token(1).AsLower();
CString username = sLine.Token(2);
CString chan = sLine.Token(3, true);
if (var.empty()) {
PutModule("Usage: getchan <variable> [username] <chan>");
return;
}
if (chan.empty()) {
chan = username;
username = "";
}
if (username.empty()) {
username = m_pUser->GetUserName();
}
CUser* user = GetUser(username);
if (!user)
return;
CChan* pChan = user->FindChan(chan);
if (!pChan) {
PutModule("Error: Channel not found: " + chan);
return;
}
if (var == "defmodes")
PutModule("DefModes = " + pChan->GetDefaultModes());
else if (var == "buffer")
PutModule("Buffer = " + CString(pChan->GetBufferCount()));
else if (var == "inconfig")
PutModule("InConfig = " + pChan->InConfig());
else if (var == "keepbuffer")
PutModule("KeepBuffer = " + pChan->KeepBuffer());
else if (var == "detached")
PutModule("Detached = " + pChan->IsDetached());
else
PutModule("Error: Unknown variable");
}
示例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: WriteConfig
bool CUser::WriteConfig(CFile& File) {
File.Write("<User " + GetUserName().FirstLine() + ">\n");
if (m_eHashType != HASH_NONE) {
CString sHash = "md5";
if (m_eHashType == HASH_SHA256)
sHash = "sha256";
if (m_sPassSalt.empty()) {
PrintLine(File, "Pass", sHash + "#" + GetPass());
} else {
PrintLine(File, "Pass", sHash + "#" + GetPass() + "#" + m_sPassSalt + "#");
}
} else {
PrintLine(File, "Pass", "plain#" + GetPass());
}
PrintLine(File, "Nick", GetNick());
PrintLine(File, "AltNick", GetAltNick());
PrintLine(File, "Ident", GetIdent());
PrintLine(File, "RealName", GetRealName());
PrintLine(File, "BindHost", GetBindHost());
PrintLine(File, "DCCBindHost", GetDCCBindHost());
PrintLine(File, "QuitMsg", GetQuitMsg());
if (CZNC::Get().GetStatusPrefix() != GetStatusPrefix())
PrintLine(File, "StatusPrefix", GetStatusPrefix());
PrintLine(File, "Skin", GetSkinName());
PrintLine(File, "ChanModes", GetDefaultChanModes());
PrintLine(File, "Buffer", CString(GetBufferCount()));
PrintLine(File, "KeepBuffer", CString(KeepBuffer()));
PrintLine(File, "MultiClients", CString(MultiClients()));
PrintLine(File, "BounceDCCs", CString(BounceDCCs()));
PrintLine(File, "DenyLoadMod", CString(DenyLoadMod()));
PrintLine(File, "Admin", CString(IsAdmin()));
PrintLine(File, "DenySetBindHost", CString(DenySetBindHost()));
PrintLine(File, "DCCLookupMethod", CString((UseClientIP()) ? "client" : "default"));
PrintLine(File, "TimestampFormat", GetTimestampFormat());
PrintLine(File, "AppendTimestamp", CString(GetTimestampAppend()));
PrintLine(File, "PrependTimestamp", CString(GetTimestampPrepend()));
PrintLine(File, "TimezoneOffset", CString(m_fTimezoneOffset));
PrintLine(File, "JoinTries", CString(m_uMaxJoinTries));
PrintLine(File, "MaxJoins", CString(m_uMaxJoins));
PrintLine(File, "IRCConnectEnabled", CString(GetIRCConnectEnabled()));
File.Write("\n");
// Allow Hosts
if (!m_ssAllowedHosts.empty()) {
for (set<CString>::iterator it = m_ssAllowedHosts.begin(); it != m_ssAllowedHosts.end(); ++it) {
PrintLine(File, "Allow", *it);
}
File.Write("\n");
}
// CTCP Replies
if (!m_mssCTCPReplies.empty()) {
for (MCString::const_iterator itb = m_mssCTCPReplies.begin(); itb != m_mssCTCPReplies.end(); ++itb) {
PrintLine(File, "CTCPReply", itb->first.AsUpper() + " " + itb->second);
}
File.Write("\n");
}
// Modules
CModules& Mods = GetModules();
if (!Mods.empty()) {
for (unsigned int a = 0; a < Mods.size(); a++) {
CString sArgs = Mods[a]->GetArgs();
if (!sArgs.empty()) {
sArgs = " " + sArgs;
}
PrintLine(File, "LoadModule", Mods[a]->GetModName() + sArgs);
}
File.Write("\n");
}
// Servers
for (unsigned int b = 0; b < m_vServers.size(); b++) {
PrintLine(File, "Server", m_vServers[b]->GetString());
}
// Chans
for (unsigned int c = 0; c < m_vChans.size(); c++) {
CChan* pChan = m_vChans[c];
if (pChan->InConfig()) {
File.Write("\n");
if (!pChan->WriteConfig(File)) {
return false;
}
}
}
File.Write("</User>\n");
return true;
}
示例7: 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];
//.........这里部分代码省略.........