Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Tomáš Peterka
erp5
Commits
450885f3
Commit
450885f3
authored
Mar 16, 2016
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web_jabber_client: connection immediately disconnect on browser window close
it save from message loss.
parent
8f702e79
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
13 deletions
+27
-13
bt5/erp5_web_jabber_client/PathTemplateItem/web_page_module/jabber_gadget_jabberconnection_js.js
...Item/web_page_module/jabber_gadget_jabberconnection_js.js
+27
-13
No files found.
bt5/erp5_web_jabber_client/PathTemplateItem/web_page_module/jabber_gadget_jabberconnection_js.js
View file @
450885f3
...
@@ -50,6 +50,18 @@
...
@@ -50,6 +50,18 @@
}
}
function
disconnectOnbeforeunload
(
connection
)
{
return
function
(
event
)
{
/* XXX it can be interfere with changed warning
if (changed && $('button.save')) {
return unsaved_warn_message;
}*/
connection
.
sync
=
true
;
connection
.
disconnect
();
connection
.
flush
();
};
}
function
deferOnMessageStanza
(
message
)
{
function
deferOnMessageStanza
(
message
)
{
var
gadget
=
this
;
var
gadget
=
this
;
enqueueDefer
(
gadget
,
function
()
{
enqueueDefer
(
gadget
,
function
()
{
...
@@ -148,27 +160,29 @@
...
@@ -148,27 +160,29 @@
// Try to auto connection
// Try to auto connection
if
(
gadget
.
props
.
server
!==
undefined
)
{
if
(
gadget
.
props
.
server
!==
undefined
)
{
gadget
.
props
.
connection
=
new
Strophe
.
Connection
(
gadget
.
props
.
server
);
gadget
.
props
.
connection
=
new
Strophe
.
Connection
(
gadget
.
props
.
server
);
var
connection
=
gadget
.
props
.
connection
;
// gadget.props.connection.rawInput = function (data) {
// console.log("RECEIVING SOMETHING");
// connection.rawInput = function (data) {
// console.log(data);
// console.log("RECEIVING SOMETHING");
// };
// console.log(data);
// gadget.props.connection.rawOutput = function (data) {
// };
// console.log("SENDING SOMETHING");
// connection.rawOutput = function (data) {
// console.log(data);
// console.log("SENDING SOMETHING");
// };
// console.log(data);
// };
gadget
.
props
.
connection
.
connect
(
connection
.
connect
(
gadget
.
props
.
jid
,
gadget
.
props
.
jid
,
gadget
.
props
.
passwd
,
gadget
.
props
.
passwd
,
handleConnectionCallback
handleConnectionCallback
);
);
gadget
.
props
.
connection
.
addHandler
(
window
.
onbeforeunload
=
disconnectOnbeforeunload
(
connection
);
connection
.
addHandler
(
deferOnPresenceStanza
.
bind
(
gadget
),
deferOnPresenceStanza
.
bind
(
gadget
),
null
,
null
,
"
presence
"
"
presence
"
);
);
gadget
.
props
.
connection
.
addHandler
(
connection
.
addHandler
(
deferOnMessageStanza
.
bind
(
gadget
),
deferOnMessageStanza
.
bind
(
gadget
),
null
,
null
,
"
message
"
,
"
message
"
,
...
...
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