use of com.fsck.k9.mail.Flag in project k-9 by k9mail.
the class MessagingController method removeFlagFromCache.
private void removeFlagFromCache(final Account account, final List<Long> messageIds, final Flag flag) {
EmailProviderCache cache = EmailProviderCache.getCache(account.getUuid(), context);
String columnName = LocalStore.getColumnNameForFlag(flag);
cache.removeValueForMessages(messageIds, columnName);
}
use of com.fsck.k9.mail.Flag in project k-9 by k9mail.
the class MessagingController method downloadPartial.
private void downloadPartial(Folder remoteFolder, LocalFolder localFolder, Message message) throws MessagingException {
/*
* We have a structure to deal with, from which
* we can pull down the parts we want to actually store.
* Build a list of parts we are interested in. Text parts will be downloaded
* right now, attachments will be left for later.
*/
Set<Part> viewables = MessageExtractor.collectTextParts(message);
/*
* Now download the parts we're interested in storing.
*/
for (Part part : viewables) {
remoteFolder.fetchPart(message, part, null);
}
// Store the updated message locally
localFolder.appendMessages(Collections.singletonList(message));
Message localMessage = localFolder.getMessage(message.getUid());
// Set a flag indicating this message has been fully downloaded and can be
// viewed.
localMessage.setFlag(Flag.X_DOWNLOADED_PARTIAL, true);
}
use of com.fsck.k9.mail.Flag in project k-9 by k9mail.
the class MigrationTo60Test method queueSetFlagBulk.
OldPendingCommand queueSetFlagBulk(String folderName, boolean newState, Flag flag, String[] uids) {
OldPendingCommand command = new OldPendingCommand();
command.command = PENDING_COMMAND_SET_FLAG_BULK;
int length = 3 + uids.length;
command.arguments = new String[length];
command.arguments[0] = folderName;
command.arguments[1] = Boolean.toString(newState);
command.arguments[2] = flag.toString();
System.arraycopy(uids, 0, command.arguments, 3, uids.length);
return command;
}
use of com.fsck.k9.mail.Flag in project k-9 by k9mail.
the class MigrationTo60Test method migrateSetFlag_oldFormat.
@Test
public void migrateSetFlag_oldFormat() {
OldPendingCommand command = queueSetFlagOld(SOURCE_FOLDER, FLAG_STATE, FLAG, UID);
PendingSetFlag pendingCommand = (PendingSetFlag) MigrationTo60.migratePendingCommand(command);
assertEquals(SOURCE_FOLDER, pendingCommand.folder);
assertEquals(FLAG_STATE, pendingCommand.newState);
assertEquals(FLAG, pendingCommand.flag);
assertEquals(Collections.singletonList(UID), pendingCommand.uids);
}
use of com.fsck.k9.mail.Flag in project k-9 by k9mail.
the class MessageReference method parse.
@Nullable
public static MessageReference parse(String identity) {
if (identity == null || identity.length() < 1 || identity.charAt(0) != IDENTITY_VERSION_1) {
return null;
}
StringTokenizer tokens = new StringTokenizer(identity.substring(2), IDENTITY_SEPARATOR, false);
if (tokens.countTokens() < 3) {
return null;
}
String accountUuid = Base64.decode(tokens.nextToken());
String folderName = Base64.decode(tokens.nextToken());
String uid = Base64.decode(tokens.nextToken());
if (!tokens.hasMoreTokens()) {
return new MessageReference(accountUuid, folderName, uid, null);
}
Flag flag;
try {
flag = Flag.valueOf(tokens.nextToken());
} catch (IllegalArgumentException e) {
return null;
}
return new MessageReference(accountUuid, folderName, uid, flag);
}
Aggregations