1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 20:12:07 +01:00

Added convenience methods (SMACK-200).

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@7179 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Matt Tucker 2007-02-17 19:43:44 +00:00 committed by matt
parent 34f3389a1e
commit 319dcd408f

View file

@ -87,6 +87,32 @@ public class Presence extends Packet {
this.mode = mode;
}
/**
* Returns true if the {@link Type presence type} is available (online) and
* false if the user is unavailable (offline), or if this is a presence packet
* involved in a subscription operation. This is a convenience method
* equivalent to <tt>getType() == Presence.Type.available</tt>.
*
* @return true if the presence type is available.
*/
public boolean isAvailable() {
return type == Type.available;
}
/**
* Returns true if the presence type is {@link Type#available available} and the presence
* mode is {@link Mode#away away}, {@link Mode#xa extended away}, or
* {@link Mode#dnd do not disturb}. False will be returned when the type or mode
* is any other value, including when the presence type is unavailable (offline).
* This is a convenience method equivalent to
* <tt>type == Type.available && (mode == Mode.away || mode == Mode.xa || mode == Mode.dnd)</tt>.
*
* @return true if the presence type is available and the presence mode is away, xa, or dnd.
*/
public boolean isAway() {
return type == Type.available && (mode == Mode.away || mode == Mode.xa || mode == Mode.dnd);
}
/**
* Returns the type of this presence packet.
*