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
2045741f
Commit
2045741f
authored
Mar 14, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add `api.chatviews.get` method
parent
044907e4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
0 deletions
+46
-0
docs/source/developer_api.rst
docs/source/developer_api.rst
+25
-0
src/converse-chatview.js
src/converse-chatview.js
+21
-0
No files found.
docs/source/developer_api.rst
View file @
2045741f
...
@@ -864,6 +864,31 @@ To return an array of chatboxes, provide an array of JIDs:
...
@@ -864,6 +864,31 @@ To return an array of chatboxes, provide an array of JIDs:
| url | The URL of the chatbox heading. |
| url | The URL of the chatbox heading. |
+-------------+-----------------------------------------------------+
+-------------+-----------------------------------------------------+
The **chatviews** grouping
----------------------
.. note:: This is only for private chats.
get
~~~
Returns a `Backbone.View <http://backbonejs.org/#View>`_ of type _converse.ChatBoxView.
The chat should already be open, otherwise `undefined` will be returned.
To return a single view, provide the JID of the contact:
.. code-block:: javascript
_converse.api.chatviews.get('buddy@example.com')
To return an array of views, provide an array of JIDs:
.. code-block:: javascript
_converse.api.chatviews.get(['buddy1@example.com', 'buddy2@example.com'])
.. _`listen-grouping`:
.. _`listen-grouping`:
The **listen** grouping
The **listen** grouping
...
...
src/converse-chatview.js
View file @
2045741f
...
@@ -1186,6 +1186,27 @@
...
@@ -1186,6 +1186,27 @@
// Advertise that we support XEP-0382 Message Spoilers
// Advertise that we support XEP-0382 Message Spoilers
_converse
.
connection
.
disco
.
addFeature
(
Strophe
.
NS
.
SPOILER
);
_converse
.
connection
.
disco
.
addFeature
(
Strophe
.
NS
.
SPOILER
);
});
});
/************************ BEGIN API ************************/
_
.
extend
(
_converse
.
api
,
{
'
chatviews
'
:
{
'
get
'
(
jids
)
{
if
(
_
.
isUndefined
(
jids
))
{
_converse
.
log
(
"
chats.create: You need to provide at least one JID
"
,
Strophe
.
LogLevel
.
ERROR
);
return
null
;
}
if
(
_
.
isString
(
jids
))
{
return
_converse
.
chatboxviews
.
get
(
jids
);
}
return
_
.
map
(
jids
,
(
jid
)
=>
_converse
.
chatboxviews
.
get
(
jids
));
}
}
});
/************************ END API ************************/
}
}
});
});
...
...
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