Commit graph

76 commits

Author SHA1 Message Date
lilia
40b54185f3 If we happen to get a group message with no update, use a blank name 2014-12-23 15:07:43 -08:00
Dave Sescleifer
2462aba24b Fixed timestamps and added last message to the gutter 2014-12-22 23:38:26 -08:00
lilia
80993753de Fix bug overwriting existing conversation names
On incoming messages for pre-existing conversations, don't update any
attributes unless it's a group update message.
2014-12-22 13:24:12 -08:00
lilia
30bca85f5a Fix undefined proto.source 2014-12-22 13:24:02 -08:00
lilia
ccc98d2f3d Fixup delivery receipts
Uses app-level timestamps for outgoing messages.
Adds timestamp property to the outgoing jsonData.
Triggers a runtime event to notify frontend on delivery receipts.
Renders delivered messages with a 'delivered' class.
2014-12-21 21:36:40 -08:00
lilia
6cbde7894a Delivery receipts 2014-12-19 17:59:09 -08:00
lilia
9c736df7d0 Handle incoming identity key changes
This ended up turning into a rewrite/refactor of the background page.
For best results, view this diff with `-w` to ignore whitespace. In
order to support retrying message decryption, possibly at a much later
time than the message is received, we now implement the following:

Each message is saved before it is decrypted. This generates a unique
message_id which is later used to update the database entry with the
message contents, or with any errors generated during processing.

When an IncomingIdentityKeyError occurs, we catch it and save it on the
model, then update the front end as usual. When the user clicks to
accept the new key, the error is replayed, which causes the message to
be decrypted and then passed to the background page for normal
processing.
2014-12-19 17:30:09 -08:00
lilia
5762e59c41 DRY up registration event callbacks
This was just a special case of the extension.on/trigger interface.
2014-12-19 14:02:52 -08:00
lilia
470346c9c4 Save incoming messages and pass to frontend asynchronously
After a message is saved asynchronsly, fire an event and pass the
message attributes to frontend listeners via the chrome-runtime API.

This behavior is similar to the 'storage' event fired by localStorage.
2014-11-24 19:25:03 -08:00
lilia
ced295a630 Move message and conversation storage to IndexedDB
Getting up and running with IndexedDB was pretty easy, thanks to
backbone. The tricky part was making reads and writes asynchronous.
In that process I did some refactoring on Whisper.Threads, which
has been renamed Conversations for consistency with the view names.

This change also adds the unlimitedStorage permission.
2014-11-24 19:25:03 -08:00
lilia
7f04439b37 New websocket protocol 2014-11-14 17:48:57 -08:00
lilia
735737f0bc Merge Whisper.Messages into Whisper Threads
Eliminates the global Whisper.Messages object and consolidates shared
send/receive logic in Whisper.Threads.

To the latter end, note that the decrypted array buffer on an attachment
pointer is now named data instead of decrypted, in order to match the
format of outgoing attachments presented by
FileReader.readAsArrayBuffers and let us use the same handler to base64
encode them.
2014-11-13 15:53:56 -08:00
lilia
5a0e199fc5 Namespace registration helpers 2014-11-13 15:53:56 -08:00
lilia
13446e9c17 "Fix dirty hack" (runtime.reload) in chromium.js
Runtime reload is overkill and causes a jarring ux. Instead, send and
receive messages across the runtime. Also, if we need to jump between
the main ui and options pages, simply navigate within the current tab
rather than spawning a new one.
2014-11-10 16:24:01 -08:00
lilia
a1a528ccdd Finish abstracting native client
Firstly, don't initialize textsecure.nativclient unless the browser
supports it. The mimetype-check trick is hewn from nacl-common.js.

Secondly, nativeclient crypto functions will all automatically wait for
the module to load before sending messages, so we needn't register any
onload callbacks outside nativeclient.js. (Previously, if you wanted to
do crypto with native client, you would have to register a call back and
wait for the module to load.) Now that the native client crypto is
encapsulated behind a nice interface, it can handle all that
onload-callback jazz internally: if the module isn't loaded when you
call a nativeclient function, return a promise that waits for the load
callback, and eventually resolves with the result of the requested
command. This removes the need for textsecure.registerOnLoadCallback.

Finally, although native client has its quirks, it's significantly
faster than the alternative (emscripten compiled js), so this commit
also lets the crypto backend use native client opportunistically, if
it's available, falling back to js if not, which should make us
compatible with older versions of chrome and chromium.
2014-11-09 15:23:23 -08:00
Arlo Breault
bc5dea62c3 Use FileReader to base64 encode attachments
* Implements #82
2014-11-03 15:01:52 -08:00
Marco
69ba6581b0 moved some chromium-specific code into chromium.js (using extension.navigator namespace) 2014-06-01 21:33:58 +02:00
Matt Corallo
d9bf0a41fb textsecure.storage, chromium.js 2014-05-20 22:21:07 -04:00
Matt Corallo
be82547ea1 Move message saving out of helpers.js 2014-05-18 19:50:30 -04:00
Matt Corallo
6bc19ef558 More namespacing 2014-05-17 01:53:58 -04:00
Matt Corallo
8d408e6d8f THOUGH SALL USE TABSTOP AND SHIFTWIDTH 4 (so that indents read right) 2014-05-14 17:21:49 -04:00
Matt Corallo
1137f9d711 Add TODO file showing what still needs to be done 2014-05-04 17:07:25 -04:00
Matt Corallo
3e60368a16 LGPL license (I'd like to be an axolotl/TS JS lib in the future) 2014-05-04 02:34:13 -04:00
Matt Corallo
2ae5628122 Send-to-self works =D 2014-03-26 15:05:09 -04:00
Matt Corallo
8db3885659 Updates, NaCL 2014-01-22 06:23:41 +00:00
Matt Corallo
eec4c66ef6 Fixup dir structure 2014-01-22 03:28:35 +00:00
Renamed from background.js (Browse further)