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
8e5d481e
Commit
8e5d481e
authored
May 27, 2015
by
JC Brand
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'auto-away' of
https://github.com/thierrytiti/converse.js
into thierrytiti-auto-away
Conflicts: converse.js
parents
c4698613
a660f853
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
1 deletion
+84
-1
converse.js
converse.js
+62
-1
docs/CHANGES.rst
docs/CHANGES.rst
+1
-0
docs/source/configuration.rst
docs/source/configuration.rst
+21
-0
No files found.
converse.js
View file @
8e5d481e
...
...
@@ -257,6 +257,8 @@
allow_logout
:
true
,
allow_muc
:
true
,
allow_otr
:
true
,
auto_away
:
0
,
//in seconds
auto_xa
:
0
,
//in seconds
allow_registration
:
true
,
animate
:
true
,
auto_list_rooms
:
false
,
...
...
@@ -381,6 +383,65 @@
// Module-level functions
// ----------------------
this
.
autoAwayReset
=
function
(){
if
(
converse
.
_idleCounter
>
0
)
{
converse
.
_idleCounter
=
0
;
if
(
converse
.
_autoAway
>
0
)
{
converse
.
_autoAway
=
0
;
if
(
converse
.
HAS_CSI
)
{
converse
.
connection
.
send
(
$build
(
"
active
"
,
{
xmlns
:
'
urn:xmpp:csi:0
'
}));
}
converse
.
xmppstatus
.
setStatus
(
'
online
'
);
}
}
};
this
.
registerAutoAwayHandler
=
function
(){
if
(
converse
.
auto_away
>
0
||
converse
.
auto_xa
>
0
){
if
(
converse
.
features
.
findWhere
({
'
var
'
:
'
urn:xmpp:csi
'
}))
{
// The server supports XEP-0352 Client State Indication
converse
.
HAS_CSI
=
true
;
}
else
{
converse
.
HAS_CSI
=
false
;
}
if
(
converse
.
auto_xa
>
0
&&
converse
.
auto_xa
<
converse
.
auto_away
)
converse
.
auto_xa
=
converse
.
auto_away
;
converse
.
_idleCounter
=
0
;
converse
.
_autoAway
=
0
;
$
(
window
).
on
(
'
click
'
,
function
(){
converse
.
autoAwayReset
()});
$
(
window
).
on
(
'
mousemove
'
,
function
(){
converse
.
autoAwayReset
()});
$
(
window
).
on
(
'
keypress
'
,
function
(){
converse
.
autoAwayReset
()});
$
(
window
).
on
(
'
focus
'
,
function
(){
converse
.
autoAwayReset
()});
$
(
window
).
on
(
'
beforeunload
'
,
function
(){
converse
.
autoAwayReset
()});
window
.
setInterval
(
function
()
{
if
((
converse
.
_idleCounter
<=
converse
.
auto_away
||
(
converse
.
auto_xa
>
0
&&
converse
.
_idleCounter
<=
converse
.
auto_xa
))
&&
(
converse
.
xmppstatus
.
get
(
'
status
'
)
==
'
online
'
&&
converse
.
_autoAway
==
0
)
||
(
converse
.
xmppstatus
.
get
(
'
status
'
)
==
'
away
'
&&
converse
.
_autoAway
==
1
)
){
converse
.
_idleCounter
++
;
}
if
(
converse
.
auto_away
>
0
&&
converse
.
_autoAway
!=
1
&&
converse
.
_idleCounter
>
converse
.
auto_away
&&
converse
.
_idleCounter
<=
converse
.
auto_xa
){
if
(
converse
.
HAS_CSI
)
{
converse
.
connection
.
send
(
$build
(
"
inactive
"
,
{
xmlns
:
'
urn:xmpp:csi:0
'
}));
}
converse
.
_autoAway
=
1
;
converse
.
xmppstatus
.
setStatus
(
'
away
'
);
}
else
if
(
converse
.
auto_xa
>
0
&&
converse
.
_autoAway
!=
2
&&
converse
.
_idleCounter
>
converse
.
auto_xa
){
if
(
converse
.
HAS_CSI
)
{
converse
.
connection
.
send
(
$build
(
"
inactive
"
,
{
xmlns
:
'
urn:xmpp:csi:0
'
}));
}
converse
.
_autoAway
=
2
;
converse
.
xmppstatus
.
setStatus
(
'
xa
'
);
}
},
1000
);
//every seconds
return
true
;
}
};
this
.
playNotification
=
function
()
{
var
audio
;
if
(
converse
.
play_sounds
&&
typeof
Audio
!==
"
undefined
"
){
...
...
@@ -760,9 +821,9 @@
this
.
features
=
new
this
.
Features
();
this
.
enableCarbons
();
this
.
initStatus
(
$
.
proxy
(
function
()
{
this
.
registerPingHandler
();
this
.
registerPongHandler
();
this
.
registerAutoAwayHandler
();
this
.
chatboxes
.
onConnected
();
this
.
giveFeedback
(
__
(
'
Contacts
'
));
if
(
this
.
callback
)
{
...
...
docs/CHANGES.rst
View file @
8e5d481e
...
...
@@ -17,6 +17,7 @@ Changelog
* CSS: Fonts Path: editabable $font-path via sass/variables.scss [thierrytiti]
* Add offline pretty status to enable translation [thierrytiti]
* Add Ping funcionnality and Pong Handler (Fix to issue #144) [thierrytiti]
* Add automatic Away mode and XEP-0352 support [thierrytiti]
0.9.3 (2015-05-01)
------------------
...
...
docs/source/configuration.rst
View file @
8e5d481e
...
...
@@ -175,6 +175,27 @@ It should be used either with ``authentication`` set to ``anonymous`` or to
If ``authentication`` is set to ``login``, then you will also need to provide a
valid ``jid`` and ``password`` values.
auto_away
---------
* Default: ``0``
This option can be used to let converse.js automatically change user presence
This set the number a seconds before user presence become ``away``
If the value if negative or ``0``, the function is disabled.
auto_xa
-------
* Default: ``0``
This option can be used to let converse.js automatically change user presence
This set the number a seconds before user presence become ``xa`` (eXtended Away)
The value must be greater than ``auto_away``
If the value if negative or ``0``, the function is disabled.
auto_reconnect
--------------
...
...
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