本文整理汇总了C++中CClient::IsAway方法的典型用法代码示例。如果您正苦于以下问题:C++ CClient::IsAway方法的具体用法?C++ CClient::IsAway怎么用?C++ CClient::IsAway使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CClient
的用法示例。
在下文中一共展示了CClient::IsAway方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsUserOnline
bool CIRCNetwork::IsUserOnline() const {
vector<CClient*>::const_iterator it;
for (it = m_vClients.begin(); it != m_vClients.end(); ++it) {
CClient *pClient = *it;
if (!pClient->IsAway()) {
return true;
}
}
return false;
}
示例2: SetAwayCommand
void SetAwayCommand(const CString &sLine) {
const vector<CClient*> vClients = m_pUser->GetAllClients();
CString sHostname = sLine.Token(1);
// Valid value of true or false for setting away/unaway
bool sToggleFlag = true;
CString sToggleValue = "away";
VCString sReturn;
// If the hostname argument isn't passed and only arg is true/false, treat that as sToggleFlag
if (sHostname.AsLower() == "true" || sHostname.AsLower() == "false" ) {
sToggleFlag = sHostname.ToBool();
sHostname = "";
}
unsigned int count = 0;
for (vector<CClient*>::const_iterator it = vClients.begin(); it != vClients.end(); ++it) {
CClient *pClient = *it;
//Set all hosts to away if we encounter an empty hostname
//Otherwise, set the flag to the provided second argument value
if (pClient->GetRemoteIP().Equals(sHostname)) {
if (sLine.Token(2).empty()) {
sToggleFlag = !pClient->IsAway();
} else {
sToggleFlag = sLine.Token(2).ToBool();
}
}
if (sHostname.empty() || pClient->GetRemoteIP().Equals(sHostname)) {
pClient->SetAway(sToggleFlag);
++count;
}
}
if (!sToggleFlag) {
sToggleValue = "unaway";
}
if (count == 1) {
PutModule(CString(count) + " client has been set " + sToggleValue);
} else {
PutModule(CString(count) + " clients have been set " + sToggleValue);
}
}
示例3: DecideAwayness
void DecideAwayness() {
int notAways = 0;
int clients = 0;
vector<CClient*> vUserClients = m_pUser->GetAllClients();
for (size_t c = 0; c < vUserClients.size(); ++c) {
CClient* pUserClient = vUserClients[c];
if (!pUserClient->IsAway()) {
++notAways;
}
++clients;
}
char tmpchr[256];
tmpchr[255] = '\0';
snprintf(tmpchr, 255, "Clients NOT away: %d/%d", notAways, clients);
PutModule(tmpchr);
if (clients == 0) {
if (!m_isAway) {
m_isAway = true;
PutIRC("AWAY :Detached");
}
return;
} else if (notAways == 0) {
if (!m_isAway) {
m_isAway = true;
PutIRC("AWAY :Auto away");
}
return;
} else {
if (m_isAway) {
m_isAway = false;
PutIRC("AWAY");
}
}
if (GetClient()->IsAway()) {
GetClient()->PutClient(":irc.znc.in 306 + " + GetUser()->GetNick() + " :You are not visibly away yet. " + tmpchr);
}
}
示例4: ListCommand
void ListCommand(const CString &sLine) {
CTable Table;
Table.AddColumn("Host");
Table.AddColumn("Network");
Table.AddColumn("Away");
const vector<CClient*> vClients = m_pUser->GetAllClients();
for (vector<CClient*>::const_iterator it = vClients.begin(); it != vClients.end(); ++it) {
CClient *pClient = *it;
Table.AddRow();
Table.SetCell("Host", pClient->GetRemoteIP());
if (pClient->GetNetwork()) {
Table.SetCell("Network", pClient->GetNetwork()->GetName());
}
Table.SetCell("Away", CString(pClient->IsAway()));
}
PutModule(Table);
}