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

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

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

Message.isSet介绍

暂无

代码示例

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

private void initPgpInlineFromDraftMessage(Message message) {
  cryptoEnablePgpInline = message.isSet(Flag.X_DRAFT_OPENPGP_INLINE);
}

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

private MessageViewInfo extractSimpleMessageForView(Message message, Part contentPart) throws MessagingException {
  List<AttachmentViewInfo> attachmentInfos = new ArrayList<>();
  ViewableExtractedText viewable = extractViewableAndAttachments(
      Collections.singletonList(contentPart), attachmentInfos);
  AttachmentResolver attachmentResolver = AttachmentResolver.createFromPart(contentPart);
  boolean isMessageIncomplete =
      !message.isSet(Flag.X_DOWNLOADED_FULL) || MessageExtractor.hasMissingParts(message);
  return MessageViewInfo.createWithExtractedContent(
      message, contentPart, isMessageIncomplete, viewable.html, attachmentInfos, attachmentResolver);
}

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

private boolean syncFlags(SyncConfig syncConfig, BackendFolder backendFolder, Message remoteMessage) {
    String messageServerId = remoteMessage.getUid();

    if (!backendFolder.isMessagePresent(messageServerId)) {
      return false;
    }

    Set<Flag> localMessageFlags = backendFolder.getMessageFlags(messageServerId);
    if (localMessageFlags.contains(Flag.DELETED)) {
      return false;
    }

    boolean messageChanged = false;
    if (remoteMessage.isSet(Flag.DELETED)) {
      if (syncConfig.getSyncRemoteDeletions()) {
        backendFolder.setMessageFlag(messageServerId, Flag.DELETED, true);
        messageChanged = true;
      }
    } else {
      for (Flag flag : syncConfig.getSyncFlags()) {
        if (remoteMessage.isSet(flag) != localMessageFlags.contains(flag)) {
          backendFolder.setMessageFlag(messageServerId, flag, remoteMessage.isSet(flag));
          messageChanged = true;
        }
      }
    }
    return messageChanged;
  }
}

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

private boolean syncFlags(SyncConfig syncConfig, BackendFolder backendFolder, Message remoteMessage) {
    String messageServerId = remoteMessage.getUid();

    if (!backendFolder.isMessagePresent(messageServerId)) {
      return false;
    }

    Set<Flag> localMessageFlags = backendFolder.getMessageFlags(messageServerId);
    if (localMessageFlags.contains(Flag.DELETED)) {
      return false;
    }

    boolean messageChanged = false;
    if (remoteMessage.isSet(Flag.DELETED)) {
      if (syncConfig.getSyncRemoteDeletions()) {
        backendFolder.setMessageFlag(messageServerId, Flag.DELETED, true);
        messageChanged = true;
      }
    } else {
      for (Flag flag : syncConfig.getSyncFlags()) {
        if (remoteMessage.isSet(flag) != localMessageFlags.contains(flag)) {
          backendFolder.setMessageFlag(messageServerId, flag, remoteMessage.isSet(flag));
          messageChanged = true;
        }
      }
    }
    return messageChanged;
  }
}

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

private boolean syncFlags(SyncConfig syncConfig, BackendFolder backendFolder, Message remoteMessage) {
  String messageServerId = remoteMessage.getUid();
  if (!backendFolder.isMessagePresent(messageServerId)) {
    return false;
  }
  Set<Flag> localMessageFlags = backendFolder.getMessageFlags(messageServerId);
  if (localMessageFlags.contains(Flag.DELETED)) {
    return false;
  }
  boolean messageChanged = false;
  if (remoteMessage.isSet(Flag.DELETED)) {
    if (syncConfig.getSyncRemoteDeletions()) {
      backendFolder.setMessageFlag(messageServerId, Flag.DELETED, true);
      messageChanged = true;
    }
  } else {
    for (Flag flag : syncConfig.getSyncFlags()) {
      if (remoteMessage.isSet(flag) != localMessageFlags.contains(flag)) {
        backendFolder.setMessageFlag(messageServerId, flag, remoteMessage.isSet(flag));
        messageChanged = true;
      }
    }
  }
  return messageChanged;
}

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

@Override
public void messageFinished(final T message, int number, int ofTotal) {
  try {
    if (!shouldImportMessage(message, earliestDate)) {
      progress.incrementAndGet();
      return;
    }
    // Store the updated message locally
    backendFolder.saveCompleteMessage(message);
    progress.incrementAndGet();
    // Increment the number of "new messages" if the newly downloaded message is
    // not marked as read.
    if (!message.isSet(Flag.SEEN)) {
      newMessages.incrementAndGet();
    }
    String messageServerId = message.getUid();
    Timber.v("About to notify listeners that we got a new small message %s:%s:%s",
        accountName, folder, messageServerId);
    // Update the listener with what we've found
    listener.syncProgress(folder, progress.get(), todo);
    boolean isOldMessage = isOldMessage(messageServerId, lastUid);
    listener.syncNewMessage(folder, messageServerId, isOldMessage);
  } catch (Exception e) {
    Timber.e(e, "SYNC: fetch small messages");
  }
}

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

