Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
d6de627f
Commit
d6de627f
authored
Oct 31, 2017
by
Weblate
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
7ea09337
d3fb9d81
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
12 deletions
+43
-12
docs/source/configuration.rst
docs/source/configuration.rst
+2
-0
docs/source/developer_api.rst
docs/source/developer_api.rst
+35
-8
src/converse-bookmarks.js
src/converse-bookmarks.js
+2
-2
src/converse-core.js
src/converse-core.js
+4
-2
No files found.
docs/source/configuration.rst
View file @
d6de627f
...
...
@@ -169,6 +169,8 @@ Allows users to be invited to join MUC chat rooms. An "Invite" widget will
appear in the sidebar of the chat room where you can type in the JID of a user
to invite into the chat room.
.. _`allow_non_roster_messaging`:
allow_non_roster_messaging
--------------------------
...
...
docs/source/developer_api.rst
View file @
d6de627f
...
...
@@ -681,7 +681,7 @@ Note, for MUC chat rooms, you need to use the "rooms" grouping instead.
get
~~~
Returns an object representing a chat box.
Returns an object representing a chat box.
The chat box should already be open.
To return a single chat box, provide the JID of the contact you're chatting
with in that chat box:
...
...
@@ -703,16 +703,36 @@ To return all open chat boxes, call the method without any JIDs::
open
~~~~
Opens a chat box and returns a Backbone.View object representing a chat box.
Opens a chat box and returns a `Backbone.View <http://backbonejs.org/#View>`_ object
representing a chat box.
To open a single chat box, provide the JID of the contact:
Note that converse doesn't allow opening chats with users who aren't in your roster
(unless you have set :ref:`allow_non_roster_messaging` to ``true``).
Before opening a chat, you should first wait until the roster has been populated.
This is the :ref:`rosterContactsFetched` event/promise.
Besides that, it's a good idea to also first wait until already opened chat boxes
(which are cached in sessionStorage) have also been fetched from the cache.
This is the :ref:`chatBoxesFetched` event/promise.
These two events fire only once per session, so they're also available as promises.
So, to open a single chat box:
.. code-block:: javascript
converse.plugins.add('myplugin', {
initialize: function () {
this._converse.api.chats.open('buddy@example.com')
}
initialize: function() {
var _converse = this._converse;
Promise.all([
_converse.api.waitUntil('rosterContactsFetched'),
_converse.api.waitUntil('chatBoxesFetched')
]).then(function() {
// Note, buddy@example.org must be in your contacts roster!
_converse.api.chats.open('buddy@example.com')
});
}
});
To return an array of chat boxes, provide an array of JIDs:
...
...
@@ -721,7 +741,14 @@ To return an array of chat boxes, provide an array of JIDs:
converse.plugins.add('myplugin', {
initialize: function () {
this._converse.api.chats.open(['buddy1@example.com', 'buddy2@example.com'])
var _converse = this._converse;
Promise.all([
_converse.api.waitUntil('rosterContactsFetched'),
_converse.api.waitUntil('chatBoxesFetched')
]).then(function() {
// Note, these users must first be in your contacts roster!
_converse.api.chats.open(['buddy1@example.com', 'buddy2@example.com'])
});
}
});
...
...
@@ -897,7 +924,7 @@ JIDs.
The **promises** grouping
-------------------------
Converse.js and its plugins emit various events which you can listen to via the
Converse.js and its plugins emit various events which you can listen to via the
:ref:`listen-grouping`.
Some of these events are also available as `ES2015 Promises <http://es6-features.org/#PromiseUsage>`_,
...
...
src/converse-bookmarks.js
View file @
d6de627f
...
...
@@ -381,8 +381,8 @@
onBookmarksReceivedError
(
deferred
,
iq
)
{
window
.
sessionStorage
.
setItem
(
this
.
fetched_flag
,
true
);
_converse
.
log
(
'
Error while fetching bookmarks
'
,
Strophe
.
LogLevel
.
ERROR
);
_converse
.
log
(
iq
,
Strophe
.
LogLevel
.
DEBUG
);
_converse
.
log
(
'
Error while fetching bookmarks
'
,
Strophe
.
LogLevel
.
WARN
);
_converse
.
log
(
iq
.
outerHTML
,
Strophe
.
LogLevel
.
DEBUG
);
if
(
!
_
.
isNil
(
deferred
))
{
return
deferred
.
reject
();
}
...
...
src/converse-core.js
View file @
d6de627f
...
...
@@ -748,8 +748,10 @@
if
(
ignore_cache
)
{
_converse
.
send_initial_presence
=
true
;
_converse
.
roster
.
fetchFromServer
()
.
then
(
_converse
.
sendInitialPresence
)
.
catch
(
_converse
.
sendInitialPresence
);
.
then
(()
=>
{
_converse
.
emit
(
'
rosterContactsFetched
'
);
_converse
.
sendInitialPresence
();
}).
catch
(
_converse
.
sendInitialPresence
);
}
else
{
_converse
.
rostergroups
.
fetchRosterGroups
().
then
(()
=>
{
_converse
.
emit
(
'
rosterGroupsFetched
'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment