Browse Source

first draft of incomingMessageFromPGPText()

JNI-98
heck 5 years ago
parent
commit
4bc21c82b2
  1. 34
      src/foundation/pEp/jniadapter/AbstractEngine.java

34
src/foundation/pEp/jniadapter/AbstractEngine.java

@ -194,5 +194,39 @@ abstract class AbstractEngine extends UniquelyIdentifiable implements AutoClosea
}
return 0;
}
public static Message incomingMessageFromPGPText(String pgpText, Message.EncFormat encFormat) {
Message msg = new Message();
msg.setDir(Message.Direction.Incoming);
msg.setShortmsg("p≡p");
msg.setLongmsg("this message was encrypted with p≡p https://pEp-project.org");
msg.setEncFormat(encFormat);
// Attachments
Blob att0 = new Blob();
att0.mime_type = "application/pgp-encrypted";
att0.filename = null;
att0.data = "Version: 1".getBytes();
Blob att1 = new Blob();
att1.mime_type = "application/octet-stream";
att1.filename = "file://msg.asc";
att1.data = pgpText.getBytes();
Vector<Blob> attachments = new Vector<>();
attachments.add(att0);
attachments.add(att1);
msg.setAttachments(attachments);
// Opts
ArrayList<Pair<String, String>> opts = new ArrayList<>();
Pair<String, String> xpEp = new Pair<>();
xpEp.first = "X-pEp-Version";
xpEp.second = "2.1";
opts.add(xpEp);
msg.setOptFields(opts);
return msg;
}
}

Loading…
Cancel
Save