public void removeContact(Jid contactJid) { // 2.5.1. Delete Roster Item var iq = new agsXMPP.protocol.iq.roster.RosterIq(IqType.set); var item = new agsXMPP.protocol.iq.roster.RosterItem(contactJid); item.Subscription = agsXMPP.protocol.iq.roster.SubscriptionType.remove; iq.Query.AddRosterItem(item); iq.GenerateId(); conn.Send(iq); var pres1 = new Presence(); pres1.Type = PresenceType.unsubscribe; pres1.To = contactJid; pres1.GenerateId(); conn.Send(pres1); var pres2 = new Presence(); pres2.Type = PresenceType.unsubscribed; pres2.To = contactJid; conn.Send(pres2); }
public void addContact(Jid contactJid) { // 2.3.1. Add Roster Item var iq = new agsXMPP.protocol.iq.roster.RosterIq(IqType.set); iq.Query.AddRosterItem(new agsXMPP.protocol.iq.roster.RosterItem(contactJid)); iq.GenerateId(); conn.Send(iq); // 3.1.1 Subscription Request var pres1 = new Presence(); pres1.Type = PresenceType.subscribe; pres1.To = contactJid; pres1.GenerateId(); conn.Send(pres1); // 3.4.1. Subscription Pre-Approval var pres2 = new Presence(); pres2.Type = PresenceType.subscribed; pres2.To = contactJid; conn.Send(pres2); }