am 142f12ea: Merge "Fix IMAP attachment upsync for forwarded messages" into ub-mail-algol

* commit '142f12ea934444e8ecd0a06be4aeb56439546e13':
  Fix IMAP attachment upsync for forwarded messages
This commit is contained in:
Tony Mantler 2014-04-07 23:57:48 +00:00 committed by Android Git Automerger
commit fdc8a744b5
2 changed files with 20 additions and 5 deletions

View File

@ -440,14 +440,26 @@ public class LegacyConversions {
// generated by unit tests or calendar invites
content = new ByteArrayInputStream(att.mContentBytes);
} else {
final Uri contentUri = Uri.parse(att.getCachedFileUri());
content = context.getContentResolver().openInputStream(contentUri);
String contentUriString = att.getCachedFileUri();
if (TextUtils.isEmpty(contentUriString)) {
contentUriString = att.getContentUri();
}
if (TextUtils.isEmpty(contentUriString)) {
content = null;
} else {
final Uri contentUri = Uri.parse(contentUriString);
content = context.getContentResolver().openInputStream(contentUri);
}
}
final String mimeType = att.mMimeType;
final Long contentSize = att.mSize;
final String contentId = att.mContentId;
final String filename = att.mFileName;
addAttachmentPart(mp, mimeType, contentSize, filename, contentId, content);
if (content != null) {
addAttachmentPart(mp, mimeType, contentSize, filename, contentId, content);
} else {
LogUtils.e(LogUtils.TAG, "Could not open attachment file for upsync");
}
} catch (final FileNotFoundException e) {
LogUtils.e(LogUtils.TAG, "File Not Found error on %s while upsyncing message",
att.getCachedFileUri());

View File

@ -1406,8 +1406,11 @@ public class ImapService extends Service {
FetchProfile fp2 = new FetchProfile();
fp2.add(FetchProfile.Item.ENVELOPE);
remoteFolder.fetch(new Message[] { remoteMessage2 }, fp2, null);
message.mServerTimeStamp = remoteMessage2.getInternalDate().getTime();
updateMessage = true;
final Date remoteDate = remoteMessage2.getInternalDate();
if (remoteDate != null) {
message.mServerTimeStamp = remoteMessage2.getInternalDate().getTime();
updateMessage = true;
}
}
} catch (MessagingException me) {
// skip it - we can live without this