~adamzammit/quexs/referralfeature

« back to all changes in this revision

Viewing changes to js/supervisorchat.js

  • Committer: Adam Zammit
  • Date: 2013-07-17 00:29:04 UTC
  • Revision ID: adam.zammit@acspri.org.au-20130717002904-r2to4fgsbb1gh2e0
Properly log out of chat when ending a case and set case id as presence message

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
var nConnStatus = "";
4
4
 
 
5
function Unload()
 
6
{
 
7
        if (conn) 
 
8
        {
 
9
                conn.flush();
 
10
                conn.sync = true;
 
11
                conn.disconnect();
 
12
                conn = null;
 
13
        }
 
14
}
 
15
 
5
16
function OnConnectionStatus(nStatus)
6
17
{
7
18
        nConnStatus = nStatus;
20
31
{
21
32
        conn.addHandler(OnPresenceStanza, null, "presence");
22
33
        conn.addHandler(OnMessageStanza, null, "message");
23
 
        conn.send($pres());
 
34
        conn.send($pres().c('status').t(PRESENCE_MESSAGE));
24
35
}
25
36
 
26
37
 
112
123
}
113
124
 
114
125
$(document).ready(function(){
 
126
 
 
127
        $(window).bind('beforeunload', function(e) {
 
128
          Unload();
 
129
        });
 
130
        
 
131
        $(window).unload(function()
 
132
        {
 
133
          Unload();
 
134
        });
 
135
 
115
136
        $('#chatclick').bind('click', function()
116
137
        {
117
138
            SendChat($('#chattext').val());