Commit Graph

258 Commits

Author SHA1 Message Date
JC Brand
4aa123d557 Add timestamps to resources
So that when a higher priority resource goes offline, we can fall back to the
right chat status if at the next priority level there are multiple resources.

789654d54e (comments)
2017-02-21 22:15:08 +01:00
JC Brand
728c7622e9 Use composition instead of chaining 2017-02-21 09:50:44 +01:00
JC Brand
d79bfe6f28 Use composition instead of chaining. 2017-02-21 09:35:50 +01:00
JC Brand
7ae2e46925 Expand tests and found a bug in the process.
updates #785
2017-02-20 22:37:06 +01:00
JC Brand
789654d54e Updates #785 and #787
Improve upon the previous implementation.

If the resource with the highest priority goes offline or becomes unavailable,
then the chat status of the contact must fall back to that of the resource with
the next highest priority.

In your example from #785, if the resource with priority 1 goes offline or
becomes unavailable, then in your implementation the chat status would stay at
online, although it must actually go to xa.

The solution is to update the resources attribute on the contact to not just be
an array or strings, but instead to be a map of resources to priorities and
statuses and to use that data structure.
2017-02-20 22:29:13 +01:00
w3host
15d2640c43 Presence priority NOT handled correctly #785 (#787) 2017-02-20 20:48:09 +01:00
JC Brand
61bee4c263 The Strophe.Connection obj needs to be reset before reuse.
Otherwise re-login hangs after authfail.
2017-02-18 09:46:33 +00:00
JC Brand
33cc2c3cf5 Remove #BBB code for the deprecated prebind option
replaced with the `authentication` option
2017-02-18 09:35:16 +00:00
JC Brand
a1c156456d Make keepalive and roster_groups true by default. 2017-02-17 08:54:58 +01:00
JC Brand
bc8e3e1a01 Return a Backbone.View object instead of a wrapper
When returning chat boxes via the API.

We can do this now because these API methods are only available to
(whitelisted) plugins.
2017-02-14 15:10:46 +00:00
JC Brand
fe6a9ca748 Merge converse-api and converse-core
Otherwise `require('converse-core')` can be called, exposing the inner converse
object.
2017-02-14 14:35:52 +00:00
JC Brand
994c961d9c Add a waitUntil API for promises. 2017-02-14 11:24:20 +01:00
JC Brand
d334870d00 Render the login form again upon authfail. 2017-02-13 15:23:26 +00:00
JC Brand
48a3c30e75 i18n locale can now be specified with only the language code 2017-02-13 15:16:16 +00:00
JC Brand
f73a1d3fc0 Don't name the modules.
According to the require.js docs this shouldn't be done.
http://requirejs.org/docs/whyamd.html#namedmodules
2017-02-13 14:37:17 +00:00
JC Brand
acf0e19d99 Fixes #774 2017-02-13 14:20:16 +00:00
JC Brand
7ad555d97f Correct rev for pluggable.js.
Don't include muc-embedded by default
2017-02-04 09:32:24 +00:00
JC Brand
ebbde138db Add the ability to whitelist/blacklist plugins. 2017-02-03 18:26:27 +00:00
JC Brand
63888dd454 Fix failing tests 2017-02-02 21:55:05 +00:00
JC Brand
761970c903 Update plugins to not depend on converse-core
To illustrate that this is not necessary (and also not possible with
non-bundled plugins).
2017-02-02 20:50:52 +00:00
JC Brand
0424df9edc Rename the closured converse object to _converse
to indicate that it's private and to differentiate it from the outer "global"
converse object.
2017-02-02 20:43:48 +00:00
JC Brand
7c15e2f179 Some initial work on removing jQuery 2017-02-02 19:42:01 +00:00
JC Brand
9b48b2d6bd Update plugins to not depend on converse-core
To illustrate that this is not necessary (and also not possible with
non-bundled plugins).
2017-02-02 18:34:13 +00:00
JC Brand
b701c4830f Also use _converse as pluggable object reference. 2017-02-02 18:34:13 +00:00
JC Brand
b7b9711296 Rename the closured converse object to _converse
to indicate that it's private and to differentiate it from the outer "global"
converse object.
2017-02-02 18:34:13 +00:00
JC Brand
647ee1ff04 Replace jQuery-based event emitter with Backbone.Events 2017-02-02 18:30:43 +00:00
JC Brand
4b22c8ba7b Use sizzle for tricky selector queries
Specifically involving querying by the 'xmlns' attribute, where I've had issues
in the past.
2017-02-02 18:30:08 +00:00
JC Brand
77f93a6471 Some initial work on removing jQuery 2017-02-02 18:30:08 +00:00
JC Brand
46e231b4b3 Emit 'will-reconnect' event 2017-02-01 17:36:20 +00:00
JC Brand
65852f4e7c Remove what appear to be unnecessary calls 2017-02-01 17:08:36 +00:00
JC Brand
60f86378a4 Handle reconnection on authfail edge case.
Attempt reconnection on authfail when credentials_url and auto_reconnect are set.
2017-02-01 16:34:38 +00:00
JC Brand
8ef7461627 Simplify the onDisconnected method. Add some docstrings.
Let debounced reconnection happen on the leading edge.
2017-02-01 16:24:28 +00:00
JC Brand
081f075aa9 Add eslint with lodash checking and apply its suggestions 2017-02-01 14:02:18 +01:00
Richard Icke
343e5777d1 first attempt to replace underscore with lodash 2017-02-01 14:00:38 +01:00
JC Brand
25d9880f9e Add config setting allow_non_roster_messaging
- Add a test case.
- Don't allow passing of `attrs` to `chats.open`. Not sure yet of the
  implications of this.
