Fix a missing function and dont blow up on delivery receipts
This commit is contained in:
parent
d9f53d4c01
commit
f6f35c5b61
4 changed files with 13 additions and 1 deletions
|
@ -350,6 +350,10 @@ window.textsecure.api = function() {
|
||||||
else
|
else
|
||||||
console.log("Got invalid message from server: " + message);
|
console.log("Got invalid message from server: " + message);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
socketWrapper.send = function(msg) {
|
||||||
|
socket.send(msg);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
connect();
|
connect();
|
||||||
|
|
||||||
|
|
|
@ -792,6 +792,8 @@ window.textsecure.crypto = function() {
|
||||||
throw new Error("Bad version byte");
|
throw new Error("Bad version byte");
|
||||||
var from = proto.source + "." + (proto.sourceDevice == null ? 0 : proto.sourceDevice);
|
var from = proto.source + "." + (proto.sourceDevice == null ? 0 : proto.sourceDevice);
|
||||||
return handlePreKeyWhisperMessage(from, getString(proto.message));
|
return handlePreKeyWhisperMessage(from, getString(proto.message));
|
||||||
|
case textsecure.protos.IncomingPushMessageProtobuf.Type.RECEIPT:
|
||||||
|
return Promise.resolve(null);
|
||||||
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")); });
|
||||||
}
|
}
|
||||||
|
|
|
@ -656,6 +656,11 @@ window.textsecure.subscribeToPush = function(message_callback) {
|
||||||
console.log("Successfully decoded message with id: " + message.id);
|
console.log("Successfully decoded message with id: " + message.id);
|
||||||
socket.send(JSON.stringify({type: 1, id: message.id}));
|
socket.send(JSON.stringify({type: 1, id: message.id}));
|
||||||
return textsecure.crypto.handleIncomingPushMessageProto(proto).then(function(decrypted) {
|
return textsecure.crypto.handleIncomingPushMessageProto(proto).then(function(decrypted) {
|
||||||
|
// Delivery receipt
|
||||||
|
if (decrypted === null)
|
||||||
|
//TODO: Pass to UI
|
||||||
|
return;
|
||||||
|
|
||||||
// Now that its decrypted, validate the message and clean it up for consumer processing
|
// Now that its decrypted, validate the message and clean it up for consumer processing
|
||||||
// Note that messages may (generally) only perform one action and we ignore remaining fields
|
// Note that messages may (generally) only perform one action and we ignore remaining fields
|
||||||
// after the first action.
|
// after the first action.
|
||||||
|
|
|
@ -10,6 +10,7 @@ message IncomingPushMessageSignal {
|
||||||
KEY_EXCHANGE = 2;
|
KEY_EXCHANGE = 2;
|
||||||
PREKEY_BUNDLE = 3;
|
PREKEY_BUNDLE = 3;
|
||||||
PLAINTEXT = 4;
|
PLAINTEXT = 4;
|
||||||
|
RECEIPT = 5;
|
||||||
}
|
}
|
||||||
optional Type type = 1;
|
optional Type type = 1;
|
||||||
optional string source = 2;
|
optional string source = 2;
|
||||||
|
@ -49,4 +50,4 @@ message PushMessageContent {
|
||||||
repeated AttachmentPointer attachments = 2;
|
repeated AttachmentPointer attachments = 2;
|
||||||
optional GroupContext group = 3;
|
optional GroupContext group = 3;
|
||||||
optional uint32 flags = 4;
|
optional uint32 flags = 4;
|
||||||
}
|
}
|
Loading…
Reference in a new issue