|
|
@ -212,7 +212,8 @@ class Core {
|
|
|
|
case EntityOperation.MOVE:
|
|
|
|
case EntityOperation.MOVE:
|
|
|
|
if (group &&
|
|
|
|
if (group &&
|
|
|
|
message.uid != null &&
|
|
|
|
message.uid != null &&
|
|
|
|
EntityOperation.MOVE.equals(next.name)) {
|
|
|
|
EntityOperation.MOVE.equals(next.name) &&
|
|
|
|
|
|
|
|
account.protocol == EntityAccount.TYPE_IMAP) {
|
|
|
|
JSONArray jnext = new JSONArray(next.args);
|
|
|
|
JSONArray jnext = new JSONArray(next.args);
|
|
|
|
// Same target
|
|
|
|
// Same target
|
|
|
|
if (jargs.getLong(0) == jnext.getLong(0)) {
|
|
|
|
if (jargs.getLong(0) == jnext.getLong(0)) {
|
|
|
@ -287,6 +288,10 @@ class Core {
|
|
|
|
// Do nothing
|
|
|
|
// Do nothing
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case EntityOperation.MOVE:
|
|
|
|
|
|
|
|
onMove(context, jargs, folder, message);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case EntityOperation.DELETE:
|
|
|
|
case EntityOperation.DELETE:
|
|
|
|
onDelete(context, jargs, account, folder, message, (POP3Folder) ifolder, (POP3Store) istore, state);
|
|
|
|
onDelete(context, jargs, account, folder, message, (POP3Folder) ifolder, (POP3Store) istore, state);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -871,7 +876,6 @@ class Core {
|
|
|
|
ifolder.expunge();
|
|
|
|
ifolder.expunge();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Fetch appended/copied when needed
|
|
|
|
// Fetch appended/copied when needed
|
|
|
|
boolean fetch = !"connected".equals(target.state);
|
|
|
|
boolean fetch = !"connected".equals(target.state);
|
|
|
|
if (draft || fetch)
|
|
|
|
if (draft || fetch)
|
|
|
@ -929,6 +933,34 @@ class Core {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void onMove(Context context, JSONArray jargs, EntityFolder folder, EntityMessage message) throws JSONException, FolderNotFoundException {
|
|
|
|
|
|
|
|
// Move message
|
|
|
|
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get arguments
|
|
|
|
|
|
|
|
long id = jargs.getLong(0);
|
|
|
|
|
|
|
|
boolean seen = jargs.optBoolean(1);
|
|
|
|
|
|
|
|
boolean unflag = jargs.optBoolean(3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Move from trash only
|
|
|
|
|
|
|
|
if (!EntityFolder.TRASH.equals(folder.type))
|
|
|
|
|
|
|
|
throw new IllegalArgumentException("Invalid POP3 folder type=" + folder.type);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get target folder
|
|
|
|
|
|
|
|
EntityFolder target = db.folder().getFolder(id);
|
|
|
|
|
|
|
|
if (target == null)
|
|
|
|
|
|
|
|
throw new FolderNotFoundException();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
message.folder = target.id;
|
|
|
|
|
|
|
|
if (seen)
|
|
|
|
|
|
|
|
message.ui_seen = seen;
|
|
|
|
|
|
|
|
if (unflag)
|
|
|
|
|
|
|
|
message.ui_flagged = false;
|
|
|
|
|
|
|
|
message.ui_hide = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
db.message().updateMessage(message);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static void onFetch(Context context, JSONArray jargs, EntityFolder folder, IMAPStore istore, IMAPFolder ifolder, State state) throws JSONException, MessagingException, IOException {
|
|
|
|
private static void onFetch(Context context, JSONArray jargs, EntityFolder folder, IMAPStore istore, IMAPFolder ifolder, State state) throws JSONException, MessagingException, IOException {
|
|
|
|
long uid = jargs.getLong(0);
|
|
|
|
long uid = jargs.getLong(0);
|
|
|
|
|
|
|
|
|
|
|
@ -1082,7 +1114,7 @@ class Core {
|
|
|
|
|
|
|
|
|
|
|
|
message.id = null;
|
|
|
|
message.id = null;
|
|
|
|
message.folder = trash.id;
|
|
|
|
message.folder = trash.id;
|
|
|
|
message.msgid = null;
|
|
|
|
message.msgid = null; // virtual message
|
|
|
|
message.ui_hide = false;
|
|
|
|
message.ui_hide = false;
|
|
|
|
message.ui_seen = true;
|
|
|
|
message.ui_seen = true;
|
|
|
|
message.id = db.message().insertMessage(message);
|
|
|
|
message.id = db.message().insertMessage(message);
|
|
|
|