Commit Graph

168 Commits

Author SHA1 Message Date
JC Brand
7848d8cb2f Add support for decrypting XEP-0454 OMEMO media 2021-06-25 09:24:18 +02:00
JC Brand
2c0fbec43c Move arraybuffer utility methods into their own file 2021-06-24 18:57:32 +02:00
JC Brand
58d96c8594 Use intersection observer to remember scrolling position 2021-06-03 18:24:55 +02:00
JC Brand
994e528b45 Bugfix. Properly escape | character in mentioned nicknames 2021-05-19 14:47:20 +02:00
JC Brand
3d58b67517 Use @converse/openpromise 2021-04-28 18:35:08 +02:00
JC Brand
7b7ec45db8 Move disco plugin into folder and import lodash utilities separately 2021-04-21 11:03:22 +02:00
ubermanu
3bfd60a3df Move the httpToGeoUri util into core 2021-03-25 09:08:39 +01:00
JC Brand
e80afbfe39 Move MUC and stanza utils into shared and plugin-specific files 2020-12-14 16:30:13 +01:00
JC Brand
c855d2f4ce Updates #2350 Avoid bundling Strophe twice
by not importing Strophe outside of @converse/headless
2020-12-10 16:32:01 +01:00
JC Brand
824bf2ed30 Move all plugin files to ./plugin folders
Rename converse-core.js to core.js
2020-12-03 16:41:15 +01:00
JC Brand
f86efca9a6 autocomplete: Use regex instead of hardcoded list...
to determine valid characters to form a boundary before an `@` mention

Also fixed an issue with mentions looking like they're part of URLs, by
first processing mentions separately.
2020-11-27 22:06:22 +01:00
Xavi Ferrer
8b9c97745f Allow selected characters to precede a mention 2020-11-27 14:12:29 +01:00
JC Brand
f9650f33be Add support for XEP-0393 message styling
Fixes #1083

Directives are rendered as templates and their bodies are MessageText instances.
We thereby achieve the necessary nesting of directives (and other rich
elements inside directives) by letting each directive
body render itself similarly to how the whole message body is rendered.
2020-11-24 16:06:48 +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
JC Brand
48f119b673 MAM: use bare JID as by attribute for archive-id
in 1:1 chats.

