Commit Graph

258 Commits

Author SHA1 Message Date
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
JC Brand
6506d4745a Call initialized event once everything in core has been set up 2016-03-16 13:50:35 +00:00
JC Brand
2173359718 Set dataType JSON of ajax request of prebind_url 2016-03-16 12:56:11 +00:00
JC Brand
e461b22ff9 disconnect and reset before attempting to reconnect. 2016-03-16 12:44:59 +00:00
JC Brand
08222182c5 Move VCard functionality into separate plugin 2016-03-16 11:21:27 +00:00
JC Brand
2fa39f2150 Move dependencies to the plugins that actually use them 2016-03-16 09:02:12 +00:00
JC Brand
3fd2225fae Don't try to restore if rid, jid and sid are passed in.
Fixes an issue whereby those tokens are passed in but not used and instead
converse attempts to restore the session (and then totally ignores the tokens
when it fails).

Makes sense to me that you'd want your passed in tokens to be used always, even
when there are restorable tokens.
2016-03-15 18:09:50 +00:00
JC Brand
80c26e708c Add new option strict_plugin_dependencies 2016-03-14 17:03:48 +00:00
JC Brand
9d9f64b2c3 declare namespace in relevant plugin 2016-03-14 16:46:04 +00:00
JC Brand
7039dbe01b Move chat minimization to a separate plugin 2016-03-14 16:38:43 +00:00
JC Brand
fc251db59e Let MUC plugin override the chatbox wrapper. 2016-03-14 16:02:43 +00:00
JC Brand
82107c0d96 Don't ever remove the _super obj 2016-03-14 15:59:33 +00:00
JC Brand
1676258c38 Move the MAM features to a separate plugin. 2016-03-14 14:04:36 +00:00
JC Brand
df3bcad0b3 Move roster view code into a separate plugin 2016-03-14 14:04:36 +00:00
JC Brand
fe47773c7f Move ChatView into separate plugin. 2016-03-14 14:04:36 +00:00
JC Brand
a1b31cd1ed Initial work on adding support for headline messages. 2016-03-14 14:04:31 +00:00
JC Brand
8b459c68b1 Call trimChats in the show method of the box view
Not in the onAdded handler.
2016-03-09 11:03:06 +00:00
JC Brand
d192b34919 onChatBoxFetched renamed to onChatBoxesFetched 2016-03-09 10:54:50 +00:00
JC Brand
6eb08bd42f Bugfix. show method must be debounced per instance
Otherwise it gets debounced for multiple instances and certain chat boxes will
then not get shown.
2016-03-09 10:53:39 +00:00
JC Brand
d893d9782a Improvement in when trimChats gets called
Don't call trimChats when the box is minimized or maximized, instead call it
only when the minimized chats toggle appears or disappears, since that's the
element that adds/removes space.

Also, a fix. 'onShow' has been renamed to 'onMaximized'
2016-03-09 10:26:14 +00:00
JC Brand
8b30c60592 Call minimize() not hide() when minimizing 2016-03-09 10:00:28 +00:00
JC Brand
ce9008a56a Rename onShow to onMaximized and add onMinimized 2016-03-09 09:59:25 +00:00
JC Brand
7b2f75ec72 Updated trimChats slightly. 2016-03-09 09:58:22 +00:00
JC Brand
2dbe2fc5a3 Bugfix. Need to set the context when calling a _super method 2016-03-09 08:39:04 +00:00
JC Brand
c793b846fb Only ask for permission once the user is already logged in
updates #443
2016-03-08 22:36:13 +00:00
JC Brand
550f7827bf Bugfix. Contact wasn't being sent. updates #443 2016-03-08 12:11:35 +00:00
JC Brand
0aa0c02124 Add tests for src/converse-notification.js. updates #443
In the process refactored the code being tested.

- Move notifications code in MUC to src/converse-notification.js
- Trigger the 'contactStatusChanged' event in RosterContact and not in
  ChatBoxView (which might not exist).
2016-03-08 10:44:27 +00:00
JC Brand
fd0c9cecb7 Log the err and call with null, then return. 2016-03-07 17:26:31 +00:00
JC Brand
efa4a9ff23 Fixes #577 Add a timeout config var for MAM 2016-03-07 17:16:57 +00:00
JC Brand
c2212833a1 Fixes #607, view.model is undefined. 2016-03-07 14:29:45 +00:00
JC Brand
23a1dc4f2b Some fixes concerning event emitting.
Don't make the event "this" context the protected converse object.
Can't trigger multiple data parameters, need to pass an object if there are
multiple values to be sent.
2016-03-01 22:39:45 +00:00
JC Brand
f7725943f8 Emit an event 'contactRequest' when a subscription request is received 2016-03-01 21:57:49 +00:00
JC Brand
26cb98d963 Move playing of sounds to the notification plugin.
Also add a config setting for the icon shown in HTML5 notificatins.