2017-02-01 10:49:13 +00:00
Lauri Niskanen
246edf8a66 Allow chatting with users not in roster
Resolves #760.
2017-02-01 10:49:13 +00:00
JC Brand
e81eaf323e Prevent forging of messages via carbons. 2017-02-01 10:49:13 +00:00
JC Brand
0cf9903726 Fix failing tests. 2017-02-01 10:49:13 +00:00
JC Brand
d96bc6ebe4 Avoid sending 'auth fail' feedback twice. 2017-02-01 10:49:12 +00:00
JC Brand
af42bc0696 Only close controlbox when logging out
Not when the connection failed due to other reasons (like wrong credentials).
2017-02-01 10:49:12 +00:00
JC Brand
c1662c6339 Properly disconnect upon "host-unknown" error. 2017-02-01 10:49:12 +00:00
JC Brand
25e570c7ed Bugfix. connection.reset should only be called after disconnected 2017-02-01 10:49:12 +00:00
JC Brand
8cdadca492 Bugfix. Login form wasn't rendered after logging out
when `auto_reconnect` is set to true.
2017-01-31 19:32:12 +00:00
JC Brand
d6b5ed5e1e Handle case where locales is not defined. 2017-01-16 22:07:58 +01:00
JC Brand
008c07596a converse-core: Call _tearDown when initialized again
When it's clear that a previous teardown didn't happen.
So that objects can be garbage collected and that obsolete event handlers don't
fire anymore.
2016-12-06 11:07:52 +00:00
JC Brand
59ad285823 converse-core: cause can sometimes be DISCONNECTING 2016-12-05 15:22:47 +00:00
JC Brand
376c50fbc8 When inviting to a members-only room, first add to user to the member-list 2016-12-05 15:06:20 +00:00
JC Brand
e179811181 converse-controlbox: Fix empty controlbox toggle after disconnect
- Remove apparently unused `giveFeedback` method on ControlBoxView
- Don't show old connection feedback when rendering a new login form.
  Now also no need to explicitly remove feedback after disconnection.
2016-12-04 16:37:07 +00:00
JC Brand
f0a454561b converse-core: Properly disconnect if reconnection attempt fails. 2016-12-04 15:00:46 +00:00
JC Brand
3b3720c32d converse-core: Attempt to log in again when reconnecting
and when auto_login is not `true`. Will only work if the page wasn't reloaded,
because then the password will still be on the connection.
2016-12-04 14:14:40 +00:00
JC Brand
0b22b5a6e0 Emit a reconnecting event. 2016-11-23 14:50:28 +00:00
JC Brand
bfde4d3e4c Reconnection fixes.
- Reconnection failed if original connection was never established
- When the `credentials_url` is specified, keep on trying to reconnect.
2016-11-23 11:53:06 +00:00
JC Brand
e90632d6fd Bugfix. No roster when reconnecting. 2016-11-23 10:24:33 +00:00
JC Brand
06cbd5cdd0 Use the chats_panel.html template in converse-minimize.js
To which it's actually applicable (instead of core).
2016-11-22 17:39:36 +01:00
JC Brand
586bbd0e4d Bugfix. First configure browserStorage for ChatBoxes
before populating the roster.
2016-11-22 09:35:36 +00:00
JC Brand
3b38f7237c Bugfix. Chatboxes aren't closed when logging out. 2016-11-22 09:12:39 +00:00
JC Brand
9bf00241de Updates #721 Restore sessions when logging in anonymously
together with keepalive.
2016-11-07 18:48:49 +01:00
JC Brand
3e4095734b Call _tearDown when logging out.
This is necessary for cleaning up after tests (now that each test has its own
initialized converse).

