Remove non-existant device messages
This commit is contained in:
parent
5abf3073d5
commit
2277b41639
4 changed files with 6 additions and 62 deletions
|
@ -146,17 +146,6 @@
|
||||||
return finalMessage;
|
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 = window.textsecure || {};
|
||||||
window.textsecure.protocol_wrapper = {
|
window.textsecure.protocol_wrapper = {
|
||||||
handleIncomingPushMessageProto: function(proto) {
|
handleIncomingPushMessageProto: function(proto) {
|
||||||
|
@ -173,14 +162,6 @@
|
||||||
return axolotl.protocol.handlePreKeyWhisperMessage(from, getString(proto.message)).then(decodeMessageContents);
|
return axolotl.protocol.handlePreKeyWhisperMessage(from, getString(proto.message)).then(decodeMessageContents);
|
||||||
case textsecure.protobuf.IncomingPushMessageSignal.Type.RECEIPT:
|
case textsecure.protobuf.IncomingPushMessageSignal.Type.RECEIPT:
|
||||||
return Promise.resolve(null);
|
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:
|
default:
|
||||||
return new Promise(function(resolve, reject) { reject(new Error("Unknown message type")); });
|
return new Promise(function(resolve, reject) { reject(new Error("Unknown message type")); });
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,17 +69,6 @@
|
||||||
return finalMessage;
|
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 = window.textsecure || {};
|
||||||
window.textsecure.protocol_wrapper = {
|
window.textsecure.protocol_wrapper = {
|
||||||
handleIncomingPushMessageProto: function(proto) {
|
handleIncomingPushMessageProto: function(proto) {
|
||||||
|
@ -96,14 +85,6 @@
|
||||||
return axolotl.protocol.handlePreKeyWhisperMessage(from, getString(proto.message)).then(decodeMessageContents);
|
return axolotl.protocol.handlePreKeyWhisperMessage(from, getString(proto.message)).then(decodeMessageContents);
|
||||||
case textsecure.protobuf.IncomingPushMessageSignal.Type.RECEIPT:
|
case textsecure.protobuf.IncomingPushMessageSignal.Type.RECEIPT:
|
||||||
return Promise.resolve(null);
|
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:
|
default:
|
||||||
return new Promise(function(resolve, reject) { reject(new Error("Unknown message type")); });
|
return new Promise(function(resolve, reject) { reject(new Error("Unknown message type")); });
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,19 +15,3 @@ message ProvisionMessage {
|
||||||
optional string number = 3;
|
optional string number = 3;
|
||||||
optional string provisioningCode = 4;
|
optional string provisioningCode = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
message DeviceControl {
|
|
||||||
enum Type {
|
|
||||||
UNKNOWN = 0;
|
|
||||||
NEW_DEVICE_REGISTERED = 1; // Requries only newDeviceId
|
|
||||||
SENT_MESSAGE = 2; // Requires only message
|
|
||||||
}
|
|
||||||
message MessageSent {
|
|
||||||
required string otherNumber = 1; // The destination account (ie phone #), not device
|
|
||||||
required uint64 timestamp = 2;
|
|
||||||
required bytes message = 3; // PushMessageContent
|
|
||||||
}
|
|
||||||
required Type type = 1;
|
|
||||||
optional uint32 newDeviceId = 2;
|
|
||||||
optional MessageSent message = 3;
|
|
||||||
}
|
|
||||||
|
|
|
@ -5,14 +5,12 @@ option java_outer_classname = "PushMessageProtos";
|
||||||
|
|
||||||
message IncomingPushMessageSignal {
|
message IncomingPushMessageSignal {
|
||||||
enum Type {
|
enum Type {
|
||||||
UNKNOWN = 0;
|
UNKNOWN = 0;
|
||||||
CIPHERTEXT = 1;
|
CIPHERTEXT = 1;
|
||||||
KEY_EXCHANGE = 2;
|
KEY_EXCHANGE = 2;
|
||||||
PREKEY_BUNDLE = 3;
|
PREKEY_BUNDLE = 3;
|
||||||
PLAINTEXT = 4;
|
PLAINTEXT = 4;
|
||||||
RECEIPT = 5;
|
RECEIPT = 5;
|
||||||
PREKEY_BUNDLE_DEVICE_CONTROL = 6;
|
|
||||||
DEVICE_CONTROL = 7;
|
|
||||||
}
|
}
|
||||||
optional Type type = 1;
|
optional Type type = 1;
|
||||||
optional string source = 2;
|
optional string source = 2;
|
||||||
|
|
Loading…
Reference in a new issue