Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.icq
Class ContactIcqImpl

java.lang.Object
  extended by net.java.sip.communicator.impl.protocol.icq.ContactIcqImpl
All Implemented Interfaces:
Contact

public class ContactIcqImpl
extends Object
implements Contact

The ICQ implementation of the service.protocol.Contact interface.

Author:
Emil Ivov

Field Summary
(package private)  net.kano.joustsim.oscar.oscar.service.ssi.Buddy joustSimBuddy
           
 
Constructor Summary
ContactIcqImpl(net.kano.joustsim.oscar.oscar.service.ssi.Buddy buddy, ServerStoredContactListIcqImpl ssclCallback, boolean isPersistent, boolean isResolved)
          Creates an IcqContactImpl
 
Method Summary
 boolean equals(Object obj)
          Indicates whether some other object is "equal to" this one.
 String getAddress()
          Returns the ICQ uin (or AIM screen name)of this contact
 String getDisplayName()
          Returns a String that could be used by any user interacting modules for referring to this contact.
 byte[] getImage()
          Checks if an avatar or an image already exists for this contact and returns it.
(package private)  net.kano.joustsim.oscar.oscar.service.ssi.Buddy getJoustSimBuddy()
          Returns the joust sim buddy that this Contact is encapsulating.
 ContactGroup getParentContactGroup()
          Returns a reference to the contact group that this contact is currently a child of or null if the underlying protocol does not suppord persistent presence.
 String getPersistentData()
          Returns the persistent data - for now only the nickname is needed for restoring the contact data.
 PresenceStatus getPresenceStatus()
          Returns the status of the contact as per the last status update we've received for it.
 ProtocolProviderService getProtocolProvider()
          Returns a reference to the protocol provider that created the contact.
 String getStatusMessage()
          Return the current status message of this contact.
 String getUIN()
          Returns the ICQ uin (or AIM screen name)of this contact
 int hashCode()
          Returns a hashCode for this contact.
 boolean isLocal()
          Determines whether or not this Contact instance represents the user used by this protocol provider to connect to the service.
 boolean isPersistent()
          Determines whether or not this contact is being stored by the server.
 boolean isResolved()
          Determines whether or not this contact has been resolved against the server.
protected  void setImage(byte[] image)
          Used to set the image of the contact if it is updated
(package private)  void setJoustSimBuddy(net.kano.joustsim.oscar.oscar.service.ssi.Buddy newBuddy)
          Changes the buddy encapsulated by this method to be newBuddy.
protected  void setNickname(String nickname)
          Used to set the nickname of the contact if it is update in the ContactList
(package private)  void setPersistent(boolean persistent)
          Specifies whether this contact is to be considered persistent or not.
 void setPersistentData(String persistentData)
           
(package private)  void setResolved(boolean resolved)
          Specifies whether this contact has been resolved, or in other words that its presence in the server stored contact list has been confirmed.
protected  void setStatusMessage(String statusMessage)
          Sets the current status message for this contact
 String toString()
          Returns a string representation of this contact, containing most of its representative details.
(package private)  void updatePresenceStatus(PresenceStatus status)
          Sets the status that this contact is currently in.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

joustSimBuddy

net.kano.joustsim.oscar.oscar.service.ssi.Buddy joustSimBuddy
Constructor Detail

ContactIcqImpl

ContactIcqImpl(net.kano.joustsim.oscar.oscar.service.ssi.Buddy buddy,
               ServerStoredContactListIcqImpl ssclCallback,
               boolean isPersistent,
               boolean isResolved)
Creates an IcqContactImpl

Parameters:
buddy - the JoustSIM object that we will be encapsulating.
ssclCallback - a reference to the ServerStoredContactListIcqImpl instance that created us.
isPersistent - determines whether this contact is persistent or not.
isResolved - specifies whether the contact has been resolved against the server contact list
Method Detail

getUIN

public String getUIN()
Returns the ICQ uin (or AIM screen name)of this contact

Returns:
the ICQ uin (or AIM screen name)of this contact

getAddress

public String getAddress()
Returns the ICQ uin (or AIM screen name)of this contact

Specified by:
getAddress in interface Contact
Returns:
the ICQ uin (or AIM screen name)of this contact

isLocal

public boolean isLocal()
Determines whether or not this Contact instance represents the user used by this protocol provider to connect to the service.

Returns:
true if this Contact represents us (the local user) and false otherwise.

getImage

public byte[] getImage()
Checks if an avatar or an image already exists for this contact and returns it. This method DOES NOT perform any network operations.

Specified by:
getImage in interface Contact
Returns:
byte[] an image representing the contact.

hashCode

public int hashCode()
Returns a hashCode for this contact. The returned hashcode is actually that of the Contact's UIN

Overrides:
hashCode in class Object
Returns:
the hashcode of this Contact