@Override
public void messageFinished(final T message, int number, int ofTotal) {
  try {
    // Store the updated message locally
    backendFolder.saveCompleteMessage(message);
    progress.incrementAndGet();
    // Increment the number of "new messages" if the newly downloaded message is
    // not marked as read.
    if (!message.isSet(Flag.SEEN)) {
      newMessages.incrementAndGet();
    }
    String messageServerId = message.getUid();
    Timber.v("About to notify listeners that we got a new small message %s:%s:%s",
        accountName, folder, messageServerId);
    // Update the listener with what we've found
    listener.syncProgress(folder, progress.get(), todo);
    listener.syncNewMessage(folder, messageServerId, false);
  } catch (Exception e) {
    Timber.e(e, "SYNC: fetch small messages");
  }
}

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

@Override
public void messageFinished(final T message, int number, int ofTotal) {
  try {
    // Store the updated message locally
    backendFolder.saveCompleteMessage(message);
    progress.incrementAndGet();
    // Increment the number of "new messages" if the newly downloaded message is
    // not marked as read.
    if (!message.isSet(Flag.SEEN)) {
      newMessages.incrementAndGet();
    }
    String messageServerId = message.getUid();
    Timber.v("About to notify listeners that we got a new small message %s:%s:%s",
        accountName, folder, messageServerId);
    // Update the listener with what we've found
    listener.syncProgress(folder, progress.get(), todo);
    boolean isOldMessage = isOldMessage(backendFolder, message);
    listener.syncNewMessage(folder, messageServerId, isOldMessage);
  } catch (Exception e) {
    Timber.e(e, "SYNC: fetch small messages");
  }
}

代码示例来源: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.");
  }
}

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

if (message.isSet(Flag.DELETED)) {
  Timber.v("Message with uid %s is marked as deleted", messageServerId);
    if (!message.isSet(Flag.X_DOWNLOADED_FULL) && !message.isSet(Flag.X_DOWNLOADED_PARTIAL)) {
      Timber.v("Message with uid %s has not yet been downloaded", messageServerId);
      boolean completeMessage = message.isSet(Flag.X_DOWNLOADED_FULL);
      if (completeMessage) {
        backendFolder.saveCompleteMessage(message);

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

private void refreshLocalMessageFlags(
    SyncConfig syncConfig,
    final Folder remoteFolder,
    final BackendFolder backendFolder,
    List<Message> syncFlagMessages,
    final AtomicInteger progress,
    final int todo,
    SyncListener listener
) throws MessagingException {
  final String folder = remoteFolder.getServerId();
  Timber.d("SYNC: About to sync flags for %d remote messages for folder %s", syncFlagMessages.size(), folder);
  FetchProfile fp = new FetchProfile();
  fp.add(FetchProfile.Item.FLAGS);
  List<Message> undeletedMessages = new LinkedList<>();
  for (Message message : syncFlagMessages) {
    if (!message.isSet(Flag.DELETED)) {
      undeletedMessages.add(message);
    }
  }
  remoteFolder.fetch(undeletedMessages, fp, null);
  for (Message remoteMessage : syncFlagMessages) {
    boolean messageChanged = syncFlags(syncConfig, backendFolder, remoteMessage);
    if (messageChanged) {
      listener.syncFlagChanged(folder, remoteMessage.getUid());
    }
    progress.incrementAndGet();
    listener.syncProgress(folder, progress.get(), todo);
  }
}

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

if (message.isSet(Flag.DELETED)) {
  Timber.v("Message with uid %s is marked as deleted", messageServerId);

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

if (message.isSet(Flag.DELETED)) {
  Timber.v("Message with uid %s is marked as deleted", messageServerId);
    if (!message.isSet(Flag.X_DOWNLOADED_FULL) && !message.isSet(Flag.X_DOWNLOADED_PARTIAL)) {
      Timber.v("Message with uid %s has not yet been downloaded", messageServerId);
      boolean completeMessage = message.isSet(Flag.X_DOWNLOADED_FULL);
      if (completeMessage) {
        backendFolder.saveCompleteMessage(message);

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

if (!message.isSet(Flag.DELETED)) {
  undeletedMessages.add(message);

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

if (!message.isSet(Flag.DELETED)) {
  undeletedMessages.add(message);

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

if (!message.isSet(Flag.X_DOWNLOADED_FULL)) {

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

if (!message.isSet(Flag.X_DOWNLOADED_FULL)) {

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

void processPendingMarkAllAsRead(PendingMarkAllAsRead command, Account account) throws MessagingException {
  String folder = command.folder;
  LocalFolder localFolder = null;
  try {
    LocalStore localStore = localStoreProvider.getInstance(account);
    localFolder = localStore.getFolder(folder);
    localFolder.open(Folder.OPEN_MODE_RW);
    List<? extends Message> messages = localFolder.getMessages(null, false);
    for (Message message : messages) {
      if (!message.isSet(Flag.SEEN)) {
        message.setFlag(Flag.SEEN, true);
      }
    }
    for (MessagingListener l : getListeners()) {
      l.folderStatusChanged(account, folder, 0);
    }
  } finally {
    closeFolder(localFolder);
  }
  Backend backend = getBackend(account);
  if (backend.getSupportsSeenFlag()) {
    backend.markAllAsRead(folder);
  }
}

相关文章