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
10ca2900
Commit
10ca2900
authored
Jun 17, 2016
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a "create" parameter to rooms.get
to indicate whether the room should be created if not found.
parent
95c5f9d4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
6 deletions
+17
-6
docs/source/development.rst
docs/source/development.rst
+12
-1
src/converse-core.js
src/converse-core.js
+3
-3
src/converse-muc.js
src/converse-muc.js
+2
-2
No files found.
docs/source/development.rst
View file @
10ca2900
...
...
@@ -651,8 +651,19 @@ get
~~~
Returns an object representing a multi user chat box (room).
It takes 3 parameters:
Similar to chats.get API
* the room JID
* the user's nickname (if not specified, the node part of the user's JID will be used).
* boolean, indicating whether the room should be created if not found (default: `false`)
The last two parameters are optional.
.. code-block:: javascript
var nick = 'dread-pirate-roberts';
var create_if_not_found = true;
converse.rooms.open('group@muc.example.com', nick, create_if_not_found)
open
~~~~
...
...
src/converse-core.js
View file @
10ca2900
...
...
@@ -1437,9 +1437,9 @@
return
this
.
model
.
chatBoxMayBeShown
(
chatbox
);
},
getChatBox
:
function
(
attrs
)
{
getChatBox
:
function
(
attrs
,
create
)
{
var
chatbox
=
this
.
model
.
get
(
attrs
.
jid
);
if
(
!
chatbox
)
{
if
(
!
chatbox
&&
create
)
{
chatbox
=
this
.
model
.
create
(
attrs
,
{
'
error
'
:
function
(
model
,
response
)
{
converse
.
log
(
response
.
responseText
);
...
...
@@ -1453,7 +1453,7 @@
/* Find the chat box and show it (if it may be shown).
* If it doesn't exist, create it.
*/
var
chatbox
=
this
.
getChatBox
(
attrs
);
var
chatbox
=
this
.
getChatBox
(
attrs
,
true
);
if
(
this
.
chatBoxMayBeShown
(
chatbox
))
{
chatbox
.
trigger
(
'
show
'
,
true
);
}
...
...
src/converse-muc.js
View file @
10ca2900
...
...
@@ -1431,8 +1431,8 @@
}
return
_
.
map
(
jids
,
_
.
partial
(
_transform
,
_
,
nick
,
fetcher
));
},
'
get
'
:
function
(
jids
,
nick
)
{
var
fetcher
=
converse
.
chatboxviews
.
getChatBox
.
bind
(
converse
.
chatboxviews
);
'
get
'
:
function
(
jids
,
nick
,
create
)
{
var
fetcher
=
_
.
partial
(
converse
.
chatboxviews
.
getChatBox
.
bind
(
converse
.
chatboxviews
),
_
,
create
);
if
(
!
nick
)
{
nick
=
Strophe
.
getNodeFromJid
(
converse
.
bare_jid
);
}
...
...
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