Commit Graph

365 Commits

Author SHA1 Message Date
JC Brand
5a48f3da23 Clone auto_join_rooms values before passing in
otherwise values get tacked on, causing problems when reconnecting.
2019-07-26 19:30:01 +02:00
JC Brand
6dd4fc5234 Tear down previous session when reconnecting anonymously
Because when we reconnect anonymously, we get a new JID, so it's as if
it's a completely new user.
2019-07-26 19:29:01 +02:00
JC Brand
a1d7076e93 Let initConnection wait for for _converse.api.login
So that the BOSH connection will be restored before we trigger `connectionInitialized`
2019-07-26 18:57:28 +02:00
JC Brand
fd4ba89182 Reconnect when an anonymous connection drops or fails. 2019-07-26 18:50:19 +02:00
JC Brand
ea36d53f78 Re-add the keepalive options.
It's unlikely that `keepalive` needs to be set to `false`, but there are
some edge cases where it might be useful.

Here's a breakdown of the different configurations of `keepalive` and `auto_join`:

---

* auto_login: false, keepalive: true

This is the default config. Users need to log in manually, but then
Converse will try to reconnect them when the page reloads.

* auto_login: true, keepalive: true

Also very popular configuration. Used with `credentials_url` or `prebind_url`.

* auto_login = `true`, keepalive = `false`

Not sure what this could be useful for. No currently known application.

* auto_login = `false`, keepalive = `false`

Useful when you want some kind of specific action to trigger login, but
you don't want to maintain that state across page reloads.

Also relevant when using a websocket connection with anonymous login.
With websocket it's impossible to maintain anonymous sessions across page
reload because the the session gets removed server-side as soon as the
websocket connection drops and the server won't accept a full JID with
password for an anonymous connection anyway (which could happen upon
page reload when Converse tries to login in again if `keepalive` was `true`).
2019-07-26 18:08:38 +02:00
JC Brand
b6b085189b Attempt to restore BOSH session or auto_login before...
triggering connectionInitialized.

