ObjXMPP  Diff

Differences From Artifact [cd389fa1d0]:

To Artifact [8794fd5d42]:


1
2

3
4
5

6
7
8
9
10
11
12
1

2
3
4

5
6
7
8
9
10
11
12

-
+


-
+







/*
 * Copyright (c) 2011, Jonathan Schleifer <js@webkeks.org>
 * Copyright (c) 2011, 2012, 2013, 2016, Jonathan Schleifer <js@heap.zone>
 * Copyright (c) 2012, Florian Zeitz <florob@babelmonkeys.de>
 *
 * https://webkeks.org/git/?p=objxmpp.git
 * https://heap.zone/git/?p=objxmpp.git
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice is present in all copies.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
35
36
37
38
39
40
41

42

43
44
45
46
47
48
49







-

-







 * \brief A protocol that should be (partially) implemented by delegates
 *	  of a XMPPRoster
 */
@protocol XMPPRosterDelegate
#ifndef XMPP_ROSTER_M
    <OFObject>
#endif
#ifdef OF_HAVE_OPTIONAL_PROTOCOLS
@optional
#endif
/**
 * \brief This callback is called after the roster was received (as a result of
 *	  calling -requestRoster).
 *
 * \param roster The roster that was received
 */
- (void)rosterWasReceived: (XMPPRoster*)roster;
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
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







-
+
-
-
-








-

















-










-
-







-         (void)roster: (XMPPRoster*)roster
  didReceiveRosterItem: (XMPPRosterItem*)rosterItem;
@end

/**
 * \brief A class implementing roster related functionality.
 */
@interface XMPPRoster: OFObject
@interface XMPPRoster: OFObject <XMPPConnectionDelegate>
#ifdef OF_HAVE_OPTIONAL_PROTOCOLS
    <XMPPConnectionDelegate>
#endif
{
	XMPPConnection *_connection;
	OFMutableDictionary *_rosterItems;
	XMPPMulticastDelegate *_delegates;
	id <XMPPStorage> _dataStorage;
	bool _rosterRequested;
}

#ifdef OF_HAVE_PROPERTIES
/**
 * \brief The connection to which the roster belongs
 */
@property (readonly, assign) XMPPConnection *connection;

/**
 * \brief An object for data storage, conforming to the XMPPStorage protocol.
 *
 * Inherited from the connection if not overridden.
 */
@property (assign) id <XMPPStorage> dataStorage;

/**
 * \brief The list of contacts as an OFDictionary with the bare JID as a string
 *	  as key.
 */
@property (readonly, copy) OFDictionary *rosterItems;
#endif

/**
 * \brief Initializes an already allocated XMPPRoster.
 *
 * \param connection The connection roster related stanzas
 *	  are send and received over
 * \return An initialized XMPPRoster
 */
- initWithConnection: (XMPPConnection*)connection;

- (OFDictionary*)rosterItems;

/**
 * \brief Requests the roster from the server.
 */
- (void)requestRoster;

/**
 * \brief Adds a new contact to the roster.
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
133
134
135
136
137
138
139





140
141
142
143
144
145
146
147







-
-
-
-
-








/**
 * \brief Removes the specified delegate.
 *
 * \param delegate The delegate to remove
 */
- (void)removeDelegate: (id <XMPPRosterDelegate>)delegate;

- (XMPPConnection*)connection;

- (void)setDataStorage: (id <XMPPStorage>)dataStorage;
- (id <XMPPStorage>)dataStorage;

- (void)XMPP_updateRosterItem: (XMPPRosterItem*)rosterItem;
- (void)XMPP_handleInitialRosterForConnection: (XMPPConnection*)connection
					   IQ: (XMPPIQ*)iq;
- (XMPPRosterItem*)XMPP_rosterItemWithXMLElement: (OFXMLElement*)element;
@end

@interface OFObject (XMPPRosterDelegate) <XMPPRosterDelegate>
@end