Should hopefully not cause any issues when logging out during normal use.
2016-11-03 13:59:05 +00:00
JC Brand
50275cce64 Remove shared state between tests
Only a small subset of tests currently working with this.
2016-11-03 13:59:05 +00:00
JC Brand
d3090f80bc Remember which panel was open when reloading the page. 2016-11-02 22:08:20 +00:00
JC Brand
38db959e11 Reconnection fixes. Fixes #712
- Remove groupviews, so that they'll get recreated upon reconnection
- Don't call `clearSession` when reconnecting. We want to reuse the
  Backbone collections.
- Emit `rosterInitialized` event and use that in converse-rosterview.js
  (instead of overriding).
- Refactor `onReconnected` to emit `rosterReadyAfterReconnection`, call
  `converse.populateRoster()` and `converse.chatboxes.onConnected()`.
- Recreate the roster view on the `rosterReadyAfterReconnection` event.
2016-11-02 13:13:49 +00:00
JC Brand
0d4993ef86 Merge branch 'master' of github.com:jcbrand/converse.js 2016-11-02 13:13:34 +00:00
JC Brand
e3d59afd80 Use converse instead of this, or that instead of bind 2016-11-02 12:46:29 +00:00
JC Brand
e63853ee92 Add a logout event.
updates #714
2016-11-02 08:42:24 +01:00
JC Brand
6f1ac50893 Move leaky MUC abstractions out of converse-chatview.js
In the process also updated `updateSettings` to allow merging.
2016-10-27 14:56:31 +02:00
JC Brand
1b264461d7 Bugfix. Return after disconnection 2016-10-27 10:58:51 +00:00
JC Brand
01c3a50cc2 Add code to generically and recursively update user settings.
Also moved chatview specific settings.
2016-10-26 14:14:49 +02:00
JC Brand
a51d503ea5 Remove invalid comment 2016-10-20 12:31:15 +00:00
JC Brand
0fe4031a1b Close all chat boxes when disconnected (with no reconnection attempt) 2016-10-18 11:34:46 +02:00
JC Brand
4b28f3f803 Bookmarks fixes.
- Remove bookmark from list when removed from collection
- Only render list after all bookmarks have been fetched
- Properly remove bookmarks from sessionStorage
2016-10-17 11:20:20 +02:00
JC Brand
5a3917925e Add a new configuration setting: connection_options
Allows you to pass in options for the `Strophe.Connection` constructor.
2016-10-12 14:16:34 +02:00
JC Brand
6972066076 Bookmarked rooms will now be automatically opened
If configured for it.
2016-10-05 23:15:42 +02:00
JC Brand
052dd19252 Initial work on adding chatroom bookmarks. 2016-10-05 23:15:42 +02:00
JC Brand
fa4e51f3ba Handle undefined settings being passed in. 2016-09-30 10:42:15 +02:00
JC Brand
90d1071df0 Load templates in the respective plugins 2016-09-23 12:35:01 +02:00
JC Brand
ab76f1da44 Let core populated the roster, and send the initial presence
This allows for cleaner separation between core and rosterview, making it
easier to remove that plugin for more stripped down deployments.
2016-09-21 15:06:48 +02:00
JC Brand
ac2c5f3e4e Allow the context to be passed in when registering event listeners
Similar to how backbone.js does it.
2016-09-21 13:15:45 +02:00
JC Brand
05a577059b Use converse instead of this, to be more explicit. 2016-09-21 11:48:53 +02:00
JC Brand
7030495275 Refactor the rosterview.fetch method
So that we can also fetch the roster also without the controlbox and rosterview.
2016-09-20 17:38:01 +02:00
JC Brand
713922a9e1 Update to Strophe 1.2.8 and add support for SASL-EXTERNAL auth 2016-09-16 13:06:52 +02:00
JC Brand
89e5bd7c54 Update to pluggable.js 0.0.2 2016-08-31 10:39:11 +00:00
JC Brand
66c7c41888 Emit 'roster' event after updating contacts 2016-08-31 09:59:54 +00:00
JC Brand
3c9b5bd7a0 More work on session management.
When it's not possible to reconnect due to password no longer being cached,
render the login form.

