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:
@@ -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());
|
||||
|
||||
@@ -64,6 +64,8 @@ else
|
||||
|
||||
if ($chatenabled && operator_chat_enabled($operator_id))
|
||||
{
|
||||
$case_id = get_case_id($operator_id);
|
||||
|
||||
//get BOSH service URL
|
||||
$bosh_service = get_setting("bosh_service");
|
||||
if (empty($bosh_service))
|
||||
@@ -77,6 +79,7 @@ if ($chatenabled && operator_chat_enabled($operator_id))
|
||||
print "var SUPERVISOR_NAME = '" . T_("Supervisor") . "';";
|
||||
print "var MY_NAME = '" . T_("Me") . "';";
|
||||
print "var SUPERVISOR_XMPP = '$supervisor_xmpp';";
|
||||
print "var PRESENCE_MESSAGE = '" . T_("Case id") . ": $case_id';";
|
||||
print "var conn = new Strophe.Connection('$bosh_service');";
|
||||
print "conn.connect('" . get_operator_variable("chat_user",$operator_id) ."', '" . get_operator_variable("chat_password",$operator_id) . "', OnConnectionStatus);";
|
||||
print "</script>";
|
||||
|
||||
Reference in New Issue
Block a user