mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-23 06:42:05 +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:
parent
34f3389a1e
commit
319dcd408f
1 changed files with 26 additions and 0 deletions
|
@ -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.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue