MCPcopy Create free account
hub / github.com/M66B/FairEmail / onKeyword

Method onKeyword

app/src/main/java/eu/faircode/email/Core.java:1069–1092  ·  view source on GitHub ↗
(Context context, JSONArray jargs, EntityFolder folder, EntityMessage message, IMAPFolder ifolder)

Source from the content-addressed store, hash-verified

1067 }
1068
1069 private static void onKeyword(Context context, JSONArray jargs, EntityFolder folder, EntityMessage message, IMAPFolder ifolder) throws MessagingException, JSONException {
1070 // Set/reset user flag
1071 // https://tools.ietf.org/html/rfc3501#section-2.3.2
1072
1073 String keyword = jargs.getString(0);
1074 boolean set = jargs.getBoolean(1);
1075
1076 if (TextUtils.isEmpty(keyword))
1077 throw new IllegalArgumentException("keyword/empty");
1078
1079 if (message.uid == null)
1080 throw new IllegalArgumentException("keyword/uid");
1081
1082 if (folder.read_only ||
1083 !ifolder.getPermanentFlags().contains(Flags.Flag.USER))
1084 return;
1085
1086 Message imessage = ifolder.getMessageByUID(message.uid);
1087 if (imessage == null)
1088 throw new MessageRemovedException();
1089
1090 Flags flags = new Flags(keyword);
1091 imessage.setFlags(flags, set);
1092 }
1093
1094 private static void onLabel(Context context, JSONArray jargs, EntityFolder folder, EntityMessage message, IMAPStore istore, IMAPFolder ifolder, State state) throws JSONException, MessagingException, IOException {
1095 // Set/clear Gmail label

Callers 1

processOperationsMethod · 0.95

Calls 7

setFlagsMethod · 0.95
getBooleanMethod · 0.80
getMessageByUIDMethod · 0.65
getStringMethod · 0.45
isEmptyMethod · 0.45
containsMethod · 0.45
getPermanentFlagsMethod · 0.45

Tested by

no test coverage detected