Add MS Office communicator presence indicator into JSP

让人想犯罪 __ 提交于 2019-12-05 00:30:30

问题


I want to add MS Office communicator presence indicator into my Java Application(jsp).


回答1:


If you're targeting the windows platform, the simplest way is to do everything client-side. As long as the clients are running IE, Office 2003 or above, and Communicator 2007 or above, you can use the NameCtrl ActiveX object that gets distributed with Office.

The following code should get you started:

<script>

var sipUri = "your.contact@your.domain.com";

var nameCtrl = new ActiveXObject('Name.NameCtrl.1');
if (nameCtrl.PresenceEnabled)
{
  nameCtrl.OnStatusChange = onStatusChange;
  nameCtrl.GetStatus(sipUri, "1");
}


function onStatusChange(name, status, id)
{
  // This function is fired when the contacts presence status changes.
  // In a real world solution, you would want to update an image to reflect the users presence
  alert(name + ", " + status + ", " + id);
}

function ShowOOUI()
{
  nameCtrl.ShowOOUI(sipUri, 0, 15, 15);
}

function HideOOUI()
{
  nameCtrl.HideOOUI();
}

</script>

<span onmouseover="ShowOOUI()" onmouseout="HideOOUI()" style="border-style:solid">Your Contact</span>

For a real world solution, you'd just need to implement an image that changes depending on the presence state that gets returned (i.e. a presence bubble to display alongside each users name), and a collection of sip uris to images, to ensure you can map an incoming status change to the relevant image.



来源:https://stackoverflow.com/questions/4130904/add-ms-office-communicator-presence-indicator-into-jsp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!