com.fsck.k9.mail.Message.olderThan()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(232)

本文整理了Java中com.fsck.k9.mail.Message.olderThan()方法的一些代码示例,展示了Message.olderThan()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.olderThan()方法的具体详情如下:
包路径:com.fsck.k9.mail.Message
类名称:Message
方法名:olderThan

Message.olderThan介绍

暂无

代码示例

代码示例来源:origin: k9mail/k-9

private boolean isOldMessage(BackendFolder backendFolder, Message message) {
  return message.olderThan(backendFolder.getLatestOldMessageSeenTime());
}

代码示例来源:origin: k9mail/k-9

private boolean shouldImportMessage(Message message, Date earliestDate) {
  if (message.olderThan(earliestDate)) {
    Timber.d("Message %s is older than %s, hence not saving", message.getUid(), earliestDate);
    return false;
  }
  return true;
}

代码示例来源:origin: k9mail/k-9

private Message buildLargeNewMessage() {
  Message message = mock(Message.class);
  when(message.olderThan(nullable(Date.class))).thenReturn(false);
  when(message.getSize()).thenReturn((long) (MAXIMUM_SMALL_MESSAGE_SIZE + 1));
  return message;
}

代码示例来源:origin: k9mail/k-9

private Message buildSmallNewMessage() {
  Message message = mock(Message.class);
  when(message.olderThan(nullable(Date.class))).thenReturn(false);
  when(message.getSize()).thenReturn((long) MAXIMUM_SMALL_MESSAGE_SIZE);
  return message;
}

代码示例来源:origin: k9mail/k-9

@Test
public void sync_withAccountSetToSyncRemoteDeletions_shouldNotDeleteLocalCopiesOfExistingMessagesAfterEarliestPollDate()
    throws Exception {
  messageCountInRemoteFolder(1);
  Date dateOfEarliestPoll = new Date();
  Message remoteMessage = messageOnServer();
  configureSyncConfigWithSyncRemoteDeletionsAndEarliestPollDate(dateOfEarliestPoll);
  when(remoteMessage.olderThan(dateOfEarliestPoll)).thenReturn(false);
  imapSync.sync(FOLDER_NAME, syncConfig, listener, remoteFolder);
  verify(backendFolder, never()).destroyMessages(messageListCaptor.capture());
}

代码示例来源:origin: k9mail/k-9

@Test
public void sync_withAccountSetToSyncRemoteDeletions_shouldDeleteLocalCopiesOfExistingMessagesBeforeEarliestPollDate()
    throws Exception {
  messageCountInRemoteFolder(1);
  Message remoteMessage = messageOnServer();
  Date dateOfEarliestPoll = new Date();
  configureSyncConfigWithSyncRemoteDeletionsAndEarliestPollDate(dateOfEarliestPoll);
  when(remoteMessage.olderThan(dateOfEarliestPoll)).thenReturn(true);
  when(backendFolder.getAllMessagesAndEffectiveDates()).thenReturn(Collections.singletonMap(MESSAGE_UID1, 0L));
  imapSync.sync(FOLDER_NAME, syncConfig, listener, remoteFolder);
  verify(backendFolder).destroyMessages(messageListCaptor.capture());
  assertEquals(MESSAGE_UID1, messageListCaptor.getValue().get(0));
}

代码示例来源:origin: k9mail/k-9

@Override
public void messageFinished(T message, int number, int ofTotal) {
  try {
    if (message.isSet(Flag.DELETED) || message.olderThan(earliestDate)) {
      if (message.isSet(Flag.DELETED)) {
        Timber.v("Newly downloaded message %s:%s:%s was marked deleted on server, " +
            "skipping", accountName, folder, message.getUid());
      } else {
        Timber.d("Newly downloaded message %s is older than %s, skipping",
            message.getUid(), earliestDate);
      }
      progress.incrementAndGet();
      //TODO: This might be the source of poll count errors in the UI. Is todo always the same as ofTotal
      listener.syncProgress(folder, progress.get(), todo);
      return;
    }
    if (syncConfig.getMaximumAutoDownloadMessageSize() > 0 &&
        message.getSize() > syncConfig.getMaximumAutoDownloadMessageSize()) {
      largeMessages.add(message);
    } else {
      smallMessages.add(message);
    }
  } catch (Exception e) {
    Timber.e(e, "Error while storing downloaded message.");
  }
}

代码示例来源:origin: k9mail/k-9

@Override
public void messageFinished(T message, int number, int ofTotal) {
  try {
    if (message.isSet(Flag.DELETED) || message.olderThan(earliestDate)) {
      if (message.isSet(Flag.DELETED)) {
        Timber.v("Newly downloaded message %s:%s:%s was marked deleted on server, " +
            "skipping", accountName, folder, message.getUid());
      } else {
        Timber.d("Newly downloaded message %s is older than %s, skipping",
            message.getUid(), earliestDate);
      }
      progress.incrementAndGet();
      //TODO: This might be the source of poll count errors in the UI. Is todo always the same as ofTotal
      listener.syncProgress(folder, progress.get(), todo);
      return;
    }
    if (syncConfig.getMaximumAutoDownloadMessageSize() > 0 &&
        message.getSize() > syncConfig.getMaximumAutoDownloadMessageSize()) {
      largeMessages.add(message);
    } else {
      smallMessages.add(message);
    }
  } catch (Exception e) {
    Timber.e(e, "Error while storing downloaded message.");
  }
}

代码示例来源:origin: k9mail/k-9

@Override
public void messageFinished(T message, int number, int ofTotal) {
  try {
    if (message.isSet(Flag.DELETED) || message.olderThan(earliestDate)) {
      if (message.isSet(Flag.DELETED)) {
        Timber.v("Newly downloaded message %s:%s:%s was marked deleted on server, " +
            "skipping", accountName, folder, message.getUid());
      } else {
        Timber.d("Newly downloaded message %s is older than %s, skipping",
            message.getUid(), earliestDate);
      }
      progress.incrementAndGet();
      //TODO: This might be the source of poll count errors in the UI. Is todo always the same as ofTotal
      listener.syncProgress(folder, progress.get(), todo);
      return;
    }
    if (syncConfig.getMaximumAutoDownloadMessageSize() > 0 &&
        message.getSize() > syncConfig.getMaximumAutoDownloadMessageSize()) {
      largeMessages.add(message);
    } else {
      smallMessages.add(message);
    }
  } catch (Exception e) {
    Timber.e(e, "Error while storing downloaded message.");
  }
}

相关文章