Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.im
Class IMService

java.lang.Object
  extended by com.jivesoftware.forum.im.IMService

public final class IMService
extends java.lang.Object

Represents the various IM Services for which we show presence in the forums. Contains various helper methods to interact with the services.


Field Summary
static IMService AIM
          Represents the AOL IM Service, and can create urls which provide presence information for its users.
static IMService XMPP
          Represents the currently configured XMPP server.
 
Method Summary
 boolean canShowPresence(User user)
          Returns true if the supplied User has entered user id information for the IM Service this instance represents and if forums is configured to publish presence for the IM service this instance represents.
static void closeXMPPConnection()
          Closes the XMPPConnection held by forums to publish server status (configured chat rooms, current occupancy, etc.)
static java.util.Iterator getChatRoomInfo(int maxRooms)
          Returns an Iterator of RoomInfo instances describing the current chat room activity on the XMPP server.
 java.lang.String getChatURI(User user)
          Returns a uri which when clicked, can launch a chat client (say..
static int getNumChatRooms()
          Returns the number of chat rooms available on the xmpp server.
 java.lang.String getPresenceURL(User user, User requestor)
          Returns the http url which will return a presence image.
 java.lang.String getServiceName()
          Returns the name of the IM Service (Yahoo, XMPP, etc.).
static void initializeXMPPConnection()
          Creates a connection (and logs into) to the XMPP server as specified by the current values of ForumsChatSettings.
static IMService serviceForName(java.lang.String serviceName)
          Returns an IMService instance for the supplied service name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XMPP

public static final IMService XMPP
Represents the currently configured XMPP server. This instance can create urls which provide presence info for xmpp.


AIM

public static final IMService AIM
Represents the AOL IM Service, and can create urls which provide presence information for its users.

Method Detail

initializeXMPPConnection

public static void initializeXMPPConnection()
                                     throws org.jivesoftware.smack.XMPPException
Creates a connection (and logs into) to the XMPP server as specified by the current values of ForumsChatSettings. The connection is used to publish information about the chat server (chat rooms, occupantcy, etc.)

Throws:
org.jivesoftware.smack.XMPPException - if connection or login fails.

closeXMPPConnection

public static void closeXMPPConnection()
Closes the XMPPConnection held by forums to publish server status (configured chat rooms, current occupancy, etc.)


getChatRoomInfo

public static java.util.Iterator getChatRoomInfo(int maxRooms)
Returns an Iterator of RoomInfo instances describing the current chat room activity on the XMPP server. If forums is not configured to connect to an XMPP server, or if initializeXMPPConnection() has not been called, an empty Iterator is returned.

Parameters:
maxRooms - the maximum number of chat rooms to return in the result. Values <= 0 return an unlimited number of results.
Returns:
an Iterator of RoomInfo instances.

getNumChatRooms

public static int getNumChatRooms()
Returns the number of chat rooms available on the xmpp server. Returns zero if forums is not configured to connect to an XMPP server, or if initializeXMPPConnection() has not been called.

Returns:
the number of chat rooms available on the xmpp server

serviceForName

public static IMService serviceForName(java.lang.String serviceName)
Returns an IMService instance for the supplied service name. If the supplied name doesn't match that of any of the enum instances, null is returned.

Parameters:
serviceName - the name of the IMService to return
Returns:
the IMService instance

getServiceName

public java.lang.String getServiceName()
Returns the name of the IM Service (Yahoo, XMPP, etc.).

Returns:
the service name.

getPresenceURL

public java.lang.String getPresenceURL(User user,
                                       User requestor)
Returns the http url which will return a presence image. Returns null if calls to canShowPresence(com.jivesoftware.base.User) return false.

Parameters:
user - The user whose presence will be published
requestor - The user who is asking for presence information
Returns:
a url which publishes presence as an image

canShowPresence

public boolean canShowPresence(User user)
Returns true if the supplied User has entered user id information for the IM Service this instance represents and if forums is configured to publish presence for the IM service this instance represents.

Parameters:
user - the user to test.
Returns:
true if the user has supplied user id info for the service.

getChatURI

public java.lang.String getChatURI(User user)
Returns a uri which when clicked, can launch a chat client (say.. Spark).

Parameters:
user - the User whose user id will be in the uri.
Returns:
a uri appropriate to the IMService this instance represents.

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.