org.olat.instantMessaging
Class InstantMessagingClient

java.lang.Object
  extended by org.olat.instantMessaging.InstantMessagingClient

public class InstantMessagingClient
extends java.lang.Object

Description:
Instant Messaging Client class based on the open source library SMACK (www.igniterealtime.org). It provides connection to the IM-server, sends presence packets, listens to messages and subscription requests. Methods that mention the velocity rendering stuff are uses by template files that render the html-response that for they dont have references in the java source code.

Version:
Initial Date: 14.10.2004
Author:
Guido Schnider

Method Summary
 void addSubscriptionListener()
          By adding this method (right now added to the constructor) we do have auto subscription.
 java.lang.String buddyCountOnline()
          Used by Velocity renderer
 void closeConnection(boolean closeSynchronously)
          Close the connection to the server
 java.lang.String getChatUsername()
          in case multiple olat instances use one single jabber server, username needs to be distinguished by instance id
 org.jivesoftware.smack.XMPPConnection getConnection()
           
 java.lang.String getDefaultRosterStatus()
           
 GroupChatManagerController getGroupChatManagerController()
          access the per user instance of the group chat manager
 java.lang.String getJid()
           
 java.lang.String getPassword()
           
 org.jivesoftware.smack.packet.Presence.Mode getPresenceMode()
           
 java.lang.String getRecentPresenceStatusMode()
           
 org.jivesoftware.smack.Roster getRoster()
           
 java.lang.String getServerName()
           
 java.lang.String getUsername()
           
 boolean isChatDisabled()
           
 boolean isConnected()
           
 void sendPresence(org.jivesoftware.smack.packet.Presence.Type type, java.lang.String status, int priority, org.jivesoftware.smack.packet.Presence.Mode mode)
          change jabber status.
 void sendPresenceAutoStatusIdle()
           
 void sendPresenceAvailable(org.jivesoftware.smack.packet.Presence.Mode mode)
          send a presence packet "available" with a certain mode e.g.
 void sendPresenceUnavailable()
          send a presence packet "unavailable" to all buddies
 void setGroupChatManager(GroupChatManagerController groupChatManagerCtrl)
          set the per user instance of the group chat manager
 void setIsConnected(boolean isConnected)
           
 void setRoster(org.jivesoftware.smack.Roster roster)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

sendPresence

public void sendPresence(org.jivesoftware.smack.packet.Presence.Type type,
                         java.lang.String status,
                         int priority,
                         org.jivesoftware.smack.packet.Presence.Mode mode)
change jabber status. Example: sendPresencePacket(Presence.Type.AVAILABLE, "at meeting...", 1, Presence.Mode.AWAY);

Parameters:
type -
status -
priority -
mode -

sendPresenceAvailable

public void sendPresenceAvailable(org.jivesoftware.smack.packet.Presence.Mode mode)
send a presence packet "available" with a certain mode e.g. "away" to all buddies

Parameters:
mode -

sendPresenceUnavailable

public void sendPresenceUnavailable()
send a presence packet "unavailable" to all buddies


addSubscriptionListener

public void addSubscriptionListener()
By adding this method (right now added to the constructor) we do have auto subscription. All subscribe packets get automatically answered by a subscribed packet.


getJid

public java.lang.String getJid()
Returns:
Returns the jid.

getPresenceMode

public org.jivesoftware.smack.packet.Presence.Mode getPresenceMode()

getRoster

public org.jivesoftware.smack.Roster getRoster()
Returns:
Returns the roster.

setRoster

public void setRoster(org.jivesoftware.smack.Roster roster)
Parameters:
roster -

closeConnection

public void closeConnection(boolean closeSynchronously)
Close the connection to the server


isChatDisabled

public boolean isChatDisabled()

getRecentPresenceStatusMode

public java.lang.String getRecentPresenceStatusMode()

buddyCountOnline

public java.lang.String buddyCountOnline()
Used by Velocity renderer

Returns:
a String representing the online buddies out of the number of total buddies

getPassword

public java.lang.String getPassword()
Returns:
Returns the password.

getUsername

public java.lang.String getUsername()
Returns:
Returns the username.

getChatUsername

public java.lang.String getChatUsername()
in case multiple olat instances use one single jabber server, username needs to be distinguished by instance id

Returns:
returns the chat-username used on jabber server

isConnected

public boolean isConnected()
Returns:
Returns true when user is connected to server

setIsConnected

public void setIsConnected(boolean isConnected)

getConnection

public org.jivesoftware.smack.XMPPConnection getConnection()

getServerName

public java.lang.String getServerName()

sendPresenceAutoStatusIdle

public void sendPresenceAutoStatusIdle()

setGroupChatManager

public void setGroupChatManager(GroupChatManagerController groupChatManagerCtrl)
set the per user instance of the group chat manager

Parameters:
groupChatManagerController -

getGroupChatManagerController

public GroupChatManagerController getGroupChatManagerController()
access the per user instance of the group chat manager

Returns:

getDefaultRosterStatus

public java.lang.String getDefaultRosterStatus()
Returns:
status from IM preferences or default wich is "available"