mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 04:09:49 +00:00
Add support for syncing blocked numbers
// FREEBIE
This commit is contained in:
@@ -70,7 +70,10 @@ MessageReceiver.prototype.extend({
|
||||
// fault, and we should handle them gracefully and tell the
|
||||
// user they received an invalid message
|
||||
request.respond(200, 'OK');
|
||||
this.queueEnvelope(envelope);
|
||||
|
||||
if (!this.isBlocked(envelope.source)) {
|
||||
this.queueEnvelope(envelope);
|
||||
}
|
||||
|
||||
}.bind(this)).catch(function(e) {
|
||||
request.respond(500, 'Bad encrypted websocket message');
|
||||
@@ -242,6 +245,8 @@ MessageReceiver.prototype.extend({
|
||||
this.handleContacts(syncMessage.contacts);
|
||||
} else if (syncMessage.groups) {
|
||||
this.handleGroups(syncMessage.groups);
|
||||
} else if (syncMessage.blocked) {
|
||||
this.handleBlocked(syncMessage.blocked);
|
||||
} else if (syncMessage.request) {
|
||||
console.log('Got SyncMessage Request');
|
||||
} else if (syncMessage.read) {
|
||||
@@ -318,6 +323,12 @@ MessageReceiver.prototype.extend({
|
||||
});
|
||||
});
|
||||
},
|
||||
handleBlocked: function(blocked) {
|
||||
textsecure.storage.put('blocked', blocked.numbers);
|
||||
},
|
||||
isBlocked: function(number) {
|
||||
return textsecure.storage.get('blocked', []).indexOf(number) >= 0;
|
||||
},
|
||||
handleAttachment: function(attachment) {
|
||||
function decryptAttachment(encrypted) {
|
||||
return textsecure.crypto.decryptAttachment(
|
||||
|
||||
Reference in New Issue
Block a user