Fixed a bug whereby after one failed reconnection event, reconnection becomes
impossible (due to 'connection' state of the controlbox).
2016-08-23 18:14:09 +00:00
JC Brand
c6d37b57e7 Ability to specify both subject and message for feedback messages
This allows for better desktop notification messages.
Also improved the wording for some of the feedback messages.
2016-08-23 08:00:41 +00:00
JC Brand
814845e879 Provide a nicer notification when reconnecting
after a dropped connection.
2016-08-21 11:17:06 +00:00
JC Brand
b8aaf751d2 Changes concerning caching of data in the browser.
- Add new configuration setting messages_storage
- Hardcode the storage for roster contacts and chatroom occupants to `sessionStorage`.
2016-08-21 10:55:45 +00:00
JC Brand
95a0b91afa Update 'rooms' api to allow user to pass in room attributes. 2016-08-19 17:16:36 +02:00
JC Brand
1ee7d06a08 Further document the auto_reconnect option
and drop the reconnection timeout to 3 seconds (from 5).
2016-08-19 14:11:37 +00:00
JC Brand
59143c1c72 More work on auto-reconnecting and on maintaining sessions.
- Added the ability to reconnect to more disconnection causes.
- Make sure the roster is fetched again when reconnecting.
2016-08-19 12:16:55 +00:00
JC Brand
4d28ae3c11 Tweak timeouts regarding status notifications.
Send a <paused/> notification after 10 seconds, instead of 20.
Auto-remove a typing notification in the chat box after 20 secs instead of 10.

This is to avoid situations where the status notification gets
auto-removed while the typer keeps on typing without long enough breaks in
between for <pause/> states, thereby causing the recipient to not be aware that
they're still typing.
2016-08-18 09:28:48 +00:00
JC Brand
6ac4f2601d Fixes #677 Chatbox does not open after close
Problem was a race condition between hide and show methods.
Solution was to not hide the chat box during the initialize method.
2016-08-12 20:38:39 +00:00
JC Brand
4402798dcd Don't add resources from message stanzas. Fixes #632
For each user we keep a list of currently online resources. These resources
were taken from both presence and message stanzas.

Receiving a message doesn't however indicate that the user is online,
especially in the case of archived messages.

This also abused the semantics of messages, which are meant to indicate
user presence.
2016-08-12 19:45:47 +00:00
JC Brand
cd46e96783 Converse.js's plugin architecture has been moved to a separate repo
See https://github.com/jcbrand/pluggable.js
2016-08-11 14:05:25 +00:00
JC Brand
88d2142501 Minor improvements around anonymous login.
You can now provide the JID of the server either via `converse.initialize` or
via `converse.user.login`.
2016-07-24 10:54:57 +02:00
JC Brand
0c393cf286 Move some utility methods to utils.js 2016-07-18 11:41:31 +00:00
JC Brand
5ed8dfbe0a Get chat box views by id
Fixes bug when fetching controlbox, which doesn't have a jid
2016-07-05 07:43:34 +02:00
JC Brand
e06a34a905 Some initial work on show messages with type "error" 2016-06-22 18:47:07 +02:00
JC Brand
081d377881 Move code from plugins to core.
Move init of RosterGroups collection and presenceHandler registration out of
the controlbox and rosterview plugins and into core, since this code is
generally useful (indeed necessary) even without those plugins.
2016-06-22 10:25:01 +00:00
JC Brand
7f753040de Move roster-related models/collections to core 2016-06-21 17:36:40 +00:00
JC Brand
705c043852 Fixes concerning tab visibility 2016-06-17 09:30:47 +00:00