public void TestBuildAffiliations() { var affs = new Affiliations { Node = "princely_musings" }; affs.AddAffiliation(new Affiliation { Jid = "*****@*****.**", AffiliationType = AffiliationType.Owner }); affs.AddAffiliation(new Affiliation { Jid = "*****@*****.**", AffiliationType = AffiliationType.Outcast }); affs.ShouldBe(Resource.Get("Xmpp.PubSub.Owner.affiliations1.xml")); }
/// <summary> /// Builds the modify affiliations stanza. /// </summary> /// <param name="to">Jid of the PubSub service.</param> /// <param name="node">The node.</param> /// <param name="affiliations">The affiliations.</param> /// <returns></returns> public static Iq ModifyAffiliations(Jid to, string node, Xmpp.PubSub.Owner.Affiliation[] affiliations) { /* * <iq type='get' * from='[email protected]/elsinore' * to='pubsub.shakespeare.lit' * id='ent1'> * <pubsub xmlns='http://jabber.org/protocol/pubsub#owner'> * <affiliations node='princely_musings'/> * </pubsub> * </iq> */ var affs = new Matrix.Xmpp.PubSub.Owner.Affiliations { Node = node }; foreach (Xmpp.PubSub.Owner.Affiliation affiliation in affiliations) { affs.AddAffiliation(affiliation); } return(new PubSubOwnerIq { Type = IqType.Set, To = to, PubSub = { Affiliations = affs }, }); }