That way, when listening for `connectionInitialized`, we'll know when it
fires whether we've attached to a BOSH connection or not.
2019-07-26 16:43:35 +02:00
JC Brand
c4ad02d4e3 New config setting: muc_fetch_members 2019-07-26 13:32:21 +02:00
JC Brand
c5193be44b Add postrelease make recipe to show dev version number in app 2019-07-25 13:45:51 +02:00
JC Brand
fa2d6cca10 Update developer documentation and buildout dependencies 2019-07-25 12:33:46 +02:00
JC Brand
2546622da3 Trigger events when resizing starts 2019-07-25 06:46:05 +02:00
Stanislav
d9e0b63683 Fix: use JID from credentials when credentials_url is set (#1638)
* Fix: async SetUserJID
2019-07-23 15:26:46 +02:00
JC Brand
643c40f260 Respect auto_login after finishInitialization.
If `auto_login` is false, we shouldn't log in, so we only try to log in when
it is true. Otherwise we still try to restore the BOSH session (if applicable).
2019-07-23 11:51:51 +02:00
JC Brand
18a2c8858a Make attemptNonPreboundSession and autoJoin functions
rename `autoJoin` to `connect`
2019-07-23 10:19:15 +02:00
JC Brand
e4eafe9e91 Simplify attemptNonPreboundSession
- Split between `login` auth and the rest (`external`, `anonymous`, `prebind`)
- It doesn't make sense to pass along credentials when not using `login` auth so avoid that flow.
- It's not necessary to pass the `reconnecting` flag to `attemptNonPreboundSession`
2019-07-23 10:18:47 +02:00
JC Brand
07f82d6a0d Allow passing of more options to auto_join_rooms 2019-07-22 15:10:59 +02:00
JC Brand
3817f471a0 Two session related fixes.
* Don't set JID resource when logging in anonymously. The resource will be set by the server.
* Don't wipe the `id` from the session when clearing it.
2019-07-22 14:43:30 +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
3a2bf766a0 Add new test utility waitUntilBookmarksReturned 2019-07-12 10:38:07 +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
8a98ef87fe Various small fixes. (Unused imports, unused vars etc). 2019-07-11 12:37:17 +02:00
JC Brand
802f2b24f5 converse-muc: Update sendConfiguration to not take callbacks 2019-07-11 11:01:51 +02:00
JC Brand
d95a7987ce Fix linting errors and add @module jsdoc directives 2019-07-11 10:48:52 +02:00
JC Brand
8938245cdd Update various dependencies to their latest versions 2019-07-11 09:46:17 +02:00
JC Brand
8a405ee88c Various bugfixes based on the previous refactoring.
These two commit should ideally be one, but I inadvertently pushed to
remote too early.
2019-07-10 16:55:55 +02:00
JC Brand
ded9945ed9 MUC: Don't send XEP-0085 CSNs when we don't have voice
Includes some refactoring:

- Don't send an `active` chat state notification when entering a MUC
  I can't think of a good reason why this might be necessary or desired.
- Move `setChatState` form the view to the model
- Remove unused method `handleChatStateNotification`
- Don't store `role` and `affiliation` for the current user on the
  ChatRoom object, but instead on the ChatRoomOccupant object representing
  the user.
2019-07-10 14:24:00 +02:00
JC Brand
a16c068313 Bugfix. Handle null passed in as attrs to api.rooms.create 2019-07-09 13:45:34 +02:00
JC Brand
168f29cf06 Only call credentials_url when authentication is set to login
Also update to newer strophe.js version which contains a bugfix.
2019-07-09 12:47:09 +02:00
JC Brand
5c88d3e836 Add role and affiliation classes to message DOM element 2019-07-08 13:58:15 +02:00
JC Brand
de1071bd4a Add isModerator method on the occupant model 2019-07-08 13:57:10 +02:00
JC Brand
6bfa69ab3b Bugfix. Wait for members before fetching messages 2019-07-08 13:23:56 +02:00
JC Brand
1c50d4d7a1 Bugfix. Numbers aren't delineators for mentions 2019-07-04 08:28:12 +02:00
JC Brand
89ef9a18c4 Call destroy for the models instead of remove on the collection
So that the models get removed from the browser cache.
Otherwise they get re-fetched when we reconnect.
2019-07-04 08:28:12 +02:00
JC Brand
e5188d8b10 Bugfix. Remove affiliation based on updated members lists 2019-07-04 08:28:12 +02:00
JC Brand
da1d87648c New config option clear_messages_on_reconnection
In some cases, it might be desirable to clear cached chat messages once you've
reconnected to the XMPP server.

For example, if you want to prevent the chat history from getting too long or
if you want to avoid gaps in the chat history (for example due to MAM not
returning all messages since the last cached message).

If you're using OMEMO, then you probably don't want to set this setting to
``true``. OMEMO messages can be decrypted only once, so if they then
subsequently get cleared, you won't get the plaintext back.
2019-07-04 08:28:12 +02:00
JC Brand
67bcc00f10 Associate ChatRoomOccupant to ChatRoomMessage
and use promises to indicate when an occupant or contact has been set
2019-07-04 08:28:12 +02:00
JC Brand
e7178fed31 Fetch messages after fetching members.
This is done to avoid unnecessary repaints and reflows (caused when a
message has already rendered and then an occupant is created and
attached to that message, cauring a re-render).

Related to #1266
2019-07-04 07:58:24 +02:00
JC Brand
cd6b5143c6 Create separate models for MUC messages and their container 2019-07-04 07:58:24 +02:00
JC Brand
0d75cc5235 Fixes #1622
Make selector more general because Ejabberd returns `error[type="modify"]` instead of `error[type="cancel"]`.
2019-07-01 17:59:02 +02:00
JC Brand
63d258a00a Use findWhere when looking for only one instance 2019-07-01 17:21:47 +02:00
JC Brand
bb94891621 Only remove non-members when reconnecting to a MUC
to avoid unnecessarily destroying and then recreating ChatRoomOccupant
instances for room members.
2019-07-01 09:16:15 +02:00
JC Brand
8db839b4cf Send a XEP-0410 ping when we restore a MUC from cache
and re-enter if necessary.

This solves the problem where we "clone" a tab (e.g. middle-click) and
then restore a MUC from cache which we haven't actually entered (given
that the new tab represents a new device and session).

Also... add `await` in a test to try and fix Travis flakiness
2019-06-27 16:50:44 +02:00
JC Brand
0d928edf7e Disconnect MUCs when we don't have a resumable SMACKS session 2019-06-27 15:49:19 +02:00
JC Brand
ec68dc1cf0 Always set JID on the connection
So that the resource is passed along when we manually bind.

Related to bd81b89724
2019-06-27 15:19:48 +02:00
JC Brand
119966d902 Set flag to indicate user session is active
We then use this flag to determine whether we should use the values from
sessionStorage.

This appears to fix the problem I originally tried to fix in 607d798665.

When "cloning" a tab (e.g. via middle-click), the `active` flag will be
set and we'll create a new empty user session, otherwise it'll be false
and we can re-use the user session.
2019-06-27 15:13:04 +02:00
JC Brand
8d9d0a1ef4 Revert "Store session per full JID"
This reverts commit 607d798665.

Unfortunately this doesn't solve the issue because we have a
chicken-and-egg problem due to not knowing the resource beforehand.

So what happens after this change is that we never resume XEP-0198
sessions but instead always start a new one.
2019-06-27 15:11:14 +02:00
JC Brand
bd81b89724 Ensure current resource is bound when manually calling connection.bind 2019-06-26 13:48:10 +02:00
JC Brand
2cbc4aaa50 Fixes #1494. Trim whitespace around messages 2019-06-26 10:59:56 +02:00
JC Brand
b69440f875 converse-smacks: Ensure default session values are set 2019-06-25 23:58:45 +02:00
JC Brand
c759112cf3 Fix failing test 2019-06-25 22:53:39 +02:00