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


C++ MojRefCountedPtr::IsActive方法代码示例

本文整理汇总了C++中MojRefCountedPtr::IsActive方法的典型用法代码示例。如果您正苦于以下问题:C++ MojRefCountedPtr::IsActive方法的具体用法?C++ MojRefCountedPtr::IsActive怎么用?C++ MojRefCountedPtr::IsActive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MojRefCountedPtr的用法示例。


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

示例1: SyncFolder

void ImapSession::SyncFolder(const MojObject& folderId, SyncParams syncParams)
{
	// TODO: make sure this is the right folder, or switch folders if necessary

	MojObject status;
	syncParams.Status(status);
	MojLogInfo(m_log, "ImapSession::SyncFolder called on %s with sync params %s", AsJsonString(folderId).c_str(), AsJsonString(status).c_str());

	// Set bind address for interface to connect to next time we connect.
	// This won't apply if we're already connected.
	if(!IsConnected() && !syncParams.GetBindAddress().empty()) {
		m_connectBindAddress = syncParams.GetBindAddress();
	}

	if(syncParams.GetForceReconnect()) {
		m_reconnectRequested = true;
	}

	// Manual sync of the inbox should resync the folder list
	if(syncParams.GetForce() && m_account->GetInboxFolderId() == folderId) {
		syncParams.SetSyncFolderList(true);
	}

	// Check if we should re-sync the folder list
	if(syncParams.GetSyncFolderList() && IsConnected()) {
		MojRefCountedPtr<SyncFolderListCommand> command(new SyncFolderListCommand(*this));
		m_commandManager->QueueCommand(command, false);
	}

	MojRefCountedPtr<ImapSyncSessionCommand> syncCommand;
	syncCommand.reset(new SyncEmailsCommand(*this, folderId, syncParams));

	// Check if a similar request has already been queued
	MojRefCountedPtr<ImapCommand> pendingCommand = FindPendingCommand(syncCommand);

	if (pendingCommand.get()) {
		MojLogInfo(m_log, "debouncing sync request; a similar request is already queued");
		CheckQueue();
		return;
	}

	// If we're just syncing local changes, and there's already a sync session, debounce it.
	if (syncParams.GetSyncChanges() && !syncParams.GetSyncEmails()) {
		MojRefCountedPtr<SyncSession> syncSession = m_client->GetSyncSession(folderId);

		if (syncSession.get() && syncSession->IsActive()) {
			MojLogInfo(m_log, "debouncing sync local changes; a sync session is active");
			return;
		}
	}

	if(syncParams.GetSyncChanges() && !syncParams.GetSyncEmails()) {
		// Just upload changes
		syncCommand.reset(new SyncLocalChangesCommand(*this, folderId));
		m_commandManager->QueueCommand(syncCommand, false);

		m_recentUserInteraction = true;
	} else if(syncParams.GetSyncEmails()) {
		// Sync emails
		m_commandManager->QueueCommand(syncCommand, false);
	} else {
		// just check the queue
		syncCommand.reset();
	}

	if(syncCommand.get()) {
		// Start sync session
		m_client->AddToSyncSession(m_folderId, syncCommand.get());
		m_client->StartSyncSession(m_folderId, syncParams.GetSyncActivities());
	}

	CheckQueue();
}
开发者ID:Garfonso,项目名称:app-services,代码行数:73,代码来源:ImapSession.cpp


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