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

Method call

app/src/main/java/eu/faircode/email/CloudSync.java:591–615  ·  view source on GitHub ↗
(Context context, String user, String password, String command, JSONObject jrequest)

Source from the content-addressed store, hash-verified

589 // Lower level
590
591 public static JSONObject call(Context context, String user, String password, String command, JSONObject jrequest)
592 throws GeneralSecurityException, JSONException, IOException, InvalidCipherTextException {
593 EntityLog.log(context, EntityLog.Type.Cloud, "Cloud command=" + command);
594
595 jrequest.put("command", command);
596 List<JSONObject> responses = new ArrayList<>();
597 for (JSONArray batch : partition(jrequest.getJSONArray("items"))) {
598 jrequest.put("items", batch);
599 responses.add(_call(context, user, password, jrequest));
600 }
601 if (responses.size() == 1)
602 return responses.get(0);
603 else {
604 JSONArray jall = new JSONArray();
605 for (JSONObject response : responses)
606 if (response.has("items")) {
607 JSONArray jitems = response.getJSONArray("items");
608 for (int i = 0; i < jitems.length(); i++)
609 jall.put(jitems.getJSONObject(i));
610 }
611 JSONObject jresponse = responses.get(0);
612 jresponse.put("items", jall);
613 return jresponse;
614 }
615 }
616
617 private static byte[] getSalt(String user) throws NoSuchAlgorithmException {
618 return MessageDigest.getInstance("SHA256").digest(user.getBytes());

Callers 9

executeMethod · 0.95
sendLocalDataMethod · 0.95
receiveRemoteDataMethod · 0.95
prism.jsFile · 0.45
uFunction · 0.45
onLongClickMethod · 0.45
runInTransactionMethod · 0.45
runMethod · 0.45
copyDatabaseFileMethod · 0.45

Calls 8

logMethod · 0.95
partitionMethod · 0.95
_callMethod · 0.95
sizeMethod · 0.65
putMethod · 0.45
addMethod · 0.45
getMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected