The Presence plugin for jive messenger is very good for my project.
But I have encountered one error, and can’'t ensure the reason . Please see my code first:
I will catch the status of the account( "a@xm.com" ) every five seconds, but I found the isUnavailable is in the same status, when I log on or off the client system by the account("a@xm.com"). If I refresh the page, the result is the same.
But if I close the page and open it again, it will show the changed status( the isUnavailable is changed).
I don’'t know the reason, whether Presence service is in that case?
function init()
{
//buttonStatusUpdate() function will execute every 5 seconds
timer = window.setInterval(“buttonStatusUpdate()”,5000);
return false;
}
function buttonStatusUpdate()
{
var cs = "a@xm.com";
var objXmlHttp = new ActiveXObject(“Microsoft.XMLHTTP”);
try
{
var strURL = “http://xm.com:9090/plugins/presence/status?jid=”+ cs + “&type=xml”;
objXmlHttp.open(“GET”, strURL, false);
objXmlHttp.send();
var xmlText = objXmlHttp.responseText;
//if cs is offline, the type=“unavailable” will display in xmlText
//so, we can know the online/offline status through …
var isUnavailable = xmlText.indexOf(’‘type=“unavailable”’’);
alert( xmlText );
if (isUnavailable == -1)
{
alert(“online”);
}
else
{
alert(“offline”);
}
objXmlHttp.close();
}
catch(err)
{
}
}
[/code]
Can everyone give me a explain, and told me how can I catch the changing status every five seconds through Presence plugin but open or close the page!
Maybe the presence server the jive messenger plugin support is like that : a presence request from the same page will give the same result, in spite of the presence information is changed.
Is my option right ? Please help me, give me some code, Thanks!!!