equals

public boolean equals(Object obj)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class Object
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.

getJoustSimBuddy

net.kano.joustsim.oscar.oscar.service.ssi.Buddy getJoustSimBuddy()
Returns the joust sim buddy that this Contact is encapsulating.

Returns:
Buddy

toString

public String toString()
Returns a string representation of this contact, containing most of its representative details.

Overrides:
toString in class Object
Returns:
a string representation of this contact.

setJoustSimBuddy

void setJoustSimBuddy(net.kano.joustsim.oscar.oscar.service.ssi.Buddy newBuddy)
Changes the buddy encapsulated by this method to be newBuddy. This method is to be used _only_ when converting a non-persistent buddy into a normal one.

Parameters:
newBuddy - the new Buddy reference that this contact will encapsulate.

updatePresenceStatus

void updatePresenceStatus(PresenceStatus status)
Sets the status that this contact is currently in. The method is to only be called as a result of a status update received from the AIM server.

Parameters:
status - the IcqStatusEnum that this contact is currently in.

getPresenceStatus

public PresenceStatus getPresenceStatus()
Returns the status of the contact as per the last status update we've received for it. Note that this method is not to perform any network operations and will simply return the status received in the last status update message. If you want a reliable way of retrieving someone's status, you should use the queryContactStatus() method in OperationSetPresence.

Specified by:
getPresenceStatus in interface Contact
Returns:
the PresenceStatus that we've received in the last status update pertaining to this contact.

getDisplayName

public String getDisplayName()
Returns a String that could be used by any user interacting modules for referring to this contact. An alias is not necessarily unique but is often more human readable than an address (or id).

Specified by:
getDisplayName in interface Contact
Returns:
a String that can be used for referring to this contact when interacting with the user.

setNickname

protected void setNickname(String nickname)
Used to set the nickname of the contact if it is update in the ContactList

Parameters:
nickname - String the value

getParentContactGroup

public ContactGroup getParentContactGroup()
Returns a reference to the contact group that this contact is currently a child of or null if the underlying protocol does not suppord persistent presence.

Specified by:
getParentContactGroup in interface Contact
Returns:
a reference to the contact group that this contact is currently a child of or null if the underlying protocol does not suppord persistent presence.

getProtocolProvider

public ProtocolProviderService getProtocolProvider()
Returns a reference to the protocol provider that created the contact.

Specified by:
getProtocolProvider in interface Contact
Returns:
a refererence to an instance of the ProtocolProviderService

isPersistent

public boolean isPersistent()
Determines whether or not this contact is being stored by the server. Non persistent contacts are common in the case of simple, non-persistent presence operation sets. They could however also be seen in persistent presence operation sets when for example we have received an event from someone not on our contact list. Non persistent contacts are volatile even when coming from a persistent presence op. set. They would only exist until the application is closed and will not be there next time it is loaded.

Specified by:
isPersistent in interface Contact
Returns:
true if the contact is persistent and false otherwise.

setPersistent

void setPersistent(boolean persistent)
Specifies whether this contact is to be considered persistent or not. The method is to be used _only_ when a non-persistent contact has been added to the contact list and its encapsulated VolatileBuddy has been repalced with a standard joustsim buddy.

Parameters:
persistent - true if the buddy is to be considered persistent and false for volatile.

setResolved

void setResolved(boolean resolved)
Specifies whether this contact has been resolved, or in other words that its presence in the server stored contact list has been confirmed. Unresolved contacts are created by services which need to quickly obtain a reference to the contact corresponding to a specific address possibly even before logging on the net.

Parameters:
resolved - true if the buddy is resolved against the server stored contact list and false otherwise.

getPersistentData

public String getPersistentData()
Returns the persistent data - for now only the nickname is needed for restoring the contact data. Fields are properties separated by ;

Specified by:
getPersistentData in interface Contact
Returns:
the persistent data

isResolved

public boolean isResolved()
Determines whether or not this contact has been resolved against the server. Unresolved contacts are used when initially loading a contact list that has been stored in a local file until the presence operation set has managed to retrieve all the contact list from the server and has properly mapped contacts to their on-line buddies.

Specified by:
isResolved in interface Contact
Returns:
true if the contact has been resolved (mapped against a buddy) and false otherwise.

setPersistentData

public void setPersistentData(String persistentData)

setImage

protected void setImage(byte[] image)
Used to set the image of the contact if it is updated

Parameters:
image - a photo/avatar associated with this contact.

getStatusMessage

public String getStatusMessage()
Return the current status message of this contact.

Specified by:
getStatusMessage in interface Contact
Returns:
the current status message

setStatusMessage

protected void setStatusMessage(String statusMessage)
Sets the current status message for this contact

Parameters:
statusMessage - the message

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.