|
|
@ -736,15 +736,18 @@ public class FragmentMessages extends FragmentEx {
|
|
|
|
|
|
|
|
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
|
|
|
|
|
|
|
|
for (Long id : ids) {
|
|
|
|
long account = -1;
|
|
|
|
|
|
|
|
for (long id : ids) {
|
|
|
|
EntityMessage message = db.message().getMessage(id);
|
|
|
|
EntityMessage message = db.message().getMessage(id);
|
|
|
|
result[message.ui_seen ? 1 : 0] = true;
|
|
|
|
if (message != null) {
|
|
|
|
result[message.flagged ? 3 : 2] = true;
|
|
|
|
account = message.account;
|
|
|
|
|
|
|
|
result[message.ui_seen ? 1 : 0] = true;
|
|
|
|
|
|
|
|
result[message.flagged ? 3 : 2] = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EntityMessage m0 = db.message().getMessage(ids[0]);
|
|
|
|
EntityFolder archive = db.folder().getFolderByType(account, EntityFolder.ARCHIVE);
|
|
|
|
EntityFolder archive = db.folder().getFolderByType(m0.account, EntityFolder.ARCHIVE);
|
|
|
|
EntityFolder trash = db.folder().getFolderByType(account, EntityFolder.TRASH);
|
|
|
|
EntityFolder trash = db.folder().getFolderByType(m0.account, EntityFolder.TRASH);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result[4] = (archive != null);
|
|
|
|
result[4] = (archive != null);
|
|
|
|
result[5] = (trash != null);
|
|
|
|
result[5] = (trash != null);
|
|
|
@ -866,7 +869,7 @@ public class FragmentMessages extends FragmentEx {
|
|
|
|
|
|
|
|
|
|
|
|
for (long id : ids) {
|
|
|
|
for (long id : ids) {
|
|
|
|
EntityMessage message = db.message().getMessage(id);
|
|
|
|
EntityMessage message = db.message().getMessage(id);
|
|
|
|
if (message.ui_seen != seen) {
|
|
|
|
if (message != null && message.ui_seen != seen) {
|
|
|
|
List<EntityMessage> messages = db.message().getMessageByThread(
|
|
|
|
List<EntityMessage> messages = db.message().getMessageByThread(
|
|
|
|
message.account, message.thread, threading ? null : id, message.folder);
|
|
|
|
message.account, message.thread, threading ? null : id, message.folder);
|
|
|
|
for (EntityMessage threaded : messages)
|
|
|
|
for (EntityMessage threaded : messages)
|
|
|
@ -908,7 +911,7 @@ public class FragmentMessages extends FragmentEx {
|
|
|
|
|
|
|
|
|
|
|
|
for (long id : ids) {
|
|
|
|
for (long id : ids) {
|
|
|
|
EntityMessage message = db.message().getMessage(id);
|
|
|
|
EntityMessage message = db.message().getMessage(id);
|
|
|
|
if (message.ui_flagged != flagged) {
|
|
|
|
if (message != null && message.ui_flagged != flagged) {
|
|
|
|
List<EntityMessage> messages = db.message().getMessageByThread(
|
|
|
|
List<EntityMessage> messages = db.message().getMessageByThread(
|
|
|
|
message.account, message.thread, threading ? null : id, message.folder);
|
|
|
|
message.account, message.thread, threading ? null : id, message.folder);
|
|
|
|
for (EntityMessage threaded : messages)
|
|
|
|
for (EntityMessage threaded : messages)
|
|
|
@ -966,13 +969,14 @@ public class FragmentMessages extends FragmentEx {
|
|
|
|
|
|
|
|
|
|
|
|
for (long id : ids) {
|
|
|
|
for (long id : ids) {
|
|
|
|
EntityMessage message = db.message().getMessage(id);
|
|
|
|
EntityMessage message = db.message().getMessage(id);
|
|
|
|
List<EntityMessage> messages = db.message().getMessageByThread(
|
|
|
|
if (message != null) {
|
|
|
|
message.account, message.thread, threading ? null : id, message.folder);
|
|
|
|
List<EntityMessage> messages = db.message().getMessageByThread(
|
|
|
|
for (EntityMessage threaded : messages) {
|
|
|
|
message.account, message.thread, threading ? null : id, message.folder);
|
|
|
|
if (threaded.uid == null && !TextUtils.isEmpty(threaded.error)) // outbox
|
|
|
|
for (EntityMessage threaded : messages)
|
|
|
|
db.message().deleteMessage(threaded.id);
|
|
|
|
if (threaded.uid == null && !TextUtils.isEmpty(threaded.error)) // outbox
|
|
|
|
else
|
|
|
|
db.message().deleteMessage(threaded.id);
|
|
|
|
EntityOperation.queue(db, threaded, EntityOperation.DELETE);
|
|
|
|
else
|
|
|
|
|
|
|
|
EntityOperation.queue(db, threaded, EntityOperation.DELETE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1016,19 +1020,22 @@ public class FragmentMessages extends FragmentEx {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
db.beginTransaction();
|
|
|
|
db.beginTransaction();
|
|
|
|
|
|
|
|
|
|
|
|
EntityMessage m0 = db.message().getMessage(ids[0]);
|
|
|
|
long account = -1;
|
|
|
|
result.target = db.folder().getFolderByType(m0.account, type);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (long id : ids) {
|
|
|
|
for (long id : ids) {
|
|
|
|
EntityMessage message = db.message().getMessage(id);
|
|
|
|
EntityMessage message = db.message().getMessage(id);
|
|
|
|
List<EntityMessage> messages = db.message().getMessageByThread(
|
|
|
|
if (message != null) {
|
|
|
|
message.account, message.thread, threading ? null : id, message.folder);
|
|
|
|
account = message.account;
|
|
|
|
for (EntityMessage threaded : messages) {
|
|
|
|
List<EntityMessage> messages = db.message().getMessageByThread(
|
|
|
|
result.ids.add(threaded.id);
|
|
|
|
message.account, message.thread, threading ? null : id, message.folder);
|
|
|
|
db.message().setMessageUiHide(threaded.id, true);
|
|
|
|
for (EntityMessage threaded : messages) {
|
|
|
|
|
|
|
|
result.ids.add(threaded.id);
|
|
|
|
|
|
|
|
db.message().setMessageUiHide(threaded.id, true);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.target = db.folder().getFolderByType(account, type);
|
|
|
|
|
|
|
|
|
|
|
|
db.setTransactionSuccessful();
|
|
|
|
db.setTransactionSuccessful();
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
db.endTransaction();
|
|
|
|
db.endTransaction();
|
|
|
@ -1062,8 +1069,16 @@ public class FragmentMessages extends FragmentEx {
|
|
|
|
|
|
|
|
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
|
|
|
|
|
|
|
|
EntityMessage m0 = db.message().getMessage(ids[0]);
|
|
|
|
long account = -1;
|
|
|
|
List<EntityFolder> folders = db.folder().getFolders(m0.account);
|
|
|
|
for (long id : ids) {
|
|
|
|
|
|
|
|
EntityMessage message = db.message().getMessage(id);
|
|
|
|
|
|
|
|
if (message != null) {
|
|
|
|
|
|
|
|
account = message.account;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<EntityFolder> folders = db.folder().getFolders(account);
|
|
|
|
|
|
|
|
|
|
|
|
List<EntityFolder> targets = new ArrayList<>();
|
|
|
|
List<EntityFolder> targets = new ArrayList<>();
|
|
|
|
for (EntityFolder folder : folders)
|
|
|
|
for (EntityFolder folder : folders)
|
|
|
@ -1112,11 +1127,13 @@ public class FragmentMessages extends FragmentEx {
|
|
|
|
|
|
|
|
|
|
|
|
for (long id : ids) {
|
|
|
|
for (long id : ids) {
|
|
|
|
EntityMessage message = db.message().getMessage(id);
|
|
|
|
EntityMessage message = db.message().getMessage(id);
|
|
|
|
List<EntityMessage> messages = db.message().getMessageByThread(
|
|
|
|
if (message != null) {
|
|
|
|
message.account, message.thread, threading ? null : id, message.folder);
|
|
|
|
List<EntityMessage> messages = db.message().getMessageByThread(
|
|
|
|
for (EntityMessage threaded : messages) {
|
|
|
|
message.account, message.thread, threading ? null : id, message.folder);
|
|
|
|
result.ids.add(threaded.id);
|
|
|
|
for (EntityMessage threaded : messages) {
|
|
|
|
db.message().setMessageUiHide(threaded.id, true);
|
|
|
|
result.ids.add(threaded.id);
|
|
|
|
|
|
|
|
db.message().setMessageUiHide(threaded.id, true);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1847,14 +1864,15 @@ public class FragmentMessages extends FragmentEx {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
db.beginTransaction();
|
|
|
|
db.beginTransaction();
|
|
|
|
|
|
|
|
|
|
|
|
for (long id : result.ids) {
|
|
|
|
if (result.target != null)
|
|
|
|
EntityMessage message = db.message().getMessage(id);
|
|
|
|
for (long id : result.ids) {
|
|
|
|
if (message != null && message.ui_hide) {
|
|
|
|
EntityMessage message = db.message().getMessage(id);
|
|
|
|
Log.i(Helper.TAG, "Move id=" + id + " target=" + result.target.name);
|
|
|
|
if (message != null && message.ui_hide) {
|
|
|
|
EntityFolder folder = db.folder().getFolderByName(message.account, result.target.name);
|
|
|
|
Log.i(Helper.TAG, "Move id=" + id + " target=" + result.target.name);
|
|
|
|
EntityOperation.queue(db, message, EntityOperation.MOVE, folder.id);
|
|
|
|
EntityFolder folder = db.folder().getFolderByName(message.account, result.target.name);
|
|
|
|
|
|
|
|
EntityOperation.queue(db, message, EntityOperation.MOVE, folder.id);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
db.setTransactionSuccessful();
|
|
|
|
db.setTransactionSuccessful();
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|