Commit Graph

405 Commits

Author SHA1 Message Date
JC Brand
53643ab541 core: Close chats when logging out, before disconnecting
Otherwise rooms cannot be exited properly.

Also, no need to call `_tearDown` in `logOut` when `connection.disconnect` gets
called since it will get called afterwards in the handler.
2017-06-23 18:21:00 +02:00
JC Brand
796edb03fe Updates #890. Make sure to clear session data
Otherwise carbons aren't re-enabled after reconnection.
2017-06-16 14:55:40 +02:00
JC Brand
f09d01c930 roster: Move roster push and rosterX handlers to core.
There's nothing about them that's view specific.
2017-06-16 11:42:46 +02:00
JC Brand
d527f693c2 Updates #890 Destroy and recreate session upon reconnection
This ensures that carbons will be activated again.
2017-06-15 17:30:26 +02:00
JC Brand
1f82b7dfe4 Create utils method isSameBareJID. Refs: #894 2017-06-14 22:31:44 +02:00
JC Brand
c9ecd3cd4d Only initiate OTR for new messages. 2017-06-14 19:43:02 +02:00
JC Brand
41bb8b5da7 Make `converse-roomslist` a core (i.e. by default whitelisted) plugin 2017-06-14 10:49:21 +02:00
JC Brand
b5ecc1fc6a Expose the fp version of lodash via the API 2017-06-07 09:15:22 +02:00
JC Brand
a128a70d41 Discriminate between which unread messages to indicate per tab 2017-06-07 00:55:57 +02:00
JC Brand
5e783e70e4 Lay the groundwork for being able to have separate ChatRoom models 2017-05-23 18:16:47 +02:00
JC Brand
4f94a1f193 Refactor code that increments unread messages counter
Removed the "fetching_messages" hack.
2017-05-16 11:18:58 +02:00
JC Brand
c5383ac22f chatview: trigger 'add' event when fetching messages
Otherwise they don't appear when reloading the page.

I'm not completely happy with the resulting workaround to avoid that messages
restored from sessionStorage increment the unread messages counter, but it'll
have to do for now.
2017-05-15 18:37:54 +02:00
JC Brand
4994615824 core: Only throw error when trying keepalive without JID for prebind 2017-05-15 16:47:10 +02:00
JC Brand
ea207ad6be Don't override credentials_url password with connection password
Causes login failure when one-time tokens are used.
2017-05-11 14:46:24 +02:00
JC Brand
7eecd6b1dd Move method closer to other relevant ones 2017-05-11 10:42:10 +02:00
JC Brand
0c61a5d791 core: Refactor common code into restoreBOSHSession 2017-05-11 10:42:10 +02:00
JC Brand
d50992b130 bookmarks: Fix remaining broken tests. 2017-05-09 09:45:12 +02:00
JC Brand
0bd0798e34 Use the Backbone defaults functionality 2017-05-08 21:28:56 +02:00
Novokreshchenov Konstantin
7c057910a8 Inconsistent unread messages count updating #873 (#874)
* Consistent unread messages count updating on ChatBoxView, Minimized ChatBoxView, RosterView and page's title

* Add tests for checking unread messages count updates in different GUI parts

* Update docs/CHANGES.md

