Refactor MessageReceiver for storage/server independence

Let the libtextsecure consumer pass in their own server url, username,
password, and signaling key, as with libtextsecure-java.

Also brings reconnect logic up into the MessageReceiver class, which
is the only place it should apply.
This commit is contained in:
lilia 2015-08-07 17:04:49 -07:00
parent e59a5792d5
commit a925027cd2
3 changed files with 91 additions and 47 deletions

View file

@ -65,7 +65,13 @@
if (!textsecure.registration.isDone()) { return; }
// initialize the socket and start listening for messages
messageReceiver = new textsecure.MessageReceiver('wss://textsecure-service-staging.whispersystems.org', window);
messageReceiver = new textsecure.MessageReceiver(
'https://textsecure-service-staging.whispersystems.org',
textsecure.storage.get('number_id'),
textsecure.storage.get('password'),
textsecure.storage.get('signaling_key'),
window
);
}
function onContactReceived(ev) {