aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala
diff options
context:
space:
mode:
Diffstat (limited to 'xmpp-vala')
-rw-r--r--xmpp-vala/src/module/roster/item.vala26
1 files changed, 16 insertions, 10 deletions
diff --git a/xmpp-vala/src/module/roster/item.vala b/xmpp-vala/src/module/roster/item.vala
index 78974a35..4c9f30ef 100644
--- a/xmpp-vala/src/module/roster/item.vala
+++ b/xmpp-vala/src/module/roster/item.vala
@@ -4,12 +4,10 @@ namespace Xmpp.Roster {
public class Item {
- public const string NODE_JID = "jid";
- public const string NODE_NAME = "name";
- public const string NODE_SUBSCRIPTION = "subscription";
-
public const string SUBSCRIPTION_NONE = "none";
+ /** the user has a subscription to the contact's presence, but the contact does not have a subscription to the user's presence */
public const string SUBSCRIPTION_TO = "to";
+ /** the contact has a subscription to the user's presence, but the user does not have a subscription to the contact's presence */
public const string SUBSCRIPTION_FROM = "from";
public const string SUBSCRIPTION_BOTH = "both";
public const string SUBSCRIPTION_REMOVE = "remove";
@@ -20,23 +18,31 @@ public class Item {
public Jid? jid {
get {
try {
- return jid_ ?? (jid_ = new Jid(stanza_node.get_attribute(NODE_JID)));
+ return jid_ ?? (jid_ = new Jid(stanza_node.get_attribute("jid")));
} catch (InvalidJidError e) {
warning("Ignoring invalid Jid in roster entry: %s", e.message);
return null;
}
}
- set { stanza_node.set_attribute(NODE_JID, value.to_string()); }
+ set { stanza_node.set_attribute("jid", value.to_string()); }
}
public string? name {
- get { return stanza_node.get_attribute(NODE_NAME); }
- set { if (value != null) stanza_node.set_attribute(NODE_NAME, value); }
+ get { return stanza_node.get_attribute("name"); }
+ set { if (value != null) stanza_node.set_attribute("name", value); }
}
public string? subscription {
- get { return stanza_node.get_attribute(NODE_SUBSCRIPTION); }
- set { if (value != null) stanza_node.set_attribute(NODE_SUBSCRIPTION, value); }
+ get { return stanza_node.get_attribute("subscription"); }
+ set { if (value != null) stanza_node.set_attribute("subscription", value); }
+ }
+
+ public string? ask {
+ get { return stanza_node.get_attribute("ask"); }
+ }
+
+ public bool subscription_requested {
+ get { return this.ask != null; }
}
public Item() {