25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
+
+
|
#import <ObjFW/ObjFW.h>
#import "XMPPCallback.h"
#import "XMPPStorage.h"
OF_ASSUME_NONNULL_BEGIN
#define XMPP_CONNECTION_BUFFER_LENGTH 512
@class XMPPConnection;
@class XMPPJID;
@class XMPPIQ;
@class XMPPMessage;
@class XMPPPresence;
@class XMPPAuthenticator;
@class SSLSocket;
|
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
+
-
+
+
|
- (void)connection: (XMPPConnection *)connection
didReceiveMessage: (XMPPMessage *)message;
/*!
* @brief This callback is called when the connection was closed.
*
* @param connection The connection that was closed
* @param error The error XML element the stream encountered or nil
*/
- (void)connectionWasClosed: (XMPPConnection *)connection;
- (void)connectionWasClosed: (XMPPConnection *)connection
error: (nullable OFXMLElement *)error;
/*!
* @brief This callback is called when the connection threw an exception.
*
* @param connection The connection which threw an exception
* @param exception The exception the connection threw
*/
|
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
-
+
-
+
+
|
*/
- (void)connectionDidUpgradeToTLS: (XMPPConnection *)connection;
@end
/*!
* @brief A class which abstracts a connection to an XMPP service.
*/
@interface XMPPConnection: OFObject <OFXMLParserDelegate,
@interface XMPPConnection: OFObject
OFXMLElementBuilderDelegate>
{
OF_KINDOF(OFTCPSocket *) _socket;
char _buffer[XMPP_CONNECTION_BUFFER_LENGTH];
OFXMLParser *_parser, *_oldParser;
OFXMLElementBuilder *_elementBuilder, *_oldElementBuilder;
OFString *_Nullable _username, *_Nullable _password, *_Nullable _server;
OFString *_Nullable _resource;
bool _usesAnonymousAuthentication;
OFString *_Nullable _privateKeyFile, *_Nullable _certificateFile;
const char *_Nullable _privateKeyPassphrase;
OFString *_Nullable _domain, *_Nullable _domainToASCII;
XMPPJID *_Nullable _JID;
uint16_t _port;
id <XMPPStorage> _Nullable _dataStorage;
OFString *_Nullable _language;
OFMutableArray *_nextSRVRecords;
XMPPMulticastDelegate *_delegates;
OFMutableDictionary OF_GENERIC(OFString *, XMPPCallback *) *_callbacks;
XMPPAuthenticator *_authModule;
bool _streamOpen, _needsSession, _encryptionRequired, _encrypted;
bool _supportsRosterVersioning, _supportsStreamManagement;
unsigned int _lastID;
}
|