diff --git a/source/org/jivesoftware/smack/packet/Presence.java b/source/org/jivesoftware/smack/packet/Presence.java
index a730146f8..1110ef908 100644
--- a/source/org/jivesoftware/smack/packet/Presence.java
+++ b/source/org/jivesoftware/smack/packet/Presence.java
@@ -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 getType() == Presence.Type.available.
+ *
+ * @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
+ * type == Type.available && (mode == Mode.away || mode == Mode.xa || mode == Mode.dnd).
+ *
+ * @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.
*