diff --git a/libloki/libloki-protocol.js b/libloki/libloki-protocol.js index 3ae45e1ed..204a36c9c 100644 --- a/libloki/libloki-protocol.js +++ b/libloki/libloki-protocol.js @@ -143,7 +143,7 @@ await Promise.all([signedKeyPromise, preKeyPromise]); } - async function sendEmptyMessageWithPreKeys(pubKey) { + async function sendFriendRequestAccepted(pubKey) { // empty content message const content = new textsecure.protobuf.Content(); @@ -155,6 +155,9 @@ log.info('empty message sent successfully'); } }; + const options = { + preKeyBundleType: textsecure.protobuf.PreKeyBundleMessage.Type.FRIEND_REQUEST_ACCEPT, + }; // send an empty message. The logic in ougoing_message will attach the prekeys. const outgoingMessage = new textsecure.OutgoingMessage( null, // server @@ -162,7 +165,8 @@ [pubKey], // numbers content, // message true, // silent - callback // callback + callback, // callback + options ); await outgoingMessage.sendToNumber(pubKey); } @@ -171,5 +175,5 @@ window.libloki.getPreKeyBundleForNumber = getPreKeyBundleForNumber; window.libloki.FallBackDecryptionError = FallBackDecryptionError; window.libloki.savePreKeyBundleForNumber = savePreKeyBundleForNumber; - window.libloki.sendEmptyMessageWithPreKeys = sendEmptyMessageWithPreKeys; + window.libloki.sendFriendRequestAccepted = sendFriendRequestAccepted; })(); diff --git a/libtextsecure/message_receiver.js b/libtextsecure/message_receiver.js index cb305fbda..dab71c94d 100644 --- a/libtextsecure/message_receiver.js +++ b/libtextsecure/message_receiver.js @@ -1026,7 +1026,7 @@ MessageReceiver.prototype.extend({ } // Send a reply back - libloki.sendEmptyMessageWithPreKeys(pubKey); + libloki.sendFriendRequestAccepted(pubKey); } window.log.info(`Friend request for ${pubKey} was ${message.friendStatus}`, message); },