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
4c15ac2e
Commit
4c15ac2e
authored
May 02, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new config setting: `auto_join_private_chats`
parent
3fe2ff23
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
103 additions
and
38 deletions
+103
-38
CHANGES.md
CHANGES.md
+2
-1
docs/source/configuration.rst
docs/source/configuration.rst
+13
-0
docs/source/events.rst
docs/source/events.rst
+59
-36
src/converse-chatboxes.js
src/converse-chatboxes.js
+29
-1
No files found.
CHANGES.md
View file @
4c15ac2e
...
@@ -31,7 +31,8 @@
...
@@ -31,7 +31,8 @@
-
Removed
`xhr_user_search`
in favor of only accepting
`xhr_user_search_url`
as configuration option.
-
Removed
`xhr_user_search`
in favor of only accepting
`xhr_user_search_url`
as configuration option.
-
The data returned from the
`xhr_user_search_url`
must now include the user's
-
The data returned from the
`xhr_user_search_url`
must now include the user's
`jid`
instead of just an
`id`
.
`jid`
instead of just an
`id`
.
-
New configuration setting
[
nickname
](
https://conversejs.org/docs/html/configurations.html#nickname
)
-
New configuration settings
[
nickname
](
https://conversejs.org/docs/html/configurations.html#nickname
)
and
[
auto_join_private_chats
](
https://conversejs.org/docs/html/configurations.html#auto-join-private-chats
)
.
## Architectural changes
## Architectural changes
...
...
docs/source/configuration.rst
View file @
4c15ac2e
...
@@ -343,6 +343,19 @@ auto_join_on_invite
...
@@ -343,6 +343,19 @@ auto_join_on_invite
If true, the user will automatically join a chatroom on invite without any confirm.
If true, the user will automatically join a chatroom on invite without any confirm.
auto_join_private_chats
-----------------------
* Default: ``[]``
Allows you to provide a list of user JIDs for private (i.e. single) chats that
should automatically be started upon login.
For example::
`['tom@example.org', 'dick@example.org', 'harry@example.org']`
auto_join_rooms
auto_join_rooms
---------------
---------------
...
...
docs/source/events.rst
View file @
4c15ac2e
This diff is collapsed.
Click to expand it.
src/converse-chatboxes.js
View file @
4c15ac2e
...
@@ -55,9 +55,17 @@
...
@@ -55,9 +55,17 @@
const
{
_converse
}
=
this
,
const
{
_converse
}
=
this
,
{
__
}
=
_converse
;
{
__
}
=
_converse
;
// Configuration values for this plugin
// ====================================
// Refer to docs/source/configuration.rst for explanations of these
// configuration settings.
_converse
.
api
.
settings
.
update
({
auto_join_private_chats
:
[],
});
_converse
.
api
.
promises
.
add
([
_converse
.
api
.
promises
.
add
([
'
chatBoxesFetched
'
,
'
chatBoxesFetched
'
,
'
chatBoxesInitialized
'
'
chatBoxesInitialized
'
,
'
privateChatsAutoJoined
'
]);
]);
function
openChat
(
jid
)
{
function
openChat
(
jid
)
{
...
@@ -709,8 +717,28 @@
...
@@ -709,8 +717,28 @@
return
_converse
.
chatboxviews
.
get
(
chatbox
.
get
(
'
id
'
));
return
_converse
.
chatboxviews
.
get
(
chatbox
.
get
(
'
id
'
));
};
};
function
autoJoinChats
()
{
/* Automatically join private chats, based on the
* "auto_join_private_chats" configuration setting.
*/
_
.
each
(
_converse
.
auto_join_private_chats
,
function
(
jid
)
{
if
(
_converse
.
chatboxes
.
where
({
'
jid
'
:
jid
}).
length
)
{
return
;
}
if
(
_
.
isString
(
jid
))
{
_converse
.
api
.
chats
.
open
(
jid
);
}
else
{
_converse
.
log
(
'
Invalid jid criteria specified for "auto_join_private_chats"
'
,
Strophe
.
LogLevel
.
ERROR
);
}
});
_converse
.
emit
(
'
privateChatsAutoJoined
'
);
}
/************************ BEGIN Event Handlers ************************/
/************************ BEGIN Event Handlers ************************/
_converse
.
on
(
'
chatBoxesFetched
'
,
autoJoinChats
);
_converse
.
on
(
'
addClientFeatures
'
,
()
=>
{
_converse
.
on
(
'
addClientFeatures
'
,
()
=>
{
_converse
.
connection
.
disco
.
addFeature
(
Strophe
.
NS
.
HTTPUPLOAD
);
_converse
.
connection
.
disco
.
addFeature
(
Strophe
.
NS
.
HTTPUPLOAD
);
_converse
.
connection
.
disco
.
addFeature
(
Strophe
.
NS
.
OUTOFBAND
);
_converse
.
connection
.
disco
.
addFeature
(
Strophe
.
NS
.
OUTOFBAND
);
...
...
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