Commit Graph

154 Commits

Author SHA1 Message Date
JC Brand
3ffb56baa2 Replace debug configuration setting with loglevel 2019-11-22 14:23:19 +01:00
JC Brand
caadb24310 Refactor logging out into its own module
So that we don't need to `_converse` obj in order to log messages
2019-11-22 13:50:36 +01:00
JC Brand
23797dee21 _converse.api.alert.show is now _converse.api.show
Instead of taking an integer for the `type`, "info", "warn" or "error" should be passed in.
2019-10-31 14:42:44 +01:00
JC Brand
1fa203c990 Support for IndexedDB. updates #1105
Depend on latest backbone.browserStorage which has support for IndexedDB
via localforage.

Storage operations are now asynchronous and transactional.

Bugs fixed (mostly by waiting for operations to complete):

* Rooms are now fetched asynchronously, so wait before triggering `show`
  or when closing.
* Make sure chat create/update transactions complete before firing events
* Make sure chats and messages have been fetched before creating new ones.
* When doing a `fetch` with `wait: false` on a collection and then
  creating a model in that collection, then once the read
  operation finishes (after creating the model), the collection is emptied again.
* Patch and wait when saving.
  Otherwise we have previously set attributes overriding later ones.
* Make sure api.roomviews.close returns a promise

Test fixes:

* Chats are now asynchronously returned, so we need to use `await`
* Wait for the storage transaction to complete when creating and updating messages
* Wait for all chatboxes to close
    Otherwise we get sessionStorage inconsistencies due to the async nature of localforage.
* Wait for room views to close in spec/chatroom.js

In the process, remove the `closeAllChatBoxes` override in
converse-controlbox by letting the `close` method decide whether it
should be closed or not.
2019-10-30 13:02:23 +01:00
JC Brand
82bce1e946 Move creation of browserStorage into a separate method
This is in anticipation of the localforage/IndexDB merge
2019-10-11 20:40:31 +02:00
JC Brand
9d77a4ef97 Fixes #129 Add support for XEP-0156.
Only XML is supported for now.
2019-10-11 17:46:13 +02:00
JC Brand
8780f7a128 Fix linting errors (no-unused-vars) 2019-10-09 16:27:58 +02:00
JC Brand
54c90e146e Replace lodash methods with built-ins 2019-09-10 15:47:30 +02:00
JC Brand
768ed4a577 Replace lodash methods with built-ins, convert docstrings to JSDoc 2019-09-07 23:14:33 +02:00
JC Brand
cc91f3751e Add listenTo instead of on to avoid memory leaks 2019-09-06 16:04:06 +02:00
JC Brand
93de11d167 Dynamically load the dayjs translation.
Also, remove the Promise polyfill. We don't support browsers which don't support promises.
2019-08-23 14:03:52 +02:00
JC Brand
ea123e9713 Handle IQ timeouts
* converse-muc: Handle timeout while fetching affiliation list
* converse-omemo: Handle IQ timeout
2019-08-10 14:12:02 +02:00
JC Brand
1bbe52f71c Fixes #1670
Set converse-profile as dependency of converse-omemo
2019-08-08 16:20:55 +02:00
JC Brand
7a590f7c22 Stop using certain lodash methods.
* _.isNil
* _.noop
* _.isNull
2019-08-05 10:56:22 +02:00
JC Brand
cd392bb197 Fixes #1561 Don't clear localStorage and sessionStorage 2019-08-01 11:34:14 +02:00
JC Brand
1eb2364336 Let sendMessage return the message model, not just the text 2019-07-30 16:15:47 +02:00
JC Brand
e20b654876 Stop using _.isUndefined 2019-07-29 10:32:29 +02:00
JC Brand
d95a7987ce Fix linting errors and add @module jsdoc directives 2019-07-11 10:48:52 +02:00
Malcolm
b016aa0f7d FIX OEMO default setting in wrong place (#1476) 2019-07-11 09:11:22 +01:00
Malcolm
b163d05323 ADD Omemo default support (#1476) 2019-07-10 06:51:41 +01:00
JC Brand
3ca6ac7f50 Fixes #1524 Don't include own device in OMEMO message
This change reverts the significant part of 1dfdb36d20

I can't say that I understand why libsignal throws `Error: Invalid signature`
when you try to build a session for your own (sending) device, but given that
messages can only be decrypted once, I guess it isn't really necessary
to encrypt for your own device, since you already have the plaintext.

In addition I've added some error handling so that we can recover
gracefully when session building fails for a subset of devices.
2019-07-05 19:21:05 +02:00
JC Brand
1ef29bee4e Use composition instead of overrides 2019-05-24 16:02:07 +02:00
JC Brand
b876500865 Update to latest backbone.overview 2019-05-23 14:44:10 +02:00
JC Brand
6193a9dc80 Replace lodash methods with native ones and remove lodash.fp 2019-05-14 12:41:47 +02:00
JC Brand
c3dac272f8 Replace moment with DayJS 2019-05-06 14:27:18 +02:00
JC Brand
ba6de8844e Use Object.keys instead of _.keys 2019-04-29 09:29:40 +02:00
JC Brand
34469425d6 Use Object.assign instead of _.extend 2019-04-29 09:07:15 +02:00
JC Brand
21ca33ec29 Bugfix. Create device based on prekey message for from JID
Otherwise for sent carbons we created it for the wrong user.
2019-03-31 19:36:04 +02:00
JC Brand
337e267594 Don't trigger OMEMOInitialized if something went wrong. 2019-03-31 12:01:19 +02:00
JC Brand
dd0c0b6c56 Add a new active flag for OMEMO devices.
Instead of deleting devices that are not returned in the device list,
set an `active` flag, so that we don't remove the trust setting.

Set deactivated devices to `active` when a receive an OMEMO message from
it.

Also, set omemo_supported to true when we've succesfully decrypted a
message.
2019-03-31 11:33:31 +02:00
JC Brand
c32ecb7e82 Refactor fetchDevices to make it smaller and simpler to read 2019-03-30 17:01:50 +01:00
JC Brand
1b08df89bb Don't send OMEMO message when we don't have any devices for contact 2019-03-30 16:32:47 +01:00
JC Brand
1a2e7b235a OMEMO bugfix. Store prekey as boolean and handle '1' and 'true' 2019-03-30 15:57:36 +01:00
JC Brand
1dfdb36d20 Don't filter out own device when sending OMEMO message 2019-03-30 13:55:25 +01:00
JC Brand
f897703565 Rename emit to trigger for consistency with Backbone.Events 2019-03-29 21:56:56 +01:00
JC Brand
f6335dcabe Document fired events with JSDoc 2019-03-29 21:04:33 +01:00
JC Brand
d41a7a14c3 Use API to emit and listen to events 2019-03-29 14:16:07 +01:00
JC Brand
27557d6a04 Document _converse.ChatBox.prototype.sendMessage as an API method
Until now, we've only been explicitly documenting the `_converse.api`
namespace and only considered the methods under it as forming the API
contract (which determines how we do semver releases).

It appears as if we've reached a point where trying to keep everything
under the `_converse.api` namespace no longer makes sense. Certain
methods are applicable to particular models and trying to shoehorn them
into the `_converse.api` namespace seems clunky and non-intuitive.

I've therefore decided to slightly refactor `sendMessage` to let it take
two simple parameters and to document it with JSDoc so that it's
presented as an API method, albeit only available on a chat model.

updates #1496
updates #1504
2019-03-21 21:03:02 +01:00
JC Brand
675692df74 Use _converse.api.send to forward messages 2019-03-21 20:54:23 +01:00
Emmanuel Gil Peyrot
b7ae9f212c Replace http: with https: in conversejs.org links 2019-03-04 17:47:45 +01:00
JC Brand
f123f483ae Fixes #1406 2019-02-21 09:19:02 +01:00
JC Brand
c026dc8a86 New copyright year 2019-02-18 20:23:18 +01:00
JC Brand
9233087548 Don't hash web storage ids.
Makes debugging more difficult and uses up extra CPU cycles for no real security benefit.
2019-02-18 20:23:18 +01:00
JC Brand
a4d608dcdf Save room features in separate model
As a namespacing mechanism to avoid clashes.
Fixes bug where two chats are shown as currently being active in the rooms list.
2019-01-10 12:15:59 +01:00
JC Brand
98fee37a41 Destroy devicelist if we can't fetch the devices for it.
Otherwise Converse will try to fetch the devices again and again upon
page refresh.
2018-12-21 06:29:22 +01:00
JC Brand
45ed506551 Don't hardcode devices storage to session storage.
The devicelists are not stored in session storage, so we end up with
fetching all the devices per stored devicelist with every new browser
session.
2018-12-21 06:29:22 +01:00
JC Brand
e6c66cfebd Ability to republish if publish-options precondition not met 2018-12-21 06:29:22 +01:00
JC Brand
bcb3bcaf03 OMEMO can only be supported once it's been initialized
updates #1180
2018-12-21 06:29:21 +01:00
JC Brand
a3830e9a7a Use async/await 2018-12-21 06:29:21 +01:00
JC Brand
be1be3534c Don't render the lock icon when the MUC doesn't qualify
Updates #1180
2018-12-21 06:29:21 +01:00