cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
786
Views
0
Helpful
1
Replies

Programmatically change my own status

amir.meshkin
Level 1
Level 1

It doesn't seem like it's possible to change my status using javascript.  I just want someone to confirm this or help me figure it out.

We're building a helpdesk application where a user initiates a chat with one of several people on a roster.  Once this conversation starts, we need to automatically change the presence of the helpdesk worker to busy.

Without having him manually change the drop down to busy. 

Is there a way to do this?

1 Reply 1

npetrele
Cisco Employee
Cisco Employee

Here's how I do it in a function in a demo app (I pass show and status to the function).

     _setMyPresence: function(show, status) {
            var presence = new jabberwerx.Presence();
            var default_priority = parseInt(localStorage.getItem("defaultpriority"));
               
            switch (show || "available") {
                case "unavailable":
                    presence.setShow("unavailable");
                    break;
                case "available":
                    break;
                case "away":
                    presence.setShow(show);
                    break;
                case "dnd":
                    presence.setShow(show);
                    break;
                default:
                    break;
           }
           presence.setStatus(status);
           presence.setPriority(default_priority);

           _app.controller.client.sendStanza(presence);