Example #1
0
void CComputerInfo::SetComputerStatus(ECOMPUTERSTATUS newVal)
{
	if (ECS_OFFLINE == newVal)
	{
		m_strClientVersion.Empty();
		m_strComputerName.Empty();

		//如果当前是解屏状态,则不更新为离线
		
		if (GetComputerStatus() == ECS_UNLOCK)
		{
			return;
		}
	}
	else if (ECS_UNLOCK == newVal)
	{
		m_nNetbarID = 0;
		m_bHasUserInfo = FALSE;
	}
	else if (ECS_THIEF == newVal)
	{
		m_Status = TERM_THIEF;

		if (HasClient())
		{
			return;
		}
	}
	
	m_ComputerStatus = newVal;
}
Example #2
0
void RoomMgr::ClientRemove(const std::string& roomName, int clientId) {
	 if (Exists(roomName) && HasClient(roomName, clientId)) {
		  try {
				auto room = rooms.at(roomName);
				if (room) {
					 room->clients.erase(clientId);

					 // If there are no users left in the room, delete it.
					 if (room->clients.size() == 0) {
						  rooms.erase(room->name);

					 }
				}
		  }
		  catch (std::exception& e) {
				std::cerr << "Problem while getting room during leave: "
					 << e.what() << std::endl;

		  }
	 }
	 else
	 {
		  std::cerr << "Client " << clientId << " no longer in room " << roomName
				<< " during ClientRemove." << std::endl;

	 }
}
Example #3
0
bool cSocketThreads::cSocketThread::NotifyWrite(const cCallback * a_Client)
{
	ASSERT(m_Parent->m_CS.IsLockedByCurrentThread());

	if (HasClient(a_Client))
	{
		// Notify the thread that there's another packet in the queue:
		ASSERT(m_ControlSocket2.IsValid());
		m_ControlSocket2.Send("q", 1);
		return true;
	}
	return false;
}
Example #4
0
bool RoomMgr::ClientAdd(const std::string& roomName, std::shared_ptr<IClient> client) {
	 if (Exists(roomName) && !HasClient(roomName, client->clientId)) {
		  auto room = rooms.at(roomName);
		  if (room) {
				room->clients.insert({ client->clientId, client });
				client->currRoomName = roomName;
				return true;
		  }
	 }

	 // All other cases result in failure to join room and return false.
	 return false;

}
Example #5
0
	void AddClient(CClient& client) {
		if (HasClient(client) == false) {
			m_vClients.push_back(&client);
		}
	}