1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-22 14:22:05 +01:00

OX-IM: Remove redundant code to add self to recipients

This commit is contained in:
Paul Schaub 2020-07-12 15:47:06 +02:00
parent b7fe56fb9b
commit 9fd2c6f9ec
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -264,7 +264,7 @@ public final class OXInstantMessagingManager extends Manager {
* Add an OX-IM message element to a message. * Add an OX-IM message element to a message.
* *
* @param messageBuilder message * @param messageBuilder message
* @param contacts recipients of the message * @param recipients recipients of the message
* @param payload payload which will be encrypted and signed * @param payload payload which will be encrypted and signed
* *
* @return metadata about the messages encryption + signatures. * @return metadata about the messages encryption + signatures.
@ -273,13 +273,9 @@ public final class OXInstantMessagingManager extends Manager {
* @throws PGPException in case something goes wrong during encryption * @throws PGPException in case something goes wrong during encryption
* @throws IOException IO is dangerous (we need to read keys) * @throws IOException IO is dangerous (we need to read keys)
*/ */
public OpenPgpMetadata addOxMessage(MessageBuilder messageBuilder, Set<OpenPgpContact> contacts, List<ExtensionElement> payload) public OpenPgpMetadata addOxMessage(MessageBuilder messageBuilder, Set<OpenPgpContact> recipients, List<ExtensionElement> payload)
throws SmackException.NotLoggedInException, IOException, PGPException { throws SmackException.NotLoggedInException, IOException, PGPException {
HashSet<OpenPgpContact> recipients = new HashSet<>(contacts);
OpenPgpContact self = openPgpManager.getOpenPgpSelf();
recipients.add(self);
OpenPgpElementAndMetadata openPgpElementAndMetadata = signAndEncrypt(recipients, payload); OpenPgpElementAndMetadata openPgpElementAndMetadata = signAndEncrypt(recipients, payload);
messageBuilder.addExtension(openPgpElementAndMetadata.getElement()); messageBuilder.addExtension(openPgpElementAndMetadata.getElement());