aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/roster
diff options
context:
space:
mode:
authorSamuel Hand <samuel.d.hand@gmail.com>2018-08-10 01:40:20 +0100
committerSamuel Hand <samuel.d.hand@gmail.com>2018-08-10 01:40:20 +0100
commit8ebc2c5dd333ce19c9e0592ee1feb8eed6e1a48f (patch)
tree4f5a7b77dc51470fa59b67f66e80beb7bb798901 /xmpp-vala/src/module/roster
parent36cc8b039338442512f0e86d9487d951b5f2c6e3 (diff)
downloaddino-8ebc2c5dd333ce19c9e0592ee1feb8eed6e1a48f.tar.gz
dino-8ebc2c5dd333ce19c9e0592ee1feb8eed6e1a48f.zip
Fix mutual subscription detection
Diffstat (limited to 'xmpp-vala/src/module/roster')
-rw-r--r--xmpp-vala/src/module/roster/module.vala5
1 files changed, 5 insertions, 0 deletions
diff --git a/xmpp-vala/src/module/roster/module.vala b/xmpp-vala/src/module/roster/module.vala
index 5b15a43a..2d36211d 100644
--- a/xmpp-vala/src/module/roster/module.vala
+++ b/xmpp-vala/src/module/roster/module.vala
@@ -11,6 +11,7 @@ public class Module : XmppStreamModule, Iq.Handler {
public signal void pre_get_roster(XmppStream stream, Iq.Stanza iq);
public signal void item_removed(XmppStream stream, Item item, Iq.Stanza iq);
public signal void item_updated(XmppStream stream, Item item, Iq.Stanza iq);
+ public signal void mutual_subscription(XmppStream stream, Jid jid);
public bool interested_resource = true;
@@ -55,8 +56,12 @@ public class Module : XmppStreamModule, Iq.Handler {
item_removed(stream, item, iq);
break;
default:
+ bool is_new = false;
+ Item old = flag.get_item(item.jid);
+ is_new = item.subscription == Item.SUBSCRIPTION_BOTH && (old == null || old.subscription == Item.SUBSCRIPTION_BOTH);
flag.roster_items[item.jid] = item;
item_updated(stream, item, iq);
+ if(is_new) mutual_subscription(stream, item.jid);
break;
}
}