updates #443
2016-03-01 08:58:36 +00:00
JC Brand
14c66ff755 Also show HTML5 notifications for chat state changes.
updates #443
2016-02-29 21:59:56 +00:00
JC Brand
578ca540b3 Move RosterContact and RosterContacts back into core.
They're independent of the controlbox and used by other core functions.
2016-02-29 21:29:05 +00:00
JC Brand
cd731ed699 Some refactoring to make plugins easier.
- Refactored sound notification to make it a bit more generic
- Split up onMessage
2016-02-29 20:54:34 +00:00
JC Brand
4ebed3c995 We still need the roster in core, so set it there.
Still have to move the roster code out of src/converse-controlbox.js
2016-02-29 20:05:01 +00:00
JC Brand
9fb1c2383e Bugfix. Restore code to get locale from browser. 2016-02-29 20:03:45 +00:00
JC Brand
dcd090ff31 Rip out the controlbox code and put it in src/converse-controlbox.js
Also fixed an issue w.r.t the plugin architecture. Previously infinite
recursion would happen when more than one plugin was overriding a method.

Resolved now by using a wrapper function that lazily sets the correct super
method.
2016-02-29 16:40:51 +00:00
JC Brand
9ae2f71747 Found more chatroom specific code in converse-core.js 2016-02-29 16:40:51 +00:00
JC Brand
9f9b38f852 Some i18n fixes
The __ translate method should only be run *after* converse.js has been
initialized and we know what the actual desired language is

Also fix bug in src/locales.js where wrong langs were assigned to wrong keys.
2016-02-28 08:45:36 +00:00
JC Brand
e68c51d2fa Explicitly list dependencies for modules
Instead of using the deps-*.js files. Builds will currently break, they still
need to be reworked.

Also moved the refreshWebkit method to utils.
2016-02-23 07:15:37 +00:00
JC Brand
e79c204241 Refactor the API out into a separate module, src/convers-api.js
Plugins are now also updated so that they can get the closured converse object
directly and don't need to rely on _super.
2016-02-20 15:06:12 +00:00
JC Brand
8bf8c318aa Merge pull request #600 from davec82/master
change xmpp status also on icon-status click
2016-02-20 10:22:41 +01:00
JC Brand
f371b62157 Move XMPP Ping code to a plugin. 2016-02-19 13:02:31 +00:00
Davide Colombo
cde205f673 fix change xmpp status also on icon-status click 2016-02-19 12:49:02 +01:00
JC Brand
cb241dd594 Moved all the registration code into a plugin 2016-02-19 10:43:46 +00:00
JC Brand
147a3c9e3e Found more MUC stuff in core.
Move the Occupants views and models to converse-muc.js as well as some
MUC-specific config variables.
2016-02-19 09:45:24 +00:00
Davide Colombo
e934917685 add synchronize_availability option 2016-02-18 12:18:56 +01:00
JC Brand
8c06f917ae Restore @rlanvin's changes that were lost during merge
Fixes #596
2016-02-17 17:09:48 +00:00
Davide Colombo
2e50ecb9c1 add method to generate random resource and add random resource also for auto_login 2016-02-16 15:29:13 +01:00
JC Brand
a687e87e01 Remove deprecated API and update changelog. 2016-02-16 07:50:52 +00:00
JC Brand
da0c858fe0 Used debounce ineffectually. Fixed now.
The ChatBox.show() method was being called for every invocation, 100ms after
the fact, instead of it being called only once.

Fixed that and also changed to call it at the start.
2016-02-16 07:47:16 +00:00
JC Brand
e94904e4a1 Don't play sound notifications for...
OTR messages which are setting up an encrypted session.
2016-02-16 07:47:16 +00:00
JC Brand
9eba9989dc OTR stuff has been moved to a component/plugin in src/converse-otr.js
Also fixed errors with converse obj not being defined in the MUC plugin.
2016-02-16 07:47:16 +00:00
JC Brand
576efc4815 Initial work on breaking converse.js up into components
First component to remove is MUC which was moved to src/converse-muc.js
The components are written as plugins and use converse.js's plugin machinery.

Update the plugin docs somewhat with new insites found while working on the muc
plugin.
2016-02-16 07:47:08 +00:00