See: https://xmpp.org/extensions/xep-0313.html#archives_id
2020-10-13 04:48:21 +02:00
JC Brand
7aee9c4432 muc: simplify api.rooms methods.
- Let `api.rooms.open` call `api.rooms.get` directly, instead of indirectly via `api.rooms.create`
- Remove the `createChatRoom` function
- Also strip URI parts from JID in `api.rooms.get` and use utility method for doing so
2020-10-07 15:31:13 +02:00
Xavi
86c04b876b
Allow mention autocomplete to trigger right after a new line (#2267)
* catch all whitespace characters instead of just new line
2020-10-07 11:05:18 +02:00
Christoph Scholz
f68eb65cd7 check against own jid when detecting forged mam messages 2020-10-06 20:30:40 +02:00
JC Brand
6d9752645f Replace lodash methods with native ones
filter
find
has
isEmpty
isString
isUndefined
noop
reject
uniq
2020-10-01 12:56:00 +02:00
JC Brand
0ca2e5ae08 Remove need for lodash templates in headless build 2020-09-26 09:58:34 +02:00
JC Brand
3fc6f7fa23 Fixes #1924 2020-09-25 18:46:45 +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
9fe7bfcd64 Include chatbox in 'message' event data 2020-09-16 19:08:56 +02:00
JC Brand
8d3cd687e7 Pass chatbox or _converse as context 2020-09-11 16:44:28 +02:00
JC Brand
bbcfc9f998 Bugfix. 2nd parameter for api.hook is the context 2020-09-11 16:23:51 +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
09371712b0 Updates #1896: Properly identify archived one-on-one messages
Also, rename attribute from `is_receipt_request` to `is_valid_receipt_request` to avoid confusion.
2020-08-13 11:09:22 +02:00
JC Brand
4de9816f24 Make sure emojis are initialized before parsing a message
for emoji related data
2020-07-13 15:45:37 +02:00
JC Brand
b6dabf7381 muc: Ensure that exact nicknames (and not substrings) are matched 2020-06-22 13:57:44 +02:00
Ariel Fuggini
73d33e1161
Makes mentions case-insensitive, plus parsing functionality refactor (#2061) 2020-06-18 11:19:01 +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
b511f1d950 Updates #1896: Use right flag to checked if message is archived 2020-06-08 12:25:49 +02:00
JC Brand
dd7bb28d86 Report traceback when waitUntil times out 2020-06-05 15:49:18 +02:00
JC Brand
9f7b6d6fa1 Fixes #2035 2020-06-03 10:56:38 +02:00
JC Brand
1ff6ced3ab Don't override initialization settings via api.settings.update
This is a problem that could occur when calling converse.initialize twice
2020-06-03 09:15:35 +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
ca7adeedbd Save hat URI, not id 2020-05-20 13:44:29 +02:00
JC Brand
555c0966cc muc: save error response to a sent message onto the original model 2020-05-07 13:32:56 +02:00
JC Brand
b5eea12d49 Refactor so that message attributes are parsed early
It's better to parse an incoming message stanza early, than to have
all kinds of methods throughout the codebase that does querySelector
etc.

Firstly, it allows us to catch and report errors and malicious stanzas early on.
It also simplifies programming because you don't need to try and
remember how to properly parse a stanza, all the work is done upfront
for you.
2020-04-27 16:34:37 +02:00
JC Brand
c6f8ef0c46 Various JSDoc related fixes and improvements
Using the `@method` directive on a `@class` means that the method
doesn't appear.
2020-04-23 13:55:08 +02:00
JC Brand
7e2552bd8c core: Allow multiple imports 2020-04-23 13:50:35 +02:00
JC Brand
f68f577b71 muc-views: Update ListChatRoomsModal to make better use of lit-html 2020-04-15 11:54:07 +02:00
JC Brand
5cb65d84f1 Bugfix. Don't assume OMEMO store is always there 2020-04-14 14:04:26 +02:00
JC Brand
df9612f937 Add support for XEP-0317 MUC Hats 2020-04-13 22:57:29 +02:00
JC Brand
e2a7045e22 Move MUC presence parsing code to src/headless/utils/stanza.js 2020-04-13 18:22:15 +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
6391cc0803 Rename applyUserSettings to applySiteSettings 2020-03-31 14:08:34 +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
b5d57f0ef8 Handle and render chat state notifications separately from messages 2020-03-21 17:21:53 +01:00
JC Brand
6fe802a96b Replace lodash methods with native ones 2020-03-06 15:49:48 +01:00
JC Brand
ce08819a43 Retracted moderated sent message should not be editable. 2020-02-18 16:47:52 +01:00
JC Brand
3400acbfeb Show MUC buttons in a dropdown menu
- Get rid of the ChatBoxHeading class
- Add support for showing standalone buttons in overlay viewmode
2020-02-13 20:57:47 +01:00
JC Brand
ed411c226d Avoid creating Message objects for empty messages 2020-02-13 16:31:13 +01:00
JC Brand
746fe441e2 Updates the message parsing.
Only set `id` once we've actually parsed the sender attributes,
otherwise `attrs.from` is `undefined`.

Use `Array.prototype.reduce` to generate stanza_ids attributes map.

Add `from_muc` attribute which contains the MUC JID
2020-02-07 12:12:38 +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
50e6c8a082 roster: refactor to use async/await 2020-01-30 17:36:55 +01:00
JC Brand
b0a9782d31 emoji: Lazy load the emoji JSON
Only load it once the first chat has been opened.
2020-01-21 12:45:34 +01:00
JC Brand
161cbec0d8 For forbidden errors, show error message from server 2020-01-17 14:44:05 +01:00
JC Brand
d8e561ef7e Fix linting errors 2019-12-20 16:02:53 +01:00
JC Brand
9b4276721c Remove unnecessary await statement 2019-12-19 13:12:12 +01:00
JC Brand
e23c7ce543 More retraction updates
- Retracted moderated message are not editable
- Use "removed" for user-facing text
2019-11-26 22:04:38 +01:00
JC Brand
13ffe5a667 Various smaller retraction related fixes and improvements 2019-11-26 12:16:48 +01:00
JC Brand
1b9ba58aca Rename variable to be more accurate 2019-11-22 13:50:36 +01:00
JC Brand
b4dafcc45b Add support for XEP-0424 and XEP-0425
- Add support for switching ephemerality after message creation
- Move more methods from ChatBox and ChatRoom to utils/stanza.js
- Rename 'ephemeral' to 'is_ephemeral' since it's a boolean
2019-11-22 13:50:36 +01:00
JC Brand
e915321e33 Group MUC utility methods in muc_utils object
as opposed to having them in the `u` object
2019-11-22 13:50:36 +01:00
JC Brand
8523cae8d0 Move message parsing code out of ChatBox into new stanza-utils plugin 2019-11-22 13:50:36 +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
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
91397125ba roomslist: Refactor to use VDOMView instead of OrderedListView 2019-10-13 16:59: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
54e9c51a1a Don't rely on getUniqueId of Strophe.Connection
since we can't assume it's always available.
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
Christoph Scholz
bce8dc9113 Fixes #1714
don't notify if only message delivery receipt
2019-09-24 13:27:49 +02:00
JC Brand
68e34351ed Reject unencapsulated forwarded messages
since we don't support XEP-0297 on its own
2019-09-13 13:05:21 +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
cf7d2fb648 Add webpack.nodeps.js
Use it to generate dist/converse-no-dependencies.js which we use to
generate the converse.pot file.
2019-08-23 21:36:27 +02:00
JC Brand
e4dc9fa820 Open emojis popup when TAB is pressed on a word starting with : 2019-08-22 13:56:47 +02:00
JC Brand
4cb9fd88a8 Refactor emojis so that JSON is fetch asynchronously 2019-08-22 13:56:47 +02:00
JC Brand
a407aff33c converse-ping: Refactor and update to reconnect upon ping timeout 2019-08-10 12:26:07 +02:00
JC Brand
aee6a192d1 Add a new command /modtools
in which you can set user affiliations and roles.

Also, let getAffiliationList return an Error instead of `null` if you're
not allowed to fetch a particular affiliation list.
2019-08-09 23:30:14 +02:00
JC Brand
bea073a5a2 Fix erroneous "is no longer an admin/owner" messages in MUCs
Don't remove affiliation for occupants if we weren't allowed to
fetch that particular affiliation list.

Previously, if fetching the list failed, we would return an empty array,
which would imply that the affiliation list is empty and that all
users with the given affiliation should have their affiliations removed.

Instead we now return `null` and properly account for that when setting
affiliations on existing contacts based on the returned member lists.
2019-08-08 16:19:04 +02:00
JC Brand
5cb5ec4640 Fixes #1668. MUC MAM blocked by "info" messages 2019-08-06 23:30:02 +02:00
JC Brand
d90bcd5274 Combine two versions of isOnlyChatStateNotification into one
Also fix a bug in the code dermining whether an XMLElement stanza is only a chat state notification
2019-08-05 10:58:38 +02:00
JC Brand
7a590f7c22 Stop using certain lodash methods.
* _.isNil
* _.noop
* _.isNull
2019-08-05 10:56:22 +02:00
JC Brand
8bd72eed72 Don't keep on refetching roster if the service is unavailable
`sendIQ` now takes a flag to turn of rejection of the promise and to
resolve on error IQs instead.
2019-07-29 14:33:37 +02:00
JC Brand
e20b654876 Stop using _.isUndefined 2019-07-29 10:32:29 +02:00
JC Brand
c4ad02d4e3 New config setting: muc_fetch_members 2019-07-26 13:32:21 +02:00
JC Brand
38d1e4e3d2 Bugfix. Sometimes when trimming chats, minimized chats go off screen 2019-07-12 12:50:20 +02:00
JC Brand
06717370f1 Provide a traceback when waitUntil times out 2019-07-11 23:42:26 +02:00
JC Brand
a1630b5c1f Replace wait-until-promise with utility method
and bump default timeout

Also let `_converse.api.waitUntil` use it if a function is passed in.
2019-07-11 23:34:27 +02:00
JC Brand
d95a7987ce Fix linting errors and add @module jsdoc directives 2019-07-11 10:48:52 +02:00
JC Brand
c5309f9210 Add attributes to resolveable promise to detect its resolved state 2019-06-20 14:04:46 +02:00
JC Brand
38a232fd45 Move BOSH code into a plugin
- Remove the `keepalive` configuration setting. It is now always implicitly `true`.
- Remove the `expose_rid_and_sid` configuration setting.
- A `prebind_url` is now mandatory when setting `authentication` to `prebind`.
- It's no longer possible to pass in `rid` and `sid` values to `converse.initialize.
2019-06-05 11:35:48 +02:00
JC Brand
085a4c6535 Small config fixes
- fix import path
- remove unnecessary lines in webpack config
- remove unused file
2019-06-04 20:35:09 +02:00
JC Brand
68d4a71c75 Fix _converse.api.user.login to handle auto_login case
Also, set the resource in `setUserJID`
2019-06-03 11:40:26 +02:00
JC Brand
1fb5378524 Throw error on parser error in toStanza 2019-06-03 09:43:24 +02:00