//Get a handle to the Lookup Service and add a resolve listener
lookupService = (LookupService) stsession.getCompApi(LookupService.COMP_NAME);
resolver = lookupService.createResolver(true, false, true, false);
resolver.addResolveListener(this);
//Get a handle to the Awareness Service and create a WatchList
awarenessService = (AwarenessService) stsession.getCompApi(AwarenessService.COMP_NAME);
watchList = awarenessService.createWatchList();
watchList.addStatusListener(this);
//We get an array of objects representing the users
Object wu[] = se.getWatchedUsers();
STWatchedUser stwu = (STWatchedUser) wu[0];
sysOut(stwu.getName() + " status changed to " + stwu.getStatus().getStatusDescription());
if (stwu.getStatus().getStatusType() == STUserStatus.ST_USER_STATUS_ACTIVE
|| stwu.getStatus().getStatusType() == STUserStatus.ST_USER_STATUS_AWAY)
{
//Send an alert to the user
sysOut("Alert called for " + stwu.getName());
//Set the IM Type to IM_TYPE_CHAT
int imt = ImTypes.IM_TYPE_CHAT;
//Set the encryption level
EncLevel enc = EncLevel.ENC_LEVEL_ALL;
//Create the channel to the user
Im im = imService.createIm(stwu, enc, imt);
Im.addImListener(this);
im.open();
sysOut("IM Opened to " + ie.getIm().getPartner().getName());
//To get the user status, we need to cast the IM object as an STWatchedUser
STWatchedUser stwu = (STWatchedUser) ie.getIm().getPartner();
if (ie.getIm().isOpen()) {
String text = "I see that your status has changed to " + (stwu.getStatus().getStatusType()
== STUserStatus.ST_USER_STATUS_ACTIVE ? "Active" : "Away");
ie.getIm().sendText(false, text + " with the message \""
+ stwu.getStatus().getStatusDescription() + "\"");
sysOut("Message sent to " + ie.getIm().getPartner().getName());
try {
// This is to make sure the message is sent before closing the IM
著者について
John W. Rooneyは、IBMのインターネット技術開発部門マネージャーです。Rooney(友達は彼をそう呼びますが)と彼のWebahead/Internet
Technology Groupは、いくつかのSametimeボット技術に大きく依存しているものを含め、IBM内で広く使われているさまざまなアプリケーションを開発してきました。
Eben Stewartは、IBMのWebahead/Internet Technology Groupのソフトウェア・エンジニアです。彼は、Bluepages(社内ディレクトリー・ボット)のような、社内で使用するボット・アプリケーションを提供するためにIBMで使用されているツールキットであるBotServerの主要な開発者です。