本文整理汇总了C++中CChan类的典型用法代码示例。如果您正苦于以下问题:C++ CChan类的具体用法?C++ CChan怎么用?C++ CChan使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CChan类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnVoice
virtual void OnVoice(const CNick& OpNick, const CNick& Nick, CChan& Channel, bool bNoChange) {
PutModule(((bNoChange) ? "[0] [" : "[1] [") + OpNick.GetNick() + "] voiced [" + Nick.GetNick() + "] on [" + Channel.GetName() + "]");
}
示例2: OnPart
virtual void OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage) {
if (Nick.GetNick() == m_pNetwork->GetIRCNick().GetNick()) {
Channel.SetInConfig(false);
CZNC::Get().WriteConfig();
}
}
示例3: OnChanPermission
virtual void OnChanPermission(const CNick& OpNick, const CNick& Nick, CChan& Channel, unsigned char uMode, bool bAdded, bool bNoChange) {
PutModule(((bNoChange) ? "[0] [" : "[1] [") + OpNick.GetNick() + "] set mode [" + Channel.GetName() + ((bAdded) ? "] +" : "] -") + CString(uMode) + " " + Nick.GetNick());
}
示例4: SetNick
void CIRCNetwork::Clone(const CIRCNetwork& Network, bool bCloneName) {
if (bCloneName) {
m_sName = Network.GetName();
}
m_fFloodRate = Network.GetFloodRate();
m_uFloodBurst = Network.GetFloodBurst();
SetNick(Network.GetNick());
SetAltNick(Network.GetAltNick());
SetIdent(Network.GetIdent());
SetRealName(Network.GetRealName());
SetBindHost(Network.GetBindHost());
// Servers
const vector<CServer*>& vServers = Network.GetServers();
CString sServer;
CServer* pCurServ = GetCurrentServer();
if (pCurServ) {
sServer = pCurServ->GetName();
}
DelServers();
size_t 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());
}
}
//.........这里部分代码省略.........
示例5: OnJoin
virtual void OnJoin(const CNick& Nick, CChan& Channel) {
if (Nick.GetNick() == m_pNetwork->GetIRCNick().GetNick()) {
Channel.SetInConfig(true);
CZNC::Get().WriteConfig();
}
}
示例6: OnRawMode
virtual void OnRawMode(const CNick& OpNick, CChan& Channel, const CString& sModes, const CString& sArgs) {
PutModule("* " + OpNick.GetNick() + " sets mode: " + sModes + " " + sArgs + " (" + Channel.GetName() + ")");
}
示例7: sizeof
//.........这里部分代码省略.........
for (size_t i = 0; i < numStringOptions; i++) {
CString sValue;
if (pConfig->FindStringEntry(StringOptions[i].name, sValue))
(this->*StringOptions[i].pSetter)(sValue);
}
for (size_t i = 0; i < numBoolOptions; i++) {
CString sValue;
if (pConfig->FindStringEntry(BoolOptions[i].name, sValue))
(this->*BoolOptions[i].pSetter)(sValue.ToBool());
}
for (size_t i = 0; i < numDoubleOptions; ++i) {
double fValue;
if (pConfig->FindDoubleEntry(DoubleOptions[i].name, fValue))
(this->*DoubleOptions[i].pSetter)(fValue);
}
for (size_t i = 0; i < numSUIntOptions; ++i) {
unsigned short value;
if (pConfig->FindUShortEntry(SUIntOptions[i].name, value))
(this->*SUIntOptions[i].pSetter)(value);
}
pConfig->FindStringVector("loadmodule", vsList);
for (vit = vsList.begin(); vit != vsList.end(); ++vit) {
CString sValue = *vit;
CString sModName = sValue.Token(0);
// XXX Legacy crap, added in ZNC 0.203, modified in 0.207
// Note that 0.203 == 0.207
if (sModName == "away") {
CUtils::PrintMessage("NOTICE: [away] was renamed, "
"loading [awaystore] instead");
sModName = "awaystore";
}
// XXX Legacy crap, added in ZNC 0.207
if (sModName == "autoaway") {
CUtils::PrintMessage("NOTICE: [autoaway] was renamed, "
"loading [awaystore] instead");
sModName = "awaystore";
}
CUtils::PrintAction("Loading network module [" + sModName + "]");
CString sModRet;
CString sArgs = sValue.Token(1, true);
bool bModRet = GetModules().LoadModule(sModName, sArgs, CModInfo::NetworkModule, GetUser(), this, sModRet);
CUtils::PrintStatus(bModRet, sModRet);
if (!bModRet) {
sError = sModRet;
return false;
}
}
}
pConfig->FindStringVector("server", vsList);
for (vit = vsList.begin(); vit != vsList.end(); ++vit) {
CUtils::PrintAction("Adding server [" + *vit + "]");
CUtils::PrintStatus(AddServer(*vit));
}
pConfig->FindStringVector("chan", vsList);
for (vit = vsList.begin(); vit != vsList.end(); ++vit) {
AddChan(*vit, true);
}
CConfig::SubConfig subConf;
CConfig::SubConfig::const_iterator subIt;
pConfig->FindSubConfig("chan", subConf);
for (subIt = subConf.begin(); subIt != subConf.end(); ++subIt) {
const CString& sChanName = subIt->first;
CConfig* pSubConf = subIt->second.m_pSubConfig;
CChan* pChan = new CChan(sChanName, this, true, pSubConf);
if (!pSubConf->empty()) {
sError = "Unhandled lines in config for User [" + m_pUser->GetUserName() + "], Network [" + GetName() + "], Channel [" + sChanName + "]!";
CUtils::PrintError(sError);
CZNC::DumpConfig(pSubConf);
return false;
}
// Save the channel name, because AddChan
// deletes the CChannel*, if adding fails
sError = pChan->GetName();
if (!AddChan(pChan)) {
sError = "Channel [" + sError + "] defined more than once";
CUtils::PrintError(sError);
return false;
}
sError.clear();
}
return true;
}
示例8: OnTopic
virtual EModRet OnTopic(CNick& Nick, CChan& Channel, CString& sTopic) {
PutModule("* " + Nick.GetNick() + " changes topic on " + Channel.GetName() + " to '" + sTopic + "'");
return CONTINUE;
}
示例9: OnChanNotice
virtual EModRet OnChanNotice(CNick& Nick, CChan& Channel, CString& sMessage) {
PutModule("[" + Nick.GetNick() + "] channotice [" + sMessage + "] to [" + Channel.GetName() + "]");
sMessage = "\00311,5 " + sMessage + " \003";
return CONTINUE;
}
示例10: OnTimerAutoJoin
virtual EModRet OnTimerAutoJoin(CChan& Channel) {
PutModule("Attempting to join " + Channel.GetName());
return CONTINUE;
}
示例11: OnKick
virtual void OnKick(const CNick& OpNick, const CString& sKickedNick, CChan& Channel, const CString& sMessage) {
PutModule("[" + OpNick.GetNick() + "] kicked [" + sKickedNick + "] from [" + Channel.GetName() + "] with the msg [" + sMessage + "]");
}
示例12: OnJoin
void OnJoin(const CNick& Nick, CChan& Channel) override {
if (!Channel.InConfig() &&
GetNetwork()->GetIRCNick().NickEquals(Nick.GetNick())) {
Channel.SetInConfig(true);
}
}