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 namespace agsXMPP.protocol.extensions.pubsub.@event
25 {
26     /*
27         <message from='pubsub.shakespeare.lit' to='francisco@denmark.lit' id='foo'>
28           <event xmlns='http://jabber.org/protocol/pubsub#event'>
29             <items node='blogs/princely_musings'>
30               <item id='ae890ac52d0df67ed7cfdf51b644e901'>
31                 <entry xmlns='http://www.w3.org/2005/Atom'>
32                   <title>Soliloquy</title>
33                   <summary>
34                         To be, or not to be: that is the question:
35                         Whether 'tis nobler in the mind to suffer
36                         The slings and arrows of outrageous fortune,
37                         Or to take arms against a sea of troubles,
38                         And by opposing end them?
39                   </summary>
40                   <link rel='alternate' type='text/html'
41                         href='http://denmark.lit/2003/12/13/atom03'/>
42                   <id>tag:denmark.lit,2003:entry-32397</id>
43                   <published>2003-12-13T18:30:02Z</published>
44                   <updated>2003-12-13T18:30:02Z</updated>
45                 </entry>
46               </item>
47             </items>
48           </event>
49         </message>
50 
51         <xs:element name='item'>
52             <xs:complexType>
53               <xs:choice minOccurs='0'>
54                 <xs:element name='retract' type='empty'/>
55                 <xs:any namespace='##other'/>
56               </xs:choice>
57               <xs:attribute name='id' type='xs:string' use='optional'/>
58             </xs:complexType>
59         </xs:element>
60     */
61 
62     // This class is the same as the Item class in the main pubsub namespace,
63     // so inherit it and overwrite some properties and functions
64 
65     public class Item : agsXMPP.protocol.extensions.pubsub.Item
66     {
67         #region << Constructors >>
68         public Item() : base()
69         {
70             this.Namespace = Uri.PUBSUB_EVENT;
71         }
72 
73         public Item(string id) : this()
74         {
75             this.Id = id;
76         }
77         #endregion
78 
79         private const string RETRACT = "retract";
80 
81         public bool Retract
82         {
83             get { return HasTag(RETRACT); }
84             set
85             {
86                 if (value)
87                     SetTag(RETRACT);
88                 else
89                     RemoveTag(RETRACT);
90             }
91         }
92     }
93 }
94