当前位置: 首页>>代码示例>>C++>>正文


C++ CClient::IsAway方法代码示例

本文整理汇总了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;
}
开发者ID:stephank,项目名称:znc,代码行数:11,代码来源:IRCNetwork.cpp

示例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);
		}
	}
开发者ID:badloop,项目名称:znc-contrib,代码行数:45,代码来源:clientaway.cpp

示例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);
    }
  }
开发者ID:jamesandariese,项目名称:znc_multi_away,代码行数:42,代码来源:multi_away.cpp

示例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);
	}
开发者ID:badloop,项目名称:znc-contrib,代码行数:21,代码来源:clientaway.cpp


注:本文中的CClient::IsAway方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。