From 1061c082624c37976fb28d655b95391fc55a8e5b Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Sun, 4 Nov 2018 23:07:56 +0100 Subject: [PATCH] Adjust to ObjFW changes --- src/XMPPConnection.m | 3 +-- src/XMPPSRVLookup.m | 29 +++++++++++++++++++---------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/XMPPConnection.m b/src/XMPPConnection.m index 28058a2..ce8c19f 100644 --- a/src/XMPPConnection.m +++ b/src/XMPPConnection.m @@ -348,8 +348,7 @@ OF_ASSUME_NONNULL_END connectToHost: [candidate target] port: [candidate port]]; break; - } @catch (OFAddressTranslationFailedException - *e) { + } @catch (OFResolveHostFailedException *e) { } @catch (OFConnectionFailedException *e) { } } while ((candidate = [enumerator nextObject]) != nil); diff --git a/src/XMPPSRVLookup.m b/src/XMPPSRVLookup.m index 3bae5f7..26bc047 100644 --- a/src/XMPPSRVLookup.m +++ b/src/XMPPSRVLookup.m @@ -38,7 +38,7 @@ #import "XMPPSRVLookup.h" -#import +#import OF_ASSUME_NONNULL_BEGIN @@ -118,7 +118,7 @@ OF_ASSUME_NONNULL_END _target = [[OFString alloc] initWithCString: buffer - encoding: [OFLocalization encoding]]; + encoding: [OFLocale encoding]]; } @catch (id e) { [self release]; @throw e; @@ -195,12 +195,15 @@ OF_ASSUME_NONNULL_END ns_msg handle; if (res_ninit(&_resState)) - @throw [OFAddressTranslationFailedException - exceptionWithHost: _domain]; + @throw [OFResolveHostFailedException + exceptionWithHost: _domain + recordClass: OF_DNS_RESOURCE_RECORD_CLASS_IN + recordType: OF_DNS_RESOURCE_RECORD_TYPE_SRV + error: OF_DNS_RESOLVER_ERROR_UNKNOWN]; answer = [self allocMemoryWithSize: pageSize]; - answerLen = res_nsearch(&_resState, [request - cStringWithEncoding: [OFLocalization encoding]], + answerLen = res_nsearch(&_resState, + [request cStringWithEncoding: [OFLocale encoding]], ns_c_in, ns_t_srv, answer, (int)pageSize); if ((answerLen == -1) && ((h_errno == HOST_NOT_FOUND) || @@ -208,12 +211,18 @@ OF_ASSUME_NONNULL_END return; if (answerLen < 1 || answerLen > pageSize) - @throw [OFAddressTranslationFailedException - exceptionWithHost: _domain]; + @throw [OFResolveHostFailedException + exceptionWithHost: _domain + recordClass: OF_DNS_RESOURCE_RECORD_CLASS_IN + recordType: OF_DNS_RESOURCE_RECORD_TYPE_SRV + error: OF_DNS_RESOLVER_ERROR_UNKNOWN]; if (ns_initparse(answer, answerLen, &handle)) - @throw [OFAddressTranslationFailedException - exceptionWithHost: _domain]; + @throw [OFResolveHostFailedException + exceptionWithHost: _domain + recordClass: OF_DNS_RESOURCE_RECORD_CLASS_IN + recordType: OF_DNS_RESOURCE_RECORD_TYPE_SRV + error: OF_DNS_RESOLVER_ERROR_UNKNOWN]; resourceRecordCount = ns_msg_count(handle, ns_s_an); for (i = 0; i < resourceRecordCount; i++) {