public interface IMSession
Modifier and Type | Method and Description |
---|---|
void |
changeUserStatus(IMUser.IMUserStatus imUserStatus)
Changes the user status related to the connection established with IM
server
|
void |
close()
Closes the connection established with IM server.
|
void |
configure(java.util.Properties properties)
Configures the session using the properties specified.
|
IMMessageHandler |
createMessageHandler(IMUser partner)
Creates a new message handler allowing objects to do operations like
sending new messages, closing the conversation or verifying if the
conversation is still opened
|
IMResolveHandler |
createResolveHandler(boolean onlyUnique,
boolean exhaustiveLookup)
Creates and returns a resolve object
|
IMUserStatusHandler |
createUserStatusHandler()
Creates a new user status handler allowing listener objects to be
registered to be notified when some user changes his/her IM status
|
long |
getConnectionTimeout()
Returns the connection timeout
|
long |
getDefaultConnectionTimeout()
Returns the default connection timeout
|
long |
getDefaultResolveTimeout()
Returns the default resolve timeout
|
IMUser |
getIMUser()
Returns the IMUser object related to the user account used to open this
IM chat session.
|
long |
getResolveTimeout()
Returns the resolve timeout
|
java.lang.String |
getServerHostName() |
java.lang.String |
getSessionName()
Returns the session name
|
java.lang.String |
getUserId() |
java.lang.String |
getUserPassword() |
boolean |
isOpened() |
void |
open()
Connects to the IM server using the information set using
configure(Properties) method. |
void |
registerIMSingleListener(IMSingleListener listener)
Registers a new listener for handling incoming messages.
|
void |
removeIMSingleListener(IMSingleListener listener)
Remove the specified IMSingleListener
|
IMUser |
resolve(java.lang.String userDisplayName)
Resolves the user identified by userDisplayName parameter.
|
IMResolveEvent |
resolve(java.lang.String userDisplayName,
boolean onlyUnique,
boolean exhaustiveLookup)
Resolves the user identified by userDisplayName parameter.
|
void |
setConnectionTimeout(long timeout)
Defines the timeout used by method
open() . |
void |
setResolveTimeout(long timeout)
Defines the timeout used by method
resolve(String, boolean, boolean) . |
void configure(java.util.Properties properties) throws IMException
IMDriver.validateProperties(Properties)
can be used to make sure
that the properties are validproperties
- IMException
- if the properties are invalid or if the session could not be
createdjava.lang.String getServerHostName()
java.lang.String getSessionName()
java.lang.String getUserId()
java.lang.String getUserPassword()
IMUser getIMUser()
void open() throws IMException
configure(Properties)
method. This method uses a
connection timeout set by setConnectionTimeout(long)
,
and not returns until the timeout is over or the connection opens. So,
this method is blocking (bolcks the current thread). A not blockiing
method to open a session will be available soon.IMException
- if it is not possible to open the session (invalid user or
password, for example), or if the connection timeout has
finishedvoid changeUserStatus(IMUser.IMUserStatus imUserStatus) throws IMException
imUserStatus
- IMException
- if the IM session is not openedlong getDefaultConnectionTimeout()
long getConnectionTimeout()
void setConnectionTimeout(long timeout)
open()
. If a
connection timeout is not set, the default value will be used. The
default connection timeout value can be got using the
getDefaultConnectionTimeout()
methodtimeout
- boolean isOpened()
void close() throws IMException
IMException
- if some error occurs during the closing operationlong getDefaultResolveTimeout()
long getResolveTimeout()
void setResolveTimeout(long timeout)
resolve(String, boolean, boolean)
. If a resolve
timeout is not set, the default value will be used. The default resolve
timeout value can be got using the
getDefaultResolveTimeout()
methodtimeout
- IMResolveEvent resolve(java.lang.String userDisplayName, boolean onlyUnique, boolean exhaustiveLookup) throws IMException
IMResolveHandler
object and a
IMResolveListener
class if you don't want to block your thread to
use this function.userDisplayName
- onlyUnique
- This option determines if it should resolve successfully only
if the provided name is matched exactly in the IM directoryexhaustiveLookup
- This option determines if it should perform an exhaustive
lookup through all directories or stop in the first directory
where a match is foundSTUser
object or to know the reason that it could not be
generatedIMException
- if the session is not opened, or if the resolve operation is
not concluded in X milliseconds. X can be set using
setResolveTimeout(long)
methodcreateResolveHandler(boolean, boolean)
IMUser resolve(java.lang.String userDisplayName) throws IMException
IMResolveHandler
object and a
IMResolveListener
class if you don't want to block your thread to
use this function. This method returns a user resolve only if the display
name is exactly equal to the existent in serveruserDisplayName
- IMException
- if the session is not opened, or if the resolve operation is
not concluded in X milliseconds. X can be set using
setResolveTimeout(long)
methodcreateResolveHandler(boolean, boolean)
IMResolveHandler createResolveHandler(boolean onlyUnique, boolean exhaustiveLookup) throws IMException
onlyUnique
- This option determines whether the created resolver object
should resolve successfully only if the provided name is
matched exactly in the IM directoryexhaustiveLookup
- This option determines whether the created resolver object
should perform an exhaustive lookup through all directories or
stop in the first directory where a match is foundIMException
- if this session is not opened yet, or if the partner can not
be resolvedIMUserStatusHandler createUserStatusHandler() throws IMException
IMException
- if this session is not opened yetIMMessageHandler createMessageHandler(IMUser partner) throws IMException
IMException
- if this session is not opened yetvoid registerIMSingleListener(IMSingleListener listener) throws IMException
listener
- IMException
void removeIMSingleListener(IMSingleListener listener) throws IMException
listener
- IMException