pl.mn.communicator
Class DefaultPresenceService

java.lang.Object
  extended by pl.mn.communicator.DefaultPresenceService
All Implemented Interfaces:
IPresenceService

public class DefaultPresenceService
extends java.lang.Object
implements IPresenceService

The implementation of IPresenceService.

Created on 2004-11-28

Version:
$Id: DefaultPresenceService.java,v 1.1 2005/11/05 23:34:52 winnetou25 Exp $
Author:
Mateusz Szczap

Constructor Summary
DefaultPresenceService(Session session)
           
 
Method Summary
 void addMonitoredUser(IUser user)
          Adds the user to be monitored.
 void addUserListener(UserListener userListener)
          Adds UserListener to the list of listeners that will be notified of status related events.
 void changeMonitoredUserStatus(IUser user)
          Changes status of the currently monitored user.
 java.util.Collection getMonitoredUsers()
          Returns collections of the users that are currently being monitored.
 ILocalStatus getStatus()
          Returns the actual status of the user that is logged in.
protected  void notifyLocalUserChangedStatus(ILocalStatus localStatus)
           
protected  void notifyUserChangedStatus(IUser user, IRemoteStatus newStatus)
           
 void removeMonitoredUser(IUser user)
          Remove the user that was previously being monitored.
 void removeUserListener(UserListener userListener)
          Removes UserListener from the list of listeners that will be notified of status related events.
 void setStatus(ILocalStatus localStatus)
          Invocation of this method tries to set a new status of the user that is currently logged in.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPresenceService

DefaultPresenceService(Session session)
Method Detail

setStatus

public void setStatus(ILocalStatus localStatus)
               throws GGException
Description copied from interface: IPresenceService
Invocation of this method tries to set a new status of the user that is currently logged in.

Specified by:
setStatus in interface IPresenceService
Parameters:
localStatus - the new status to be set.
Throws:
GGException - if there is an error while setting status.
GGSessionException - if user is not logged in.
See Also:
IPresenceService.setStatus(pl.mn.communicator.ILocalStatus)

getStatus

public ILocalStatus getStatus()
Description copied from interface: IPresenceService
Returns the actual status of the user that is logged in.

Specified by:
getStatus in interface IPresenceService
Returns:
the actual status of the user.
See Also:
IPresenceService.getStatus()

addMonitoredUser

public void addMonitoredUser(IUser user)
                      throws GGException
Description copied from interface: IPresenceService
Adds the user to be monitored.

After adding the user UserListener's will receive events related to changing status of the user.

Note that you can also block the user using this method. After blocking the user you will no longer receive any messages from him/her.

Specified by:
addMonitoredUser in interface IPresenceService
Parameters:
user - that will be monitored or blocked.
Throws:
GGException - if there is an error while adding user to be monitored.
GGSessionException - if we are currently not logged in to the Gadu-Gadu server.
See Also:
IPresenceService.addMonitoredUser(pl.mn.communicator.IUser)

removeMonitoredUser

public void removeMonitoredUser(IUser user)
                         throws GGException
Description copied from interface: IPresenceService
Remove the user that was previously being monitored.

Specified by:
removeMonitoredUser in interface IPresenceService
Parameters:
user - that we want to unregister from being monitored.
Throws:
GGException - if there is an error while removing user from being monitored or if the user is not being monitored.
GGSessionException - if we are currently not logged in to the Gadu-Gadu server
See Also:
IPresenceService.removeMonitoredUser(pl.mn.communicator.IUser)

changeMonitoredUserStatus

public void changeMonitoredUserStatus(IUser user)
                               throws GGException
Description copied from interface: IPresenceService
Changes status of the currently monitored user.

Specified by:
changeMonitoredUserStatus in interface IPresenceService
Parameters:
user - that contains a new status to be changed.
Throws:
GGException - if there is an error while changing status of the user or if the user is not being monitored.
GGSessionException - if we are currently not logged in to the Gadu-Gadu server.
See Also:
IPresenceService.changeMonitoredUserStatus(pl.mn.communicator.IUser)

getMonitoredUsers

public java.util.Collection getMonitoredUsers()
Description copied from interface: IPresenceService
Returns collections of the users that are currently being monitored. Note that it is unmodifiable collection therefore you cannot modify it.

Specified by:
getMonitoredUsers in interface IPresenceService
Returns:
Collection unmodifiable collection of users that are currently being monitored.
See Also:
IPresenceService.getMonitoredUsers()

addUserListener

public void addUserListener(UserListener userListener)
Description copied from interface: IPresenceService
Adds UserListener to the list of listeners that will be notified of status related events.

Specified by:
addUserListener in interface IPresenceService
Parameters:
userListener - the UserListener object that will be notified.
See Also:
IPresenceService.addUserListener(pl.mn.communicator.event.UserListener)

removeUserListener

public void removeUserListener(UserListener userListener)
Description copied from interface: IPresenceService
Removes UserListener from the list of listeners that will be notified of status related events.

Specified by:
removeUserListener in interface IPresenceService
Parameters:
userListener - the UserListener object that will no longer be notified.
See Also:
IPresenceService.removeUserListener(pl.mn.communicator.event.UserListener)

notifyUserChangedStatus

protected void notifyUserChangedStatus(IUser user,
                                       IRemoteStatus newStatus)
                                throws GGException
Throws:
GGException

notifyLocalUserChangedStatus

protected void notifyLocalUserChangedStatus(ILocalStatus localStatus)
                                     throws GGException
Throws:
GGException


Copyright 2004-2004-2005 SourceForge.net. All Rights Reserved.