1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-09-09 10:19:41 +02:00

Bump MiniDNS to 0.3.0-alpha1

Also add minidns-core as dependency to smack-core. This requires
increasing the minimum required Android SDK level to 9, as this is
what MiniDNS requires.
This commit is contained in:
Florian Schmaus 2018-04-24 21:41:31 +02:00
parent 6c4a02691e
commit a91ca2aebf
21 changed files with 156 additions and 237 deletions

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2013-2017 Florian Schmaus
* Copyright 2013-2018 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -27,6 +27,7 @@ import org.jivesoftware.smack.util.dns.DNSResolver;
import org.jivesoftware.smack.util.dns.HostAddress;
import org.jivesoftware.smack.util.dns.SRVRecord;
import org.minidns.dnsname.DNSName;
import org.xbill.DNS.Lookup;
import org.xbill.DNS.Record;
import org.xbill.DNS.TextParseException;
@ -49,12 +50,12 @@ public class DNSJavaResolver extends DNSResolver implements SmackInitializer {
}
@Override
protected List<SRVRecord> lookupSRVRecords0(String name, List<HostAddress> failedAddresses, DnssecMode dnssecMode) {
protected List<SRVRecord> lookupSRVRecords0(DNSName name, List<HostAddress> failedAddresses, DnssecMode dnssecMode) {
List<SRVRecord> res = new ArrayList<>();
Lookup lookup;
try {
lookup = new Lookup(name, Type.SRV);
lookup = new Lookup(name.ace, Type.SRV);
}
catch (TextParseException e) {
throw new IllegalStateException(e);
@ -67,7 +68,7 @@ public class DNSJavaResolver extends DNSResolver implements SmackInitializer {
for (Record record : recs) {
org.xbill.DNS.SRVRecord srvRecord = (org.xbill.DNS.SRVRecord) record;
if (srvRecord != null && srvRecord.getTarget() != null) {
String host = srvRecord.getTarget().toString();
DNSName host = DNSName.from(srvRecord.getTarget().toString());
int port = srvRecord.getPort();
int priority = srvRecord.getPriority();
int weight = srvRecord.getWeight();