Add libtextsecure support for syncing read messages
Plumbing for sending and receiving a new sync protobuf for marking messages read on/from my other devices. // FREEBIE
This commit is contained in:
parent
ecf2885a6c
commit
781ada64ca
5 changed files with 84 additions and 2 deletions
|
@ -198,7 +198,11 @@ MessageReceiver.prototype.extend({
|
|||
}
|
||||
if (syncMessage.sent) {
|
||||
var sentMessage = syncMessage.sent;
|
||||
console.log('sent message to', sentMessage.destination, sentMessage.timestamp.toNumber(), 'from', envelope.source + '.' + envelope.sourceDevice);
|
||||
console.log('sent message to',
|
||||
sentMessage.destination,
|
||||
sentMessage.timestamp.toNumber(),
|
||||
'from', envelope.source + '.' + envelope.sourceDevice
|
||||
);
|
||||
return this.handleSentMessage(
|
||||
sentMessage.destination,
|
||||
sentMessage.timestamp,
|
||||
|
@ -210,10 +214,22 @@ MessageReceiver.prototype.extend({
|
|||
this.handleGroups(syncMessage.groups);
|
||||
} else if (syncMessage.request) {
|
||||
console.log('Got SyncMessage Request');
|
||||
} else if (syncMessage.read) {
|
||||
console.log('read messages',
|
||||
'from', envelope.source + '.' + envelope.sourceDevice);
|
||||
this.handleRead(syncMessage.read);
|
||||
} else {
|
||||
throw new Error('Got empty SyncMessage');
|
||||
}
|
||||
},
|
||||
handleRead: function(read) {
|
||||
for (var i = 0; i < read.length; ++i) {
|
||||
var ev = new Event('read');
|
||||
ev.timestamp = read[i].timestamp;
|
||||
ev.sender = read[i].sender;
|
||||
this.dispatchEvent(ev);
|
||||
}
|
||||
},
|
||||
handleContacts: function(contacts) {
|
||||
console.log('contact sync');
|
||||
var eventTarget = this;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue