Commit Graph

186 Commits

Author SHA1 Message Date
JC Brand
144479428d omemo: Move functions out of the plugin body 2020-11-18 10:49:31 +01:00
JC Brand
bdb347b703 Updates #1471
OMEMO should not be enabled if the device is not trusted and also not if
the cache gets cleared on logout.
2020-11-02 13:22:00 +01:00
JC Brand
19dc66900d Split the trusted setting into two new ones:
- `allow_user_trust_override`
- `clear_cache_on_logout`

The `persistent_store` setting can now also be set to `sessionStorage`

The `trusted` settings was in effect playing the role of two separate settings
and implicitly affecting a third ('persistent_store').

By breaking it up, we make things more explicit and allow for new
configurations. For example, clearing the cache on logout, while using
some kind of persistent store.
2020-10-20 11:29:03 +02:00
Bernard Ngandu
be833631f3
#1829 add color for different omemo state (#2260)
* #1829 css var instead of hard coded colors
2020-10-07 11:32:29 +02:00
JC Brand
7330530d13 omemo: better error handling when some bundles can't be fetched 2020-09-18 15:09:55 +02:00
JC Brand
3af1ffc357 omemo: announce bundle info after publishing new device 2020-09-18 15:09:55 +02:00
JC Brand
5949d29460 omemo: specify pubsub item id of 'current' 2020-09-18 15:09:23 +02:00
JC Brand
a0ae8135ce Fixes #1481
For OMEMO in MUC, use the real JID of the user, not the MUC JID
2020-09-17 17:12:06 +02:00
JC Brand
0a82a177c4 OMEMO: ensure reflected encrypted MUC messages are identified 2020-09-17 10:37:09 +02:00
JC Brand
8d3cd687e7 Pass chatbox or _converse as context 2020-09-11 16:44:28 +02:00
JC Brand
2c042cc3fa Fixes #2184: Headless build relies on locale directory
Removed Jed from the headless build and instead let `__` call sprintf.

It's now up to downstream users for `@converse/headless` to decide
whether they want i18n support for the few translatable strings in that package
and to implement it themselves.
2020-09-10 08:55:38 +02:00
JC Brand
7c43d0435c Refactor OMEMO.
- Add hooks to the stanza parsers so that plugins can do additional parsing.
- Change ChatBox instance methods to functions and use them for stanza parsing.
- Move encrypt and decrypt messages to `converse.env.omemo`

Apparently, when receving a 1:1 carbon message, a device was wrongly created
for the contact's device list, instead of our own.
2020-09-09 14:04:24 +02:00
JC Brand
cb2759a653 Regenerate pot and po files
Also fix i18n typo in src/converse-omemo.js
2020-08-17 09:03:44 +02:00
JC Brand
5e479d3bbb OMEMO: Catch timing error while testing 2020-07-27 12:42:50 +02:00
JC Brand
c3d6b64f4b Turn the chat toolbar into a component
- Declaratively render the emoji picker dropup
- Got rid of converse-emoji-views
- Adapt OMEMO to the new buttons stuff
- Make emojis json global, to try and speed up tests
- omemo: Move functions to the top of the module
2020-07-08 10:17:06 +02:00
JC Brand
b0cb489769 Use @converse/skeletor, lodash-es and latest webpack-dev-server 2020-06-08 19:38:16 +02:00
JC Brand
830e060568 Rename api.settings.update to api.settings.extend
This is to try and make it clearer that this method won't override
initialization settings, and is instead simply to add to the default
settings.
2020-06-03 09:32:16 +02:00
JC Brand
7651d58470 Render chat messages as web components
- Render chat content as a <converse-chat-content> component
- Create new component for rendering the message body
- Get rid of `showMessage` method
2020-06-01 09:53:19 +02:00
JC Brand
bf4b3efa5b Import _converse and api 2020-05-18 10:54:37 +02:00
JC Brand
7e2552bd8c core: Allow multiple imports 2020-04-23 13:50:35 +02:00
JC Brand
a1d5563963 Move OMEMO-related message parsing to utils/stanza.js 2020-04-13 17:44:47 +02:00
JC Brand
ce1f7e090e Rename getMessageAttributesFromStanza to parseMessage 2020-04-13 17:44:47 +02:00
JC Brand
030c26a8ab Use api shortcut instead of _converse.api 2020-03-31 13:16:24 +02:00
JC Brand
631b9bb438 Use the settings API for setting and getting config settings
This is an initial step towards no longer storing and accessing settings
directly via the `_converse` object
2020-03-31 11:57:03 +02:00
JC Brand
967154d314 Use optional chaining instead of lodash.get 2020-03-24 12:30:45 +01:00
JC Brand
6fe802a96b Replace lodash methods with native ones 2020-03-06 15:49:48 +01:00
JC Brand
a7f28cd61d When creating message objects, wait for confirmation from storage
Queue messages and handle them sequentially, each time waiting for promises to
resolve before handling the next message.

Updates #1899, which likely happens because an error message is received
before messages have been fetched.
2020-03-04 15:14:57 +01:00
JC Brand
2ac33c77b3 Fix linting errors 2020-02-20 19:18:06 +01:00
JC Brand
7279f08a34 Update to newer skeletor which can return a promise on create 2020-02-03 23:24:44 +01:00
JC Brand
7d7c41a135 OMEMO: fix timing errors
- Use async/await
- Wait for devices to be created before continuing
2020-02-03 23:24:44 +01:00
JC Brand
11e219dd41 Update copyright 2020-01-30 17:36:55 +01:00
JC Brand
a8104d7498 Add Skeletor as dependency 2020-01-30 17:36:55 +01:00
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