本文整理汇总了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();
}