Commit Graph

323 Commits

Author SHA1 Message Date
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
JC Brand
607d798665 Store session per full JID
Otherwise we run into a bug where two tabs with Converse.js share the
same XEP-0198 SM-ID, causing both to go into a reconnection-loop as
the XMPP server switches XEP-0198 sessions between them.

This bug is due to a distinction in how sessionStorage behaves when you
open the existing site in a new tab (e.g. middle-click or
`target="_blank"), as opposed to creating a new tab
and then opening the site in that tab.

In the latter case, the newly created sessionStorage object is empty.
In the former, the contents of sessionStorage of the current page is
copied over to the new page!
2019-06-25 21:40:28 +02:00
JC Brand
681c3a2c12 Corrections bugfix. Don't save new id on message model
otherwise a new cache entry gets created, causing multiple messages to
be restored from cache later on.
2019-06-25 12:06:47 +02:00
JC Brand
1bc3f28e6f Update refreshFeatures
Distinguish between getting an existing entity and
creating a new one.

When creating a new one, ensure that we don't fetch from the cache.

New API method for creating a disco entity.
2019-06-25 11:43:59 +02:00
JC Brand
996a43792e converse-mam depends on converse-rsm 2019-06-20 16:51:50 +02:00
JC Brand
29b6a6724d Need to explicitly fetch messages now when restoring a MUC from cache 2019-06-20 16:36:26 +02:00
JC Brand
40469a9787 MUC: Refresh room features when re-entering a cached room
Only fetch messages after we have the latest room features
Otherwise we run into race conditions where MAM messages are fetched
before we know whether (updated) the room supports MAM or not.
2019-06-20 14:04:46 +02:00
JC Brand
ac007bb527 converse-disco: don't replace a pending promise
I'm not sure how much this is an issue outside of tests, where we might
run into race conditions arising to the fact that we don't always
respond to every IQ stanza
2019-06-20 14:04:46 +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
c32070c9bb Autocomplete fixes
- Fixes #1575. Height not properly set on MUC invitation list
- Add new configuration setting: `muc_mention_autocomplete_min_chars`
- Bugfix. `min_chars` setting for MUC mentions wasn't having an effect
2019-06-19 15:01:30 +02:00
JC Brand
303a8b63af Fixes #1495. Mentions should always include a URI attribute 2019-06-19 09:35:39 +02:00
JC Brand
1dc73c1c31 For chatboxes, use the web storage determined by _converse.trusted 2019-06-18 16:46:55 +02:00
JC Brand
21b0f2464d Clear received field for corrected messages
It gets populated again upon MUC reflection or chat marker
2019-06-17 12:14:31 +02:00
JC Brand
9c66302c4a Bugfix. Error responses weren't being shown for corrections 2019-06-17 12:07:33 +02:00
JC Brand
de3099a9d8 converse-muc: Show <text> content of error presences 2019-06-16 12:14:32 +02:00
JC Brand
83201e7c02 Reconnection fixes.
When reconnecting with a new transport, we call setUserJID
so that a new resource is generated, to avoid multiple
server-side sessions with the same resource.

We also call `_proto._doDisconnect` so that connection event handlers
for the old transport are removed.
2019-06-14 12:00:49 +02:00
JC Brand
9635f53dad converse-smacks: 2 bugfixes.
- Don't ever resume SMACKS stream when using BOSH
- Clear SMACKS session data when using BOSH
2019-06-14 12:00:49 +02:00
JC Brand
946394928b Fixes #1601 Message corrections should get their own origin id 2019-06-13 16:31:02 +02:00
JC Brand
22bdccc775 Bugfix.
https://xmpp.org/extensions/xep-0198.html#resumption

The <resume/> element MUST include a 'previd' attribute whose value
is the SM-ID of the former stream and MUST include an 'h' attribute
that identifies the sequence number of the last handled stanza sent
over the former stream from the server to the client.
2019-06-13 13:54:58 +02:00
JC Brand
f3c4dbc344 Avoid unnecessarily sending out a presence stanza
- Set roster_fetched flag when we get an empty IQ[type="result"] stanza
- Set `restored` flag when resuming in converse-smacks
- Don't trigger change event when fetching xmppstatus values
- Removed two events, since we can just listen to `change` on `_converse.xmppstatus`.
2019-06-13 13:33:01 +02:00
JC Brand
ba9d28b5c2 Two MUC tests
- Test for info message indicating a configuration change
- Test that the MUC reconnects when a `not-acceptable` error is returned
2019-06-12 18:39:24 +02:00
JC Brand
ca4b509d87 Log MUC connection status 2019-06-12 10:55:01 +02:00
JC Brand
5362156731 While connecting, treat "modify" error as a disconnection event 2019-06-12 10:15:55 +02:00
JC Brand
9d3dfa831a Fixes #1599 2019-06-12 06:40:53 +02:00
JC Brand
e1ca02d94a converse-disco: don't call onInfo on undefined 2019-06-12 06:27:07 +02:00
JC Brand
bbe2a62295 converse-muc: Create info and error messages on the model
instead of on the view.
2019-06-12 06:27:07 +02:00
JC Brand
970ba96ce1 Bugfix. Only create VCards for chat and groupchat messages
Other types of messages such as `error` don't necessarily have a JID
tied to them.
2019-06-11 14:05:30 +02:00
JC Brand
a0f0240b92 Don't set nick before confirmation that it was successful 2019-06-11 14:05:30 +02:00
JC Brand
d385452a7d Use _converse.getDefaultMUCNickname 2019-06-11 14:05:30 +02:00
JC Brand
599f7596f6 Show policy violation errors to the user and make them ephemeral
Also, remove ephemeral messages after 10 seconds, not 20
2019-06-11 14:05:07 +02:00
JC Brand
dc0085bff3 All received MUC messages are "received" by definition 2019-06-06 16:17:51 +02:00
JC Brand
690052e1c2 Call setUserJID when we get JID from credentials_url 2019-06-06 13:41:52 +02:00
JC Brand
789b47ddb3 Bugfix. Don't create view for chat which fails validation
Use-case is when an invalid MUC gets opened in singleton mode.
Without this fix a new chat with spinner appears, even though it
shouldn't.
2019-06-06 08:34:56 +02:00
JC Brand
a656750459 Only fetch presences when we're resuming an existing session.
updates #555
2019-06-05 11:47:23 +02:00
JC Brand
a7184fab41 Bugfix. Need to wait for setUserJID 2019-06-05 11:38:14 +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
01fce55733 Add prettierx and tentatively use it for some formatting
I'm using prettierx, which is a fork of prettier so that we can have
spaces before the brackets in a function declaration.

I don't like how restrictive prettier is concerning its configuration
and formatting.

- it messes up some indentation in specs/
- it removes a second newline when I specifically want to have two
- it doesn't allow spaces before brackets in function declarations (hence prettierx)
- it adds spaces for function parameters with default values

None of this is configurable.

So auto-formatting is not turned on by default, but it might be a useful
tool in some cases.

Fixes an issue where indentation was off in converse-core.js, causing
vim-sleuth to wrongly indent by three spaces only.
2019-06-05 10:25:31 +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
51f2ab9100 Fixes #1196. Use alternative connection method upon connfail 2019-06-04 15:11:32 +02:00
JC Brand
297f3d9efb The list of core plugins doesn't have to be an attribute of _converse 2019-06-04 14:27:25 +02:00
JC Brand
b128286410 Don't disconnect MUC on unload when using SMACKS
updates #1111
2019-06-04 11:12:22 +02:00
JC Brand
1d9bbb8ddd Message display improvements
* Checkmark and edit modal button are now on the right
* Instead of showing checkmarks for MUC messages,
  we now show them as light grey before MUC reflection
* Simplify message markup by requiring less `if` statements
2019-06-04 11:12:22 +02:00
JC Brand
f2ac9ef4d7 converse-muc: Support for XEP-0410 to check whether we're joined 2019-06-03 11:41:34 +02:00