ObjXMPP  Diff

Differences From Artifact [fa28e0da2b]:

To Artifact [04990bb259]:


18
19
20
21
22
23
24


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

44
45

46
47

48
49

50
51

52
53

54
55
56
57
58
59
60
61
62
63
64


65
66
67
68
69
70
71
72
73
74
75
76
77



78
79
80
81
82
83
84
85
86
87
88


89
90
91
92
93
94
95
96
97
98
99
100
101



102
103
104
105
106
107
108

109
110
111
112
113
114
115

116
117
118
119
120
121
122


123
124
125

126
127
128
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

45
46

47
48

49
50

51
52

53
54

55
56
57
58
59
60
61
62
63
64


65
66
67
68
69
70
71
72
73
74
75
76



77
78
79
80
81
82
83
84
85
86
87
88


89
90
91
92
93
94
95
96
97
98
99
100



101
102
103
104
105
106
107
108
109

110
111
112
113
114
115
116

117
118
119
120
121
122
123

124
125
126


127










+
+


















-
+

-
+

-
+

-
+

-
+

-
+









-
-
+
+










-
-
-
+
+
+









-
-
+
+










-
-
-
+
+
+






-
+






-
+






-
+
+

-
-
+
-
-
-
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#import <ObjFW/ObjFW.h>

OF_ASSUME_NONNULL_BEGIN

@class XMPPDiscoIdentity;
@class XMPPJID;

/**
 * \brief A class describing a Service Discovery Node
 */
@interface XMPPDiscoNode: OFObject
{
	XMPPJID *_JID;
	OFString *_node;
	OFString *_name;
	OFSortedList *_identities;
	OFSortedList *_features;
	OFMutableDictionary *_childNodes;
}

/// \brief The JID this node lives on
@property (readonly) XMPPJID *JID;
@property (readonly, nonatomic) XMPPJID *JID;
/// \brief The node's opaque name of the node
@property (readonly) OFString *node;
@property (readonly, nonatomic) OFString *node;
/// \brief The node's human friendly name (may be unspecified)
@property (readonly) OFString *name;
@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *name;
/// \brief The node's list of identities
@property (readonly) OFSortedList *identities;
@property (readonly, nonatomic) OFSortedList *identities;
/// \brief The node's list of features
@property (readonly) OFSortedList *features;
@property (readonly, nonatomic) OFSortedList *features;
/// \brief The node's children
@property (readonly) OFDictionary *childNodes;
@property (readonly, nonatomic) OFDictionary *childNodes;

/**
 * \brief Creates a new autoreleased XMPPDiscoNode with the specified
 *	  JID and node
 *
 * \param JID The JID this node lives on
 * \param node The node's opaque name
 * \return A new autoreleased XMPPDiscoNode
 */
+ (instancetype)discoNodeWithJID: (XMPPJID*)JID
			    node: (OFString*)node;
+ (instancetype)discoNodeWithJID: (XMPPJID *)JID
			    node: (nullable OFString *)node;

/**
 * \brief Creates a new autoreleased XMPPDiscoNode with the specified
 *	  JID, node and name
 *
 * \param JID The JID this node lives on
 * \param node The node's opaque name
 * \param name The node's human friendly name
 * \return A new autoreleased XMPPDiscoNode
 */
+ (instancetype)discoNodeWithJID: (XMPPJID*)JID
			    node: (OFString*)node
			    name: (OFString*)name;
+ (instancetype)discoNodeWithJID: (XMPPJID *)JID
			    node: (nullable OFString *)node
			    name: (nullable OFString *)name;

/**
 * \brief Initializes an already allocated XMPPDiscoNode with the specified
 *	  JID and node
 *
 * \param JID The JID this node lives on
 * \param node The node's opaque name
 * \return An initialized XMPPDiscoNode
 */
- initWithJID: (XMPPJID*)JID
	 node: (OFString*)node;
- initWithJID: (XMPPJID *)JID
	 node: (nullable OFString *)node;

/**
 * \brief Initializes an already allocated XMPPDiscoNode with the specified
 *	  JID, node and name
 *
 * \param JID The JID this node lives on
 * \param node The node's opaque name
 * \param name The node's human friendly name
 * \return An initialized XMPPDiscoNode
 */
- initWithJID: (XMPPJID*)JID
	 node: (OFString*)node
	 name: (OFString*)name;
- initWithJID: (XMPPJID *)JID
	 node: (nullable OFString *)node
	 name: (nullable OFString *)name OF_DESIGNATED_INITIALIZER;

 /**
  * \brief Adds an XMPPDiscoIdentity to the node
  *
  * \param identity The XMPPDiscoIdentity to add
  */
- (void)addIdentity: (XMPPDiscoIdentity*)identity;
- (void)addIdentity: (XMPPDiscoIdentity *)identity;

 /**
  * \brief Adds a feature to the node
  *
  * \param feature The feature to add
  */
- (void)addFeature: (OFString*)feature;
- (void)addFeature: (OFString *)feature;

 /**
  * \brief Adds a XMPPDiscoNode as child of the node
  *
  * \param node The XMPPDiscoNode to add as child
  */
- (void)addChildNode: (XMPPDiscoNode*)node;
- (void)addChildNode: (XMPPDiscoNode *)node;
@end

- (bool)XMPP_handleItemsIQ: (XMPPIQ*)IQ
		connection: (XMPPConnection*)connection;
OF_ASSUME_NONNULL_END
- (bool)XMPP_handleInfoIQ: (XMPPIQ*)IQ
	       connection: (XMPPConnection*)connection;
@end