mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 12:44:42 +00:00
Preset labels
This commit is contained in:
parent
f8aee7593d
commit
d328051250
2 changed files with 19 additions and 2 deletions
|
@ -708,8 +708,13 @@ class Core {
|
|||
}
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
List<EntityMessage> messages = db.message().getMessagesByMsgId(message.account, message.msgid);
|
||||
if (messages != null)
|
||||
try {
|
||||
db.beginTransaction();
|
||||
|
||||
List<EntityMessage> messages = db.message().getMessagesByMsgId(message.account, message.msgid);
|
||||
if (messages == null)
|
||||
return;
|
||||
|
||||
for (EntityMessage m : messages) {
|
||||
EntityFolder f = db.folder().getFolder(m.folder);
|
||||
if (!label.equals(f.name) && m.setLabel(label, set)) {
|
||||
|
@ -717,6 +722,11 @@ class Core {
|
|||
db.message().setMessageLabels(m.id, DB.Converters.fromStringArray(m.labels));
|
||||
}
|
||||
}
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
private static void onAdd(Context context, JSONArray jargs, EntityFolder folder, EntityMessage message, IMAPStore istore, IMAPFolder ifolder, State state) throws MessagingException, IOException {
|
||||
|
|
|
@ -154,6 +154,13 @@ public class EntityOperation {
|
|||
|
||||
db.message().setMessageKeywords(message.id, DB.Converters.fromStringArray(keywords.toArray(new String[0])));
|
||||
|
||||
} else if (LABEL.equals(name)) {
|
||||
String label = jargs.getString(0);
|
||||
boolean set = jargs.getBoolean(1);
|
||||
|
||||
if (message.setLabel(label, set))
|
||||
db.message().setMessageLabels(message.id, DB.Converters.fromStringArray(message.labels));
|
||||
|
||||
} else if (MOVE.equals(name)) {
|
||||
// Parameters:
|
||||
// 0: target folder
|
||||
|
|
Loading…
Reference in a new issue