* document windowStateChanged event in events.rst
2017-05-03 09:06:28 +02:00
JC Brand
15f962ad6d Add converse-singleton to the mobile build.
This will make the unread messages feature work.
Update so that new chats are opened in the background.
2017-04-24 15:57:23 +02:00
JC Brand
c81599931c Fix failing tests based on recent unread message changes 2017-04-24 15:57:22 +02:00
JC Brand
f3d29e016e Show unread messages counter next to roster contacts 2017-04-24 15:57:22 +02:00
JC Brand
f3373c44fd Fixes #850. .where method doesn't match numbers. 2017-04-21 18:06:28 +02:00
JC Brand
3ea43c6a0f Use noConflict to avoid polluting globale namespace
with lodash and Backbone.
2017-04-21 18:06:27 +02:00
JC Brand
f0deac9ec5 Updates #849
Refactor locales code to store the currently chosen locale as
`_converse.locale` and use that in converse-notifications.js
2017-04-19 14:37:52 +02:00
JC Brand
d781ebfd37 converse-core: More work on removing jQuery.
Only $.Deferred is still being used in converse-core.
2017-04-11 09:14:26 +00:00
JC Brand
3d2bfb5c8b converse-core: Use built-in XHR instead of $.ajax 2017-04-11 08:33:56 +00:00
JC Brand
a4be25e05c Fix time format to show seconds instead of month 2017-03-31 02:01:53 +00:00
JC Brand
9fc61d9302 Bugfix. Endless spinner when trying to log in
after rendering the registration form.
2017-03-31 01:54:42 +00:00
JC Brand
d3a8032f61 Fixes #811. jQuery wasn't being closured in builds. 2017-03-31 00:06:57 +00:00
Anshul Singhal
99647438ac Adds the send button at bottom of chatbox (#796)
Fixes #796 New config option: `show_send_button`

* Adds show_send_button setting to docs

* Change log updated

* Improves send button CSS, style fixes and documentation corrections

* Adds missing setting in rendering template for headlines
2017-03-30 12:40:17 +02:00
Soumit Bose
e6f3406977 Implemented auto fetching of registration form for default XMPP domain (#812) 2017-03-20 13:21:03 +01:00
Soumit Bose
2c5ecd7120 Make messages' time format configurable (#797)
Fixes #675 

* Made time format configurable

* Made changes to values of time_format

* Removed user restrictions on time format

* Added documentation for time-format config

* Edited changes.md

* Edited config doc

* Modified time-format explanation

* Added link to moment

* Added test to check rendered time

* Edited CHANGES and removeunncessary lines from time format checking spec

* Removed unncessary spaces
2017-03-12 11:32:38 +01:00
Anshul Singhal
40da1d688e Fixes #628. Bug in displaying chat status during private chat with carbons. (PR #801)
* Fixes the bug in displaying chat status during private chat(message carbons)

* Adds fix#628 to ChangeLog

* Changes Log added to version 3.0.1

* Makes the string alphanumeric

* Orders the logs with ticket number
2017-03-09 12:38:54 +01:00
Anshul Singhal
3dd6ff1751 Fixes the duplication bug in adding contact and adds test for the same 2017-03-08 15:33:43 +01:00
JC Brand
5efb7fbf82 Fixes #806 Event listeners not triggered.
Functions need to be bound.
2017-03-08 11:54:23 +00:00
JC Brand
5fc6ab1e4e Move plugin init code into method 2017-03-07 12:05:04 +01:00
JC Brand
c58348dd02 Emit the original message, not just the forwarded part
Otherwise we receive HTML5 notifications for MAM messages because they can't be
identified as such.
2017-03-01 10:37:07 +00:00
JC Brand
a3407bb98b Move MAM specific code to converse-mam.js 2017-02-28 22:34:04 +01:00
JC Brand
bccdedc64f Also show a hint explaining the roomchat status 2017-02-28 06:52:33 +01:00
JC Brand
cfb0cd0970 New defaults 2017-02-27 10:41:46 +00:00
JC Brand
f60b4fc268 auto_away shouldn't change the user's status if it's set to dnd
Fixes #620
2017-02-25 09:52:31 +00:00
JC Brand
adb4f62ea9 Fixes #790 mam retrieval broken 2017-02-25 09:54:41 +01:00
JC Brand
305559a85c Use sizzle in converse-muc.js 2017-02-24 12:00:05 +00:00
JC Brand
8a63813f5e Add the ability to set the presence priority.
Fixes #745
2017-02-22 22:13:23 +01:00
JC Brand
17e0e70e4e Support for XEP-0203 delayed delivery of presence stanzas 2017-02-21 23:30:11 +01:00
JC Brand
40605607e6 Specify radix for parseInt 2017-02-21 22:17:05 +01:00
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
JC Brand
10ca2900d4 Add a "create" parameter to rooms.get
to indicate whether the room should be created if not found.
2016-06-17 09:30:31 +00:00
JC Brand
95c5f9d420 Better support for checking whether the page is visible or not. 2016-06-16 16:14:22 +00:00
JC Brand
e12c165454 Add new event pluginsInitialized and use it in converse-notifications
By listening for this event before registering event handlers, other plugins
can first get their overrides of those handlers applied.
2016-06-16 17:21:49 +02:00
JC Brand
1bf8b80cec Refactored converse-pluggable to remove all deferreds
by not attempting to load `optional_dependencies` via require.js.

Instead, we just expect them to be plugins and to have been loaded already.
2016-06-10 08:26:38 +00:00
JC Brand
454f8ef034 Let converse.initialize return a deferred
and use that in the tests, instead of a callback.
2016-06-10 08:26:38 +00:00
JC Brand
62c170273e Allow plugins to have optional dependencies.
This change refactors out the plugin code from converse-core into
src/converse-puggable.js

Additionally, plugins now have an optional attribute `optional_dependencies`
which is an array of dependencies which are "nice-to-have" but not essential.

Work has also been done to ensure that a plugins' dependencies are first loaded
before the plugin itself.
2016-06-10 08:26:29 +00:00
JC Brand
eb3252542e Split showChat into two methods to allow easier overriding. 2016-06-06 07:50:10 +00:00
JC Brand
5b80d67a98 Return before trying to extend the object
when strict_plugin_dependencies is set to `false`.
2016-06-03 19:25:09 +02:00
JC Brand
f60a0512d9 Emit an event when the roster is fetched from the cache
We already emit an event when the roster is fetched from the XMPP server,
similarly, it would be useful to know when the roster was instead fetched from
the cache.
2016-06-01 16:04:06 +00:00
JC Brand
f9528e7144 Pass the jid to restore
if it's defined, then we want the extra check that the jids match, otherwise
we might be attaching to someone else's session.
2016-05-31 12:25:09 +00:00
JC Brand
0002c0bd53 converse._tearDown shouldn't be called from converse-controlbox.js 2016-05-31 10:24:22 +00:00
JC Brand
7398d41405 Some improvements to constructPresence
Don't <show> 'offline'.
Only include status_message when explicitly passed in as a string.
2016-05-31 09:40:18 +00:00
JC Brand
f70a3c3ed2 Add new configuration variable: default_state 2016-05-31 09:37:42 +00:00
JC Brand
6bfcce5fcb Don't ignore incoming messages from current JID
they might be MAM archived messages.

Fixes #650
2016-05-30 17:30:14 +00:00
JC Brand
2b88db812d Don't show "new messages" indicator for archived messages 2016-05-30 17:18:07 +00:00
JC Brand
bd23a7751a Add processing hints to OTR messages
so that they're not stored in MAM and not forwarded.

updates #553
2016-05-30 16:52:26 +00:00
JC Brand
5993fba1d4 Fix MAM issue. Messages weren't being queried for properly
because the archive ids of messages weren't being stored.
2016-05-30 16:19:05 +00:00
JC Brand
c738d085c4 Indicate to the user when there are unread messages
further down in the chat box.
2016-05-28 10:07:11 +00:00
JC Brand
82ee7f694e Don't ignore messages sent to different resource
But make this behavior configurable. Updates #647
2016-05-28 06:36:24 +00:00
Kamran
b82e0f3136 Fix for issue #648 (#649)
* Updated onDisconnected method to fire disconnected event. Issue #648

* Updated docs/CHANGES.md
2016-05-28 00:31:58 +02:00
JC Brand
e923fbf2d1 Set i18n to empty obj in cases where there's no locales
This lets variable interpolation still work (if Jed is loaded)
2016-05-26 13:02:53 +02:00
JC Brand
29c2a96481 Bot message doesn't appear when it has the same id as its command 2016-05-25 07:54:58 +00:00
JC Brand
cb288341fb Bugfix. Login form doesn't render after logging out
when auto_reconnect = false
2016-05-24 09:03:41 +00:00
JC Brand
c8e4ae13ea No need to explicitly send unavailable presence, Strophe does it for us. 2016-05-24 08:06:38 +00:00
JC Brand
0d2e49a976 Bugfix. Don't hide the roster filter when it's actually being used
The filter was being hidden if the roster was not big enough to require a
scrollbar, but the roster might not be big enough because the roster is
actually being applied.
2016-05-24 07:58:54 +00:00
JC Brand
a2e465f49f Send presence of type 'unavailable' when logging out. 2016-05-23 09:48:51 +00:00
JC Brand
e0c6626c6f Add deprecation warnings for events that will be removed. 2016-05-23 09:48:26 +00:00
JC Brand
af89109670 Bugfix. Flush connection just after connection.
Solves a weird problem I've encountered with PubSub and Prosody, whereby a
returned HTTP response is not received by the browser. Underlying cause is
still unknown, but is BOSH related and it appears to be that the HTTP request
being responded to by Prosody is no longer open/valid.
2016-05-11 09:10:27 +00:00
JC Brand
218000551d Add the ability to replay transcripts of chat logs. 2016-04-28 14:58:09 +00:00
JC Brand
d2ee62da71 Make sure that there is a valid connection when login API is called
In the process I had to refactor some methods which required the mock
connection of tests to be changed as well.
2016-04-13 15:11:50 +00:00
JC Brand
a969d010cb Don't try to reconnect on auth fail. 2016-04-13 12:09:16 +00:00
JC Brand
e09328df6a Add login API method. 2016-04-13 11:52:28 +00:00
JC Brand
0564f0f592 Handle case were connection is not defined. 2016-04-13 10:09:47 +00:00
JC Brand
aee232421c Properly tear down when logging out or disconnecting.
Remove interval handler and the user activity handler.
Make sure the connection is reset when logging out.
Also removed the reconnectTimeout, instead debounce the reconnect method by 1 second.
2016-04-08 09:02:06 +00:00
JC Brand
94693f2d02 Some refactoring to fix issues with how/when chat rooms are shown
- Don't call show in a room's initialize method (instead let the code be more
  similar to normal chats, in that it should listen to the "show" trigger).
- Rename chatBoxShouldBeShown to chatBoxMayBeShown
- Implement auto_join for rooms only once boxes have been fetched already.
2016-04-05 11:23:16 +00:00
JC Brand
8e0f8f0a6d Add the ability to filter contacts by chat state.
The roster filter is now also remembered across page loads.
2016-04-02 11:30:54 +00:00
JC Brand
885c553e2e Bugfix. Login panel wasn't being rendered after logging out 2016-04-02 03:43:04 +00:00
JC Brand
a6c3b46237 Move the drag-resize code into a separate component. 2016-04-01 12:46:19 +00:00
JC Brand
1fbc7e0f3b Use attemptNonPreboundSession for reconnections.
Fixes reconnects for certain usecases not yet covered.
2016-03-31 13:11:31 +00:00
JC Brand
e0d1a32fdb Attempt to reconnect when authfail happens
and auto_login is true and credentials_url is set.

Trying to handle the case where tokens are used for credentials_url (and the
token is expired).

Not yet 100% happy with this implementation.
2016-03-31 12:32:11 +00:00
JC Brand
6b3fbc9998 Give feedback of error messages via Desktop notifications 2016-03-31 12:25:38 +00:00
JC Brand
2cbf20c6db Add the ability to fetch credentials for auto_login
via the new config option credentials_url
2016-03-31 08:38:43 +00:00
JC Brand
556d264747 Remove "optimization" code no longer used or relevant. 2016-03-29 11:50:50 +00:00
JC Brand
ed4b9a85cc Remove ChatBox views when they get closed.
Previously views were only hidden, but not removed. This was an unnecessary
"optimization" which introduced unnecessary complexity.

Problem solved was that closing minimized chats didn't dereference the model
for hidden "normal" chat views, causing an exception to be raised when trying
to log out.
2016-03-28 12:23:36 +00:00
JC Brand
f353fe8611 Bugfix for headline messages.
Couldn't handle messages with no "from" attribute.
Some refactoring to add code that checks if a messages is a headline to the
utils module.
Updated tests. Add sinon so that we can test returned value of spy.
2016-03-28 10:51:32 +00:00
JC Brand
b3e9a177e2 Merge pull request #617 from lixmal/master
Remove split of fullname. Fixes #609
2016-03-28 10:28:38 +02:00
JC Brand
3aefba3200 Change ping plugin to not have to use overrides.
Had to add a `reconnect` event to core.
2016-03-21 10:00:15 +00:00
JC Brand
82aa9fec2c Support for showing headline messages. 2016-03-21 10:00:10 +00:00
Viktor Liu
ad036ea75f Remove split of fullname. Fixes #609 2016-03-20 01:47:51 +01:00
JC Brand
9a449e3615 comment indentation 2016-03-18 08:49:32 +00:00
JC Brand
a2b8d04d84 Move config settings to the relevant plugins 2016-03-18 08:12:23 +00:00
JC Brand
36a875a402 Add stanza-specific event listener.
Therefore removing the `presence` event again.
2016-03-16 18:12:11 +00:00
JC Brand
1c961ab4d1 Emit an event presence when a presence stanza is received. 2016-03-16 15:59:07 +00:00