The "rooms" namespace groups methods relevant to chatrooms (aka groupchats).
- Source:
Namespaces
Methods
(static) create(jid|jids, attrsopt) → {Promise}
Creates a new MUC chatroom (aka groupchat)
Similar to api.rooms.open, but creates the chatroom in the background (i.e. doesn't cause a view to open).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
jid|jids |
Array.<string> | string | The JID or array of JIDs of the chatroom(s) to create |
|
attrs |
object |
<optional> |
attrs The room attributes |
- Source:
Returns:
Promise which resolves with the Model representing the chat.
- Type
- Promise
(static) create(jid|jids, attrsopt) → {Promise}
Creates a new MUC chatroom (aka groupchat)
Similar to api.rooms.open, but creates the chatroom in the background (i.e. doesn't cause a view to open).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
jid|jids |
Array.<string> | string | The JID or array of JIDs of the chatroom(s) to create |
|
attrs |
object |
<optional> |
attrs The room attributes |
Returns:
Promise which resolves with the Model representing the chat.
- Type
- Promise
(static) get(jidopt, attrsopt, create) → {Promise.<_converse.ChatRoom>}
Fetches the object representing a MUC chatroom (aka groupchat)
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jid |
String |
<optional> |
The room JID (if not specified, all rooms will be returned). |
||||||||||||
attrs |
Object |
<optional> |
A map containing any extra room attributes
to be set if Properties
|
||||||||||||
create |
Boolean | A boolean indicating whether the room should be created
if not found (default: |
- Source:
Returns:
- Type
- Promise.<_converse.ChatRoom>
Example
api.waitUntil('roomsAutoJoined').then(() => {
const create_if_not_found = true;
api.rooms.get(
'group@muc.example.com',
{'nick': 'dread-pirate-roberts', 'password': 'secret'},
create_if_not_found
)
});
(static) get(jidopt, attrsopt, create) → {Promise.<_converse.ChatRoom>}
Fetches the object representing a MUC chatroom (aka groupchat)
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jid |
String |
<optional> |
The room JID (if not specified, all rooms will be returned). |
||||||||||||
attrs |
Object |
<optional> |
A map containing any extra room attributes
to be set if Properties
|
||||||||||||
create |
Boolean | A boolean indicating whether the room should be created
if not found (default: |
Returns:
- Type
- Promise.<_converse.ChatRoom>
Example
api.waitUntil('roomsAutoJoined').then(() => {
const create_if_not_found = true;
api.rooms.get(
'group@muc.example.com',
{'nick': 'dread-pirate-roberts', 'password': 'secret'},
create_if_not_found
)
});
(static) open(jid, attrs, forceopt) → {Promise}
Opens a MUC chatroom (aka groupchat)
Similar to api.chats.open, but for groupchats.
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jid |
string | The room JID or JIDs (if not specified, all currently open rooms will be returned). |
||||||||||||||||||||||||||
attrs |
string | A map containing any extra room attributes. Properties
|
||||||||||||||||||||||||||
force |
Boolean |
<optional> |
false | By default, a minimized
room won't be maximized (in |
- Source:
Returns:
Promise which resolves with the Model representing the chat.
- Type
- Promise
Examples
api.rooms.open('group@muc.example.com')
// To return an array of rooms, provide an array of room JIDs:
api.rooms.open(['group1@muc.example.com', 'group2@muc.example.com'])
// To setup a custom nickname when joining the room, provide the optional nick argument:
api.rooms.open('group@muc.example.com', {'nick': 'mycustomnick'})
// For example, opening a room with a specific default configuration:
api.rooms.open(
'myroom@conference.example.org',
{ 'nick': 'coolguy69',
'auto_configure': true,
'roomconfig': {
'changesubject': false,
'membersonly': true,
'persistentroom': true,
'publicroom': true,
'roomdesc': 'Comfy room for hanging out',
'whois': 'anyone'
}
}
);
(static) open(jid, attrs, forceopt) → {Promise}
Opens a MUC chatroom (aka groupchat)
Similar to api.chats.open, but for groupchats.
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jid |
string | The room JID or JIDs (if not specified, all currently open rooms will be returned). |
||||||||||||||||||||||||||
attrs |
string | A map containing any extra room attributes. Properties
|
||||||||||||||||||||||||||
force |
Boolean |
<optional> |
false | By default, a minimized
room won't be maximized (in |
Returns:
Promise which resolves with the Model representing the chat.
- Type
- Promise
Examples
api.rooms.open('group@muc.example.com')
// To return an array of rooms, provide an array of room JIDs:
api.rooms.open(['group1@muc.example.com', 'group2@muc.example.com'])
// To setup a custom nickname when joining the room, provide the optional nick argument:
api.rooms.open('group@muc.example.com', {'nick': 'mycustomnick'})
// For example, opening a room with a specific default configuration:
api.rooms.open(
'myroom@conference.example.org',
{ 'nick': 'coolguy69',
'auto_configure': true,
'roomconfig': {
'changesubject': false,
'membersonly': true,
'persistentroom': true,
'publicroom': true,
'roomdesc': 'Comfy room for hanging out',
'whois': 'anyone'
}
}
);