本文整理汇总了C++中CChan::IsDisabled方法的典型用法代码示例。如果您正苦于以下问题:C++ CChan::IsDisabled方法的具体用法?C++ CChan::IsDisabled怎么用?C++ CChan::IsDisabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CChan
的用法示例。
在下文中一共展示了CChan::IsDisabled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: JoinChans
void CIRCNetwork::JoinChans() {
// Avoid divsion by zero, it's bad!
if (m_vChans.empty())
return;
// We start at a random offset into the channel list so that if your
// first 3 channels are invite-only and you got MaxJoins == 3, ZNC will
// still be able to join the rest of your channels.
unsigned int start = rand() % m_vChans.size();
unsigned int uJoins = m_pUser->MaxJoins();
set<CChan*> sChans;
for (unsigned int a = 0; a < m_vChans.size(); a++) {
unsigned int idx = (start + a) % m_vChans.size();
CChan* pChan = m_vChans[idx];
if (!pChan->IsOn() && !pChan->IsDisabled()) {
if (!JoinChan(pChan))
continue;
sChans.insert(pChan);
// Limit the number of joins
if (uJoins != 0 && --uJoins == 0) {
// Reset the timer.
m_pJoinTimer->Reset();
break;
}
}
}
while (!sChans.empty())
JoinChans(sChans);
}
示例2: JoinChans
void CIRCNetwork::JoinChans() {
bool bHaveKey = false;
size_t joinLength = 4; // join
CString sChannels, sKeys;
for (vector<CChan*>::iterator it = m_vChans.begin(); it != m_vChans.end(); ++it) {
CChan *pChan = *it;
if (pChan->IsOn() || pChan->IsDisabled() || !JoinChan(pChan)) {
continue;
}
size_t length = pChan->GetName().length() + pChan->GetKey().length() + 2; // +2 for either space or commas
if ((joinLength + length) >= 510) {
// Sent what we got, and cleanup
PutIRC("JOIN " + sChannels + (bHaveKey ? (" " + sKeys) : ""));
sChannels = "";
sKeys = "";
joinLength = 4; // join
bHaveKey = false;
}
if (!sChannels.empty()) {
sChannels += ",";
sKeys += ",";
}
if (!pChan->GetKey().empty()) {
bHaveKey = true;
sKeys += pChan->GetKey();
}
sChannels += pChan->GetName();
joinLength += length;
}
if (!sChannels.empty()) {
PutIRC("JOIN " + sChannels + (bHaveKey ? (" " + sKeys) : ""));
}
}