|
|
@ -123,22 +123,34 @@ public class EntityOperation {
|
|
|
|
if (SEEN.equals(name)) {
|
|
|
|
if (SEEN.equals(name)) {
|
|
|
|
boolean seen = jargs.getBoolean(0);
|
|
|
|
boolean seen = jargs.getBoolean(0);
|
|
|
|
boolean ignore = jargs.optBoolean(1, true);
|
|
|
|
boolean ignore = jargs.optBoolean(1, true);
|
|
|
|
for (EntityMessage similar : db.message().getMessagesBySimilarity(message.account, message.id, message.msgid, message.hash))
|
|
|
|
EntityAccount account = db.account().getAccount(message.id);
|
|
|
|
|
|
|
|
for (EntityMessage similar : db.message().getMessagesBySimilarity(message.account, message.id, message.msgid, message.hash)) {
|
|
|
|
|
|
|
|
if ((account != null && !account.isGmail()) &&
|
|
|
|
|
|
|
|
!Objects.equals(message.id, similar.id) &&
|
|
|
|
|
|
|
|
Objects.equals(message.msgid, similar.msgid))
|
|
|
|
|
|
|
|
continue;
|
|
|
|
if (similar.ui_seen != seen || similar.ui_ignored != ignore) {
|
|
|
|
if (similar.ui_seen != seen || similar.ui_ignored != ignore) {
|
|
|
|
db.message().setMessageUiSeen(similar.id, seen);
|
|
|
|
db.message().setMessageUiSeen(similar.id, seen);
|
|
|
|
db.message().setMessageUiIgnored(similar.id, ignore);
|
|
|
|
db.message().setMessageUiIgnored(similar.id, ignore);
|
|
|
|
queue(context, similar.account, similar.folder, similar.id, name, jargs);
|
|
|
|
queue(context, similar.account, similar.folder, similar.id, name, jargs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
} else if (FLAG.equals(name)) {
|
|
|
|
} else if (FLAG.equals(name)) {
|
|
|
|
boolean flagged = jargs.getBoolean(0);
|
|
|
|
boolean flagged = jargs.getBoolean(0);
|
|
|
|
Integer color = (jargs.length() > 1 && !jargs.isNull(1) ? jargs.getInt(1) : null);
|
|
|
|
Integer color = (jargs.length() > 1 && !jargs.isNull(1) ? jargs.getInt(1) : null);
|
|
|
|
for (EntityMessage similar : db.message().getMessagesBySimilarity(message.account, message.id, message.msgid, message.hash))
|
|
|
|
EntityAccount account = db.account().getAccount(message.id);
|
|
|
|
|
|
|
|
for (EntityMessage similar : db.message().getMessagesBySimilarity(message.account, message.id, message.msgid, message.hash)) {
|
|
|
|
|
|
|
|
if ((account != null && !account.isGmail()) &&
|
|
|
|
|
|
|
|
!Objects.equals(message.id, similar.id) &&
|
|
|
|
|
|
|
|
Objects.equals(message.msgid, similar.msgid))
|
|
|
|
|
|
|
|
continue;
|
|
|
|
if (similar.ui_flagged != flagged || !Objects.equals(similar.color, color)) {
|
|
|
|
if (similar.ui_flagged != flagged || !Objects.equals(similar.color, color)) {
|
|
|
|
db.message().setMessageUiFlagged(similar.id, flagged, flagged ? color : null);
|
|
|
|
db.message().setMessageUiFlagged(similar.id, flagged, flagged ? color : null);
|
|
|
|
queue(context, similar.account, similar.folder, similar.id, name, jargs);
|
|
|
|
queue(context, similar.account, similar.folder, similar.id, name, jargs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|
boolean auto_important = prefs.getBoolean("auto_important", false);
|
|
|
|
boolean auto_important = prefs.getBoolean("auto_important", false);
|
|
|
@ -151,7 +163,12 @@ public class EntityOperation {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
} else if (ANSWERED.equals(name)) {
|
|
|
|
} else if (ANSWERED.equals(name)) {
|
|
|
|
|
|
|
|
EntityAccount account = db.account().getAccount(message.id);
|
|
|
|
for (EntityMessage similar : db.message().getMessagesBySimilarity(message.account, message.id, message.msgid, message.hash)) {
|
|
|
|
for (EntityMessage similar : db.message().getMessagesBySimilarity(message.account, message.id, message.msgid, message.hash)) {
|
|
|
|
|
|
|
|
if ((account != null && !account.isGmail()) &&
|
|
|
|
|
|
|
|
!Objects.equals(message.id, similar.id) &&
|
|
|
|
|
|
|
|
Objects.equals(message.msgid, similar.msgid))
|
|
|
|
|
|
|
|
continue;
|
|
|
|
db.message().setMessageUiAnswered(similar.id, jargs.getBoolean(0));
|
|
|
|
db.message().setMessageUiAnswered(similar.id, jargs.getBoolean(0));
|
|
|
|
queue(context, similar.account, similar.folder, similar.id, name, jargs);
|
|
|
|
queue(context, similar.account, similar.folder, similar.id, name, jargs);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -280,8 +297,13 @@ public class EntityOperation {
|
|
|
|
" target=" + target.id + ":" + target.type + ":" + target.name +
|
|
|
|
" target=" + target.id + ":" + target.type + ":" + target.name +
|
|
|
|
" auto read=" + autoread + " flag=" + autounflag + " importance=" + reset_importance);
|
|
|
|
" auto read=" + autoread + " flag=" + autounflag + " importance=" + reset_importance);
|
|
|
|
|
|
|
|
|
|
|
|
if (autoread || autounflag || reset_importance)
|
|
|
|
if (autoread || autounflag || reset_importance) {
|
|
|
|
|
|
|
|
EntityAccount account = db.account().getAccount(message.account);
|
|
|
|
for (EntityMessage similar : db.message().getMessagesBySimilarity(message.account, message.id, message.msgid, message.hash)) {
|
|
|
|
for (EntityMessage similar : db.message().getMessagesBySimilarity(message.account, message.id, message.msgid, message.hash)) {
|
|
|
|
|
|
|
|
if ((account != null && !account.isGmail()) &&
|
|
|
|
|
|
|
|
!Objects.equals(message.id, similar.id) &&
|
|
|
|
|
|
|
|
Objects.equals(message.msgid, similar.msgid))
|
|
|
|
|
|
|
|
continue;
|
|
|
|
if (autoread)
|
|
|
|
if (autoread)
|
|
|
|
queue(context, similar, SEEN, true);
|
|
|
|
queue(context, similar, SEEN, true);
|
|
|
|
if (autounflag)
|
|
|
|
if (autounflag)
|
|
|
@ -292,6 +314,7 @@ public class EntityOperation {
|
|
|
|
queue(context, similar, KEYWORD, MessageHelper.FLAG_HIGH_IMPORTANCE, false);
|
|
|
|
queue(context, similar, KEYWORD, MessageHelper.FLAG_HIGH_IMPORTANCE, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (message.ui_found)
|
|
|
|
if (message.ui_found)
|
|
|
|
db.message().setMessageFound(message.id, false);
|
|
|
|
db.message().setMessageFound(message.id, false);
|
|
|
|