mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-04 06:20:26 +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);
|
DB db = DB.getInstance(context);
|
||||||
List<EntityMessage> messages = db.message().getMessagesByMsgId(message.account, message.msgid);
|
try {
|
||||||
if (messages != null)
|
db.beginTransaction();
|
||||||
|
|
||||||
|
List<EntityMessage> messages = db.message().getMessagesByMsgId(message.account, message.msgid);
|
||||||
|
if (messages == null)
|
||||||
|
return;
|
||||||
|
|
||||||
for (EntityMessage m : messages) {
|
for (EntityMessage m : messages) {
|
||||||
EntityFolder f = db.folder().getFolder(m.folder);
|
EntityFolder f = db.folder().getFolder(m.folder);
|
||||||
if (!label.equals(f.name) && m.setLabel(label, set)) {
|
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.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 {
|
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])));
|
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)) {
|
} else if (MOVE.equals(name)) {
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// 0: target folder
|
// 0: target folder
|
||||||
|
|
Loading…
Reference in a new issue