|
|
|
@ -146,17 +146,6 @@
|
|
|
|
|
return finalMessage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var decodeDeviceContents = function(res) {
|
|
|
|
|
var finalMessage = textsecure.protobuf.DeviceControl.decode(res[0]);
|
|
|
|
|
|
|
|
|
|
//TODO: Add END_SESSION flag for device control messages
|
|
|
|
|
/*if ((finalMessage.flags & textsecure.protobuf.PushMessageContent.Flags.END_SESSION)
|
|
|
|
|
== textsecure.protobuf.PushMessageContent.Flags.END_SESSION)
|
|
|
|
|
res[1]();*/
|
|
|
|
|
|
|
|
|
|
return finalMessage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
window.textsecure = window.textsecure || {};
|
|
|
|
|
window.textsecure.protocol_wrapper = {
|
|
|
|
|
handleIncomingPushMessageProto: function(proto) {
|
|
|
|
@ -173,14 +162,6 @@
|
|
|
|
|
return axolotl.protocol.handlePreKeyWhisperMessage(from, getString(proto.message)).then(decodeMessageContents);
|
|
|
|
|
case textsecure.protobuf.IncomingPushMessageSignal.Type.RECEIPT:
|
|
|
|
|
return Promise.resolve(null);
|
|
|
|
|
case textsecure.protobuf.IncomingPushMessageSignal.Type.PREKEY_BUNDLE_DEVICE_CONTROL:
|
|
|
|
|
if (proto.message.readUint8() != ((3 << 4) | 3))
|
|
|
|
|
throw new Error("Bad version byte");
|
|
|
|
|
var from = proto.source + "." + (proto.sourceDevice == null ? 0 : proto.sourceDevice);
|
|
|
|
|
return axolotl.protocol.handlePreKeyWhisperMessage(from, getString(proto.message)).then(decodeDeviceContents);
|
|
|
|
|
case textsecure.protobuf.IncomingPushMessageSignal.Type.DEVICE_CONTROL:
|
|
|
|
|
var from = proto.source + "." + (proto.sourceDevice == null ? 0 : proto.sourceDevice);
|
|
|
|
|
return axolotl.protocol.decryptWhisperMessage(from, getString(proto.message)).then(decodeDeviceContents);
|
|
|
|
|
default:
|
|
|
|
|
return new Promise(function(resolve, reject) { reject(new Error("Unknown message type")); });
|
|
|
|
|
}
|
|
|
|
|