2
0
mirror of https://github.com/ACSPRI/queXS synced 2024-04-02 12:12:16 +00:00

Properly log out of chat when ending a case and set case id as presence message

This commit is contained in:
Adam Zammit
2013-07-17 10:29:04 +10:00
parent 5c1dfd0444
commit 2e3991dc47
2 changed files with 25 additions and 1 deletions

View File

@@ -2,6 +2,17 @@
var nConnStatus = "";
function Unload()
{
if (conn)
{
conn.flush();
conn.sync = true;
conn.disconnect();
conn = null;
}
}
function OnConnectionStatus(nStatus)
{
nConnStatus = nStatus;
@@ -20,7 +31,7 @@ function OnConnected()
{
conn.addHandler(OnPresenceStanza, null, "presence");
conn.addHandler(OnMessageStanza, null, "message");
conn.send($pres());
conn.send($pres().c('status').t(PRESENCE_MESSAGE));
}
@@ -112,6 +123,16 @@ function SendChat(chat)
}
$(document).ready(function(){
$(window).bind('beforeunload', function(e) {
Unload();
});
$(window).unload(function()
{
Unload();
});
$('#chatclick').bind('click', function()
{
SendChat($('#chattext').val());