1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 * Copyright (c) 2003-2012 by AG-Software * 3 * All Rights Reserved. * 4 * Contact information for AG-Software is available at http://www.ag-software.de * 5 * * 6 * Licence: * 7 * The agsXMPP SDK is released under a dual licence * 8 * agsXMPP can be used under either of two licences * 9 * * 10 * A commercial licence which is probably the most appropriate for commercial * 11 * corporate use and closed source projects. * 12 * * 13 * The GNU Public License (GPL) is probably most appropriate for inclusion in * 14 * other open source projects. * 15 * * 16 * See README.html for details. * 17 * * 18 * For general enquiries visit our website at: * 19 * http://www.ag-software.de * 20 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 22 using System; 23 24 using agsXMPP.Xml.Dom; 25 26 namespace agsXMPP.protocol.extensions.pubsub.owner 27 { 28 /* 29 <iq type='result' 30 from='pubsub.shakespeare.lit' 31 to='hamlet@denmark.lit/elsinore' 32 id='ent1'> 33 <pubsub xmlns='http://jabber.org/protocol/pubsub#owner'> 34 <affiliates node='blogs/princely_musings'> 35 <affiliate jid='hamlet@denmark.lit' affiliation='owner'/> 36 <affiliate jid='polonius@denmark.lit' affiliation='outcast'/> 37 </affiliates> 38 </pubsub> 39 </iq> 40 41 42 <xs:element name='affiliates'> 43 <xs:complexType> 44 <xs:sequence> 45 <xs:element ref='affiliate' minOccurs='0' maxOccurs='unbounded'/> 46 </xs:sequence> 47 <xs:attribute name='node' type='xs:string' use='required'/> 48 </xs:complexType> 49 </xs:element> 50 */ 51 52 public class Affiliates : Element 53 { 54 #region << Constructors >> Affiliates()55 public Affiliates() 56 { 57 this.TagName = "affiliates"; 58 this.Namespace = Uri.PUBSUB_OWNER; 59 } 60 Affiliates(string node)61 public Affiliates(string node) : this() 62 { 63 this.Node = node; 64 } 65 #endregion 66 67 public string Node 68 { 69 get { return GetAttribute("node"); } 70 set { SetAttribute("node", value); } 71 } 72 73 /// <summary> 74 /// 75 /// </summary> 76 /// <returns></returns> AddAffiliate()77 public Affiliate AddAffiliate() 78 { 79 Affiliate affiliate = new Affiliate(); 80 AddChild(affiliate); 81 return affiliate; 82 } 83 84 /// <summary> 85 /// 86 /// </summary> 87 /// <param name="affiliate"></param> 88 /// <returns></returns> AddAffiliate(Affiliate affiliate)89 public Affiliate AddAffiliate(Affiliate affiliate) 90 { 91 AddChild(affiliate); 92 return affiliate; 93 } 94 95 /// <summary> 96 /// 97 /// </summary> 98 /// <param name="affiliates"></param> AddAffiliates(Affiliate[] affiliates)99 public void AddAffiliates(Affiliate[] affiliates) 100 { 101 foreach (Affiliate affiliate in affiliates) 102 { 103 AddAffiliate(affiliate); 104 } 105 } 106 107 /// <summary> 108 /// 109 /// </summary> 110 /// <returns></returns> GetAffiliates()111 public Affiliate[] GetAffiliates() 112 { 113 ElementList nl = SelectElements(typeof(Affiliate)); 114 Affiliate[] affiliates = new Affiliate[nl.Count]; 115 int i = 0; 116 foreach (Element e in nl) 117 { 118 affiliates[i] = (Affiliate)e; 119 i++; 120 } 121 return affiliates; 122 } 123 } 124 }