Fire signal on subscription approval

This commit is contained in:
fiaxh 2018-07-30 00:00:56 +02:00
parent 063d0146f9
commit 2e5977df96
2 changed files with 8 additions and 0 deletions

View file

@ -10,6 +10,7 @@ public class PresenceManager : StreamInteractionModule, Object {
public signal void show_received(Show show, Jid jid, Account account); public signal void show_received(Show show, Jid jid, Account account);
public signal void received_subscription_request(Jid jid, Account account); public signal void received_subscription_request(Jid jid, Account account);
public signal void received_subscription_approval(Jid jid, Account account);
private StreamInteractor stream_interactor; private StreamInteractor stream_interactor;
private HashMap<Jid, HashMap<Jid, ArrayList<Show>>> shows = new HashMap<Jid, HashMap<Jid, ArrayList<Show>>>(Jid.hash_bare_func, Jid.equals_bare_func); private HashMap<Jid, HashMap<Jid, ArrayList<Show>>> shows = new HashMap<Jid, HashMap<Jid, ArrayList<Show>>>(Jid.hash_bare_func, Jid.equals_bare_func);
@ -94,6 +95,9 @@ public class PresenceManager : StreamInteractionModule, Object {
} }
received_subscription_request(jid, account); received_subscription_request(jid, account);
}); });
stream_interactor.module_manager.get_module(account, Presence.Module.IDENTITY).received_subscription_approval.connect((stream, jid) => {
received_subscription_approval(jid, account);
});
} }
private void on_received_available_show(Account account, Jid jid, string show) { private void on_received_available_show(Account account, Jid jid, string show) {

View file

@ -11,6 +11,7 @@ namespace Xmpp.Presence {
public signal void received_available_show(XmppStream stream, Jid jid, string show); public signal void received_available_show(XmppStream stream, Jid jid, string show);
public signal void received_unavailable(XmppStream stream, Presence.Stanza presence); public signal void received_unavailable(XmppStream stream, Presence.Stanza presence);
public signal void received_subscription_request(XmppStream stream, Jid jid); public signal void received_subscription_request(XmppStream stream, Jid jid);
public signal void received_subscription_approval(XmppStream stream, Jid jid);
public signal void received_unsubscription(XmppStream stream, Jid jid); public signal void received_unsubscription(XmppStream stream, Jid jid);
public bool available_resource = true; public bool available_resource = true;
@ -79,6 +80,9 @@ namespace Xmpp.Presence {
case Presence.Stanza.TYPE_SUBSCRIBE: case Presence.Stanza.TYPE_SUBSCRIBE:
received_subscription_request(stream, presence.from); received_subscription_request(stream, presence.from);
break; break;
case Presence.Stanza.TYPE_SUBSCRIBED:
received_subscription_approval(stream, presence.from);
break;
case Presence.Stanza.TYPE_UNSUBSCRIBE: case Presence.Stanza.TYPE_UNSUBSCRIBE:
stream.get_flag(Flag.IDENTITY).remove_presence(presence.from); stream.get_flag(Flag.IDENTITY).remove_presence(presence.from);
received_unsubscription(stream, presence.from); received_unsubscription(stream, presence.from);