/*
* Jeti, a Java Jabber client, Copyright (C) 2001 E.S. de Boer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* For questions, comments etc,
* use the website at http://jeti.jabberstudio.org
* or mail/IM me at jeti@jabber.org
*
* Created on 9-jan-2005
*/
package nu.fw.jeti.jabber;
import java.util.List;
import javax.swing.ImageIcon;
/**
* Keeps a JID and the information about that JID together.
* The JIDStatus is implemented in three classes
*
* - {@link nu.fw.jeti.backend.roster.PrimaryJIDStatus}
* - {@link nu.fw.jeti.backend.roster.NormalJIDStatus}
* - {@link nu.fw.jeti.backend.roster.ResourceJIDStatus}
*
* These classes are part of the roster and are used to store and sort
* information about the nickname and resources. This abstract class makes the most
* used methods of those classes available, so the implementing classes are rarely needed.
* The JIDStatussen available in the roster can be obtained by {@link Backend#getJIDStatus(JID)}
* If you need your own jidstatus you can use {@link UnknownJIDStatus}
* @author E.S. de Boer
* @version 1.0
*/
public abstract class JIDStatus implements Comparable
{
protected ImageIcon avatar;
protected boolean online = false;
protected int show;
protected String status;
protected JID completeJID;
/**
* get users Avatar, only works when an avatar plugin is enabled
* @return users avatar or null when none found
*/
public ImageIcon getAvatar()
{
return avatar;
}
/**
* Gets the JID associated with this JIDStatus.
* @return the JID whitout resource associated with this JIDStatus.
*/
public abstract JID getJID();
/**
* Gets the JID with resource associated with this JIDStatus.
* @return If there is a known resource the JID with resource,
* else the JID without the resource.
*/
public JID getCompleteJID(){return completeJID;}
/**
* Returns true when the user is online.
* @return true when the user is online.
*/
public boolean isOnline()
{
return online;
}
/**
* Gets the Show status of this JIDStatus.
* one of "chat", "available", "away", "dnd", "xa" or "unavailable".
* @return The show status of this JIDStatus.
*/
public int getShow()
{
return show;
}
/**
* Gets the status of this JIDStatus, status is the user defined
* message (status can be null).
* @return The status of this JIDStatus.
*/
public String getStatus()
{
return status;
}
/**
* Gets the nickname of this JIDStatus.
* If the nickname is unknown this method returns the
* JID assiocated with this JIDStatus.
* @return The nickname
*/
public abstract String getNick();
/**
* Gets the type of the transport this JIDStatus is registerd with.
* initialy this is "jabber". The type is browsed for the registerd transports,
* if the browse succeeded the type is changed in the type of the transport, when
* the browse fails the type is changed to "unknown".
* @return The type of this JIDStatus.
*/
public abstract String getType();
/**
* Gets the subscription type of this JIDStatus
* can be null, "none" , "to", "from", or "both".
* @return The subscription type of this JIDStatus.
*/
public abstract String getSubscription();
/**
* Gets the waiting status of this JIDStatus
* can be null, "subscribe" or "unsubscribe".
* @return The waiting status of this JIDStatus.
*/
public abstract String getWaiting();
/**
*
* @return copy of the groups.
*/
public abstract List getGroupsCopy();
/**
* Counts the groups this JIDStatus is in.
* @return The number of groups this JIDStatus is in.
*/
abstract public int groupCount();
/**
* Returns true when this JIDStatus is in group.
* @param group The group that is tested.
* @return true when this JIDStatus is in group.
*/
abstract public boolean isGroupPresent(String group);
}
/*
* Overrides for emacs
* Local variables:
* tab-width: 4
* End:
*/