52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#import "XMPPStanza.h"
#import "XMPPXMLElementBuilder.h"
#import "namespaces.h"
#import <ObjFW/macros.h>
@interface XMPPConnection () <OFDNSResolverDelegate, OFTCPSocketDelegate,
OFXMLParserDelegate, OFXMLElementBuilderDelegate>
- (void)xmpp_tryNextSRVRecord;
- (bool)xmpp_parseBuffer: (const void *)buffer
length: (size_t)length;
- (void)xmpp_startStream;
- (void)xmpp_handleStanza: (OFXMLElement *)element;
- (void)xmpp_handleStream: (OFXMLElement *)element;
|
|
|
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#import "XMPPStanza.h"
#import "XMPPXMLElementBuilder.h"
#import "namespaces.h"
#import <ObjFW/macros.h>
@interface XMPPConnection () <OFDNSResolverQueryDelegate, OFTCPSocketDelegate,
OFXMLParserDelegate, OFXMLElementBuilderDelegate>
- (void)xmpp_tryNextSRVRecord;
- (bool)xmpp_parseBuffer: (const void *)buffer
length: (size_t)length;
- (void)xmpp_startStream;
- (void)xmpp_handleStanza: (OFXMLElement *)element;
- (void)xmpp_handleStream: (OFXMLElement *)element;
|
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
|
_nextSRVRecords = nil;
}
[_socket asyncConnectToHost: record.target
port: record.port];
}
- (void)resolver: (OFDNSResolver *)resolver
didResolveDomainName: (OFString *)domainName
response: (OFDNSResponse *)response
exception: (id)exception
{
OFMutableArray *records = [OFMutableArray array];
if (exception != nil) {
[_delegates
broadcastSelector: @selector(connection:didThrowException:)
withObject: self
|
|
|
|
|
|
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
|
_nextSRVRecords = nil;
}
[_socket asyncConnectToHost: record.target
port: record.port];
}
- (void)resolver: (OFDNSResolver *)resolver
didPerformQuery: (OFString *)domainName
response: (OFDNSResponse *)response
exception: (id)exception
{
OFMutableArray *records = [OFMutableArray array];
if (exception != nil) {
[_delegates
broadcastSelector: @selector(connection:didThrowException:)
withObject: self
|
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
|
if (_server != nil)
[_socket asyncConnectToHost: _server
port: _port];
else {
OFString *SRVDomain = [_domainToASCII
stringByPrependingString: @"_xmpp-client._tcp."];
OFDNSRequest *request = [OFDNSRequest
requestWithHost: SRVDomain
recordClass: OF_DNS_RESOURCE_RECORD_CLASS_IN
recordType: OF_DNS_RESOURCE_RECORD_TYPE_SRV];
[[OFThread DNSResolver] asyncPerformRequest: request
delegate: self];
}
objc_autoreleasePoolPop(pool);
}
- (bool)xmpp_parseBuffer: (const void *)buffer
length: (size_t)length
|
|
|
|
|
|
|
|
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
|
if (_server != nil)
[_socket asyncConnectToHost: _server
port: _port];
else {
OFString *SRVDomain = [_domainToASCII
stringByPrependingString: @"_xmpp-client._tcp."];
OFDNSQuery *query = [OFDNSQuery
queryWithDomainName: SRVDomain
DNSClass: OF_DNS_CLASS_IN
recordType: OF_DNS_RECORD_TYPE_SRV];
[[OFThread DNSResolver] asyncPerformQuery: query
delegate: self];
}
objc_autoreleasePoolPop(pool);
}
- (bool)xmpp_parseBuffer: (const void *)buffer
length: (size_t)length
|