本文整理汇总了C++中CClient::SetAway方法的典型用法代码示例。如果您正苦于以下问题:C++ CClient::SetAway方法的具体用法?C++ CClient::SetAway怎么用?C++ CClient::SetAway使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CClient
的用法示例。
在下文中一共展示了CClient::SetAway方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}