本文整理了Java中com.fsck.k9.mail.Message.getUid()
方法的一些代码示例,展示了Message.getUid()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.getUid()
方法的具体详情如下:
包路径:com.fsck.k9.mail.Message
类名称:Message
方法名:getUid
暂无
代码示例来源:origin: k9mail/k-9
private Long getUidForMessage(Message message) {
try {
return Long.parseLong(message.getUid());
} catch (NullPointerException | NumberFormatException e) {
return null;
}
}
}
代码示例来源:origin: k9mail/k-9
private Long getUidForMessage(Message message) {
try {
return Long.parseLong(message.getUid());
} catch (NullPointerException | NumberFormatException e) {
return null;
}
}
}
代码示例来源:origin: k9mail/k-9
private static List<String> getUidsFromMessages(List<? extends Message> messages) {
List<String> uids = new ArrayList<>(messages.size());
for (int i = 0; i < messages.size(); i++) {
uids.add(messages.get(i).getUid());
}
return uids;
}
代码示例来源:origin: k9mail/k-9
@Override
public void messageRemoved(Message message) {
listener.syncRemovedMessage(folder, message.getUid());
}
代码示例来源:origin: k9mail/k-9
@Override
public void messageRemoved(Message message) {
listener.syncRemovedMessage(folder, message.getUid());
}
代码示例来源:origin: k9mail/k-9
@Override
public void messageRemoved(Message message) {
listener.syncRemovedMessage(folder, message.getUid());
}
代码示例来源:origin: k9mail/k-9
@Override
public boolean equals(Object o) {
if (o == null || !(o instanceof Message)) {
return false;
}
Message other = (Message)o;
return (getUid().equals(other.getUid())
&& getFolder().getServerId().equals(other.getFolder().getServerId()));
}
代码示例来源:origin: k9mail/k-9
@Override
public void setFlags(List<? extends Message> messages, final Set<Flag> flags, boolean value)
throws MessagingException {
String[] uids = new String[messages.size()];
for (int i = 0, count = messages.size(); i < count; i++) {
uids[i] = messages.get(i).getUid();
}
for (Flag flag : flags) {
if (flag == Flag.SEEN) {
markServerMessagesRead(uids, value);
} else if (flag == Flag.DELETED) {
deleteServerMessages(uids);
}
}
}
代码示例来源:origin: k9mail/k-9
private Set<String> extractMessageUids(List<ImapMessage> messages) {
Set<String> result = new HashSet<>();
for (Message message : messages) {
result.add(message.getUid());
}
return result;
}
代码示例来源: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
public void delete(List<? extends Message> msgs, String trashFolder) throws MessagingException {
for (Message message : msgs) {
Message myMessage = getMessage(message.getUid());
myMessage.delete(trashFolder);
}
}
代码示例来源:origin: k9mail/k-9
private Message createMessageWithUidString(String uid) {
Message message = mock(Message.class);
when(message.getUid()).thenReturn(uid);
return message;
}
}
代码示例来源:origin: k9mail/k-9
@Override
public LocalMessage doDbWork(final SQLiteDatabase db) throws WrappedException, UnavailableStorageException {
try {
appendMessages(Collections.singletonList(message));
final String uid = message.getUid();
final LocalMessage result = getMessage(uid);
runnable.run();
// Set a flag indicating this message has now be fully downloaded
result.setFlag(Flag.X_DOWNLOADED_FULL, true);
return result;
} catch (MessagingException e) {
throw new WrappedException(e);
}
}
});
代码示例来源:origin: k9mail/k-9
@Override
public void setFlags(List<? extends Message> messages, final Set<Flag> flags, boolean value)
throws MessagingException {
open(OPEN_MODE_RW);
checkOpen();
Set<Long> uids = new HashSet<>(messages.size());
for (Message message : messages) {
uids.add(Long.parseLong(message.getUid()));
}
boolean canCreateForwardedFlag = canCreateKeywords ||
store.getPermanentFlagsIndex().contains(Flag.FORWARDED);
String combinedFlags = ImapUtility.combineFlags(flags, canCreateForwardedFlag);
String commandSuffix = String.format("%sFLAGS.SILENT (%s)", value ? "+" : "-", combinedFlags);
try {
connection.executeCommandWithIdSet(Commands.UID_STORE, commandSuffix, uids);
} catch (IOException ioe) {
throw ioExceptionHandler(connection, ioe);
}
}
代码示例来源:origin: k9mail/k-9
private Message messageOnServer() throws MessagingException {
String messageUid = "UID";
Message remoteMessage = mock(Message.class);
when(remoteMessage.getUid()).thenReturn(messageUid);
when(remoteFolder.getMessages(anyInt(), anyInt(), nullable(Date.class),
nullable(MessageRetrievalListener.class))).thenReturn(Collections.singletonList(remoteMessage));
return remoteMessage;
}
代码示例来源:origin: k9mail/k-9
private void hasUnsyncedRemoteMessage() throws MessagingException {
String messageUid = "UID";
Message remoteMessage = mock(Message.class);
when(remoteMessage.getUid()).thenReturn(messageUid);
when(remoteFolder.getMessages(anyInt(), anyInt(), nullable(Date.class),
nullable(MessageRetrievalListener.class))).thenReturn(Collections.singletonList(remoteMessage));
}
代码示例来源:origin: k9mail/k-9
@Test
public void appendWebDavMessages_replaces_messages_with_WebDAV_versions() throws MessagingException, IOException {
List<Message> existingMessages = new ArrayList<>();
Message existingMessage = mock(Message.class);
existingMessages.add(existingMessage);
String messageUid = "testMessageUid";
when(existingMessage.getUid()).thenReturn(messageUid);
List<? extends Message> response = folder.appendWebDavMessages(existingMessages);
assertEquals(1, response.size(), 1);
assertEquals(WebDavMessage.class, response.get(0).getClass());
assertEquals(messageUid, response.get(0).getUid());
}
代码示例来源: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
@Test
public void appendWebDavMessages_sendsRequestUsingStore() throws MessagingException, IOException {
List<Message> existingMessages = new ArrayList<>();
Message existingMessage = mock(Message.class);
existingMessages.add(existingMessage);
String messageUid = "testMessageUid";
when(existingMessage.getUid()).thenReturn(messageUid);
folder.appendWebDavMessages(existingMessages);
verify(mockStore).sendRequest(urlCaptor.capture(), eq("PUT"), entityCaptor.capture(),
Matchers.<Map<String, String>>eq(null), eq(true));
assertTrue(urlCaptor.getValue().startsWith(storeUrl + "/" + folderName + "/" + messageUid));
assertTrue(urlCaptor.getValue().endsWith(".eml"));
}
}
代码示例来源:origin: k9mail/k-9
@Override
public String getNewPushState(String oldSerializedPushState, Message message) {
try {
String uid = message.getUid();
long messageUid = Long.parseLong(uid);
ImapPushState oldPushState = ImapPushState.parse(oldSerializedPushState);
if (messageUid >= oldPushState.uidNext) {
long uidNext = messageUid + 1;
ImapPushState newPushState = new ImapPushState(uidNext);
return newPushState.toString();
} else {
return null;
}
} catch (Exception e) {
Timber.e(e, "Exception while updated push state for %s", getLogId());
return null;
}
}
内容来源于网络,如有侵权,请联系作者删除!