|
|
@ -1265,6 +1265,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|
|
|
boolean outbox = EntityFolder.OUTBOX.equals(dfolder.type);
|
|
|
|
boolean outbox = EntityFolder.OUTBOX.equals(dfolder.type);
|
|
|
|
Log.i(Helper.TAG, folder.name + " found as id=" + dup.id +
|
|
|
|
Log.i(Helper.TAG, folder.name + " found as id=" + dup.id +
|
|
|
|
" folder=" + dfolder.type + ":" + dup.folder + "/" + folder.type + ":" + folder.id);
|
|
|
|
" folder=" + dfolder.type + ":" + dup.folder + "/" + folder.type + ":" + folder.id);
|
|
|
|
|
|
|
|
|
|
|
|
if (dup.folder.equals(folder.id) || outbox) {
|
|
|
|
if (dup.folder.equals(folder.id) || outbox) {
|
|
|
|
Log.i(Helper.TAG, folder.name + " found as id=" + dup.id + " uid=" + dup.uid + " msgid=" + msgid);
|
|
|
|
Log.i(Helper.TAG, folder.name + " found as id=" + dup.id + " uid=" + dup.uid + " msgid=" + msgid);
|
|
|
|
dup.folder = folder.id;
|
|
|
|
dup.folder = folder.id;
|
|
|
@ -1285,19 +1286,11 @@ public class ServiceSynchronize extends LifecycleService {
|
|
|
|
db.message().updateMessage(message);
|
|
|
|
db.message().updateMessage(message);
|
|
|
|
Log.i(Helper.TAG, folder.name + " updated id=" + message.id + " uid=" + message.uid + " seen=" + seen);
|
|
|
|
Log.i(Helper.TAG, folder.name + " updated id=" + message.id + " uid=" + message.uid + " seen=" + seen);
|
|
|
|
result = -1;
|
|
|
|
result = -1;
|
|
|
|
} else
|
|
|
|
|
|
|
|
; //Log.v(Helper.TAG, folder.name + " unchanged id=" + message.id + " uid=" + message.uid);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
db.setTransactionSuccessful();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (message != null)
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
db.endTransaction();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (message == null) {
|
|
|
|
|
|
|
|
// Will fetch message within database transaction
|
|
|
|
FetchProfile fp1 = new FetchProfile();
|
|
|
|
FetchProfile fp1 = new FetchProfile();
|
|
|
|
fp1.add(FetchProfile.Item.ENVELOPE);
|
|
|
|
fp1.add(FetchProfile.Item.ENVELOPE);
|
|
|
|
fp1.add(FetchProfile.Item.CONTENT_INFO);
|
|
|
|
fp1.add(FetchProfile.Item.CONTENT_INFO);
|
|
|
@ -1305,10 +1298,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|
|
|
fp1.add(IMAPFolder.FetchProfileItem.MESSAGE);
|
|
|
|
fp1.add(IMAPFolder.FetchProfileItem.MESSAGE);
|
|
|
|
ifolder.fetch(new Message[]{imessage}, fp1);
|
|
|
|
ifolder.fetch(new Message[]{imessage}, fp1);
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
message = new EntityMessage();
|
|
|
|
db.beginTransaction();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EntityMessage message = new EntityMessage();
|
|
|
|
|
|
|
|
message.account = folder.account;
|
|
|
|
message.account = folder.account;
|
|
|
|
message.folder = folder.id;
|
|
|
|
message.folder = folder.id;
|
|
|
|
message.uid = uid;
|
|
|
|
message.uid = uid;
|
|
|
@ -1348,13 +1338,14 @@ public class ServiceSynchronize extends LifecycleService {
|
|
|
|
attachment.id = db.attachment().insertAttachment(attachment);
|
|
|
|
attachment.id = db.attachment().insertAttachment(attachment);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result = 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
db.setTransactionSuccessful();
|
|
|
|
db.setTransactionSuccessful();
|
|
|
|
|
|
|
|
return result;
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
db.endTransaction();
|
|
|
|
db.endTransaction();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
//Log.v(Helper.TAG, folder.name + " end sync uid=" + uid);
|
|
|
|
//Log.v(Helper.TAG, folder.name + " end sync uid=" + uid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|