ObjXMPP  Diff

Differences From Artifact [ffd20ba38a]:

To Artifact [7f67dd17c8]:


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
129
130
131
132


133
134

135
136
137
138
139


140
141

142
143
144
145
146
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
129
130
131
132


133
134
135

136
137
138
139


140
141
142

143
144
145
146
147
148







-
-
+
+




-
-
+
+

-
-
+
+




-
-
+
+


-
-
+
+




-
-
+
+

-
-
+
+




-
-
+
+


-
-
+
+




-
-
+
+

-
-
+
+




-
-
+
+

-
-
+
+





-
-
+
+













+
-
+
+
















-
-
+
+

-
+



-
-
+
+

-
+





OF_ASSUME_NONNULL_BEGIN

@class XMPPContact;
@class XMPPContactManager;
@class XMPPMulticastDelegate;
@class XMPPPresence;

/**
 * \brief A protocol that should be (partially) implemented by delegates
/*!
 * @brief A protocol that should be (partially) implemented by delegates
 *	  of a XMPPContactManager
 */
@protocol XMPPContactManagerDelegate <OFObject>
@optional
/**
 * \brief This callback is called whenever a new contact enters the users roster
/*!
 * @brief This callback is called whenever a new contact enters the users roster
 *
 * \param manager The contact manager that added the contact
 * \param contact The contact that was added
 * @param manager The contact manager that added the contact
 * @param contact The contact that was added
 */
- (void)contactManager: (XMPPContactManager *)manager
	 didAddContact: (XMPPContact *)contact;

/**
 * \brief This callback is called whenever a contact is no longer present in
/*!
 * @brief This callback is called whenever a contact is no longer present in
 *	  the users roster
 *
 * \param manager The contact manager that removed the contact
 * \param contact The contact that was removed
 * @param manager The contact manager that removed the contact
 * @param contact The contact that was removed
 */
- (void)contactManager: (XMPPContactManager *)manager
      didRemoveContact: (XMPPContact *)contact;

/**
 * \brief This callback is called when a subscription request is received
/*!
 * @brief This callback is called when a subscription request is received
 *
 * \param manager The contact manager that received the request
 * \param presence The type=subscribe presence
 * @param manager The contact manager that received the request
 * @param presence The type=subscribe presence
 */
-          (void)contactManager: (XMPPContactManager *)manager
  didReceiveSubscriptionRequest: (XMPPPresence *)presence;

/**
 * \brief This callback is called whenever a contact is about to change its
/*!
 * @brief This callback is called whenever a contact is about to change its
 *	  roster item
 *
 * \param contact The contact about to updated its roster item
 * \param rosterItem The roster item the contact is going to update with
 * @param contact The contact about to updated its roster item
 * @param rosterItem The roster item the contact is going to update with
 */
-	     (void)contact: (XMPPContact *)contact
  willUpdateWithRosterItem: (XMPPRosterItem *)rosterItem;

/**
 * \brief This callback is called whenever a contact send a presence stanza
/*!
 * @brief This callback is called whenever a contact send a presence stanza
 *
 * \param contact The contact that send the presence
 * \param presence The presence which was send by the contact
 * @param contact The contact that send the presence
 * @param presence The presence which was send by the contact
 */
-   (void)contact: (XMPPContact *)contact
  didSendPresence: (XMPPPresence *)presence;

/**
 * \brief This callback is called whenever a contact send a message stanza
/*!
 * @brief This callback is called whenever a contact send a message stanza
 *
 * \param contact The contact that send the message
 * \param message The message which was send by the contact
 * @param contact The contact that send the message
 * @param message The message which was send by the contact
 */
-  (void)contact: (XMPPContact *)contact
  didSendMessage: (XMPPMessage *)message;
@end

/**
 * \brief A class tracking a XMPPContact instance for each contact in the roster
/*!
 * @brief A class tracking a XMPPContact instance for each contact in the roster
 *
 * This class delegates to a XMPPConnection and a XMPPRoster, thereby tracking
 * each contacts presences and the current XMPPRosterItem.
 */
@interface XMPPContactManager: OFObject <XMPPConnectionDelegate,
    XMPPRosterDelegate>
{
	OFMutableDictionary *_contacts;
	XMPPConnection *_connection;
	XMPPRoster *_roster;
	XMPPMulticastDelegate *_delegates;
}

/*!
/// \brief The tracked contacts, with their bare JID as key
 * The tracked contacts, with their bare JID as key.
 */
@property (readonly, nonatomic)
    OFDictionary OF_GENERIC(OFString *, XMPPContact *) *contacts;

/*!
 * @brief Initializes an already allocated XMPPContactManager.
 *
 * @param connection The connection to be used to track contacts
 * @param roster The roster used by the contact manager
 * @return An initialized XMPPContactManager
 */
- initWithConnection: (XMPPConnection *)connection
	      roster: (XMPPRoster *)roster OF_DESIGNATED_INITIALIZER;

- (void)sendSubscribedToJID: (XMPPJID *)subscriber;
- (void)sendUnsubscribedToJID: (XMPPJID *)subscriber;

/**
 * \brief Adds the specified delegate.
/*!
 * @brief Adds the specified delegate.
 *
 * \param delegate The delegate to add
 * @param delegate The delegate to add
 */
- (void)addDelegate: (id <XMPPContactManagerDelegate>)delegate;

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

OF_ASSUME_NONNULL_END