/**
 *
 * Copyright 2019 Florian Schmaus
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.jivesoftware.smackx.dox.resolver.minidns;

import java.io.IOException;

import org.jivesoftware.smackx.dox.DnsOverXmppResolver;

import org.minidns.DnsClient;
import org.minidns.dnsmessage.DnsMessage;
import org.minidns.dnsmessage.Question;
import org.minidns.dnsqueryresult.DnsQueryResult;

public class DnsOverXmppMiniDnsResolver implements DnsOverXmppResolver {

    public static final DnsOverXmppMiniDnsResolver INSTANCE = new DnsOverXmppMiniDnsResolver(new DnsClient());

    private final DnsClient dnsClient;

    public DnsOverXmppMiniDnsResolver(DnsClient dnsClient) {
        this.dnsClient = dnsClient;
    }

    @Override
    public DnsMessage resolve(DnsMessage query) throws IOException {
        Question question = query.getQuestion();

        DnsQueryResult dnsQueryResult = dnsClient.query(question);

        return dnsQueryResult.response;
    }

}

@@ -898,16 +898,101 @@
 yResult;
+%0Aimport org.minidns.dnssec.DnssecClient;%0Aimport org.minidns.dnssec.DnssecQueryResult;
 %0A%0Apublic
@@ -992,16 +992,22 @@
 %0Apublic 
+final 
 class Dn
@@ -1158,16 +1158,60 @@
 esolver(
+);%0A%0A    private final DnsClient dnsClient = 
 new DnsC
@@ -1217,19 +1217,17 @@
 Client()
-);%0A
+;
 %0A    pri
@@ -1232,32 +1232,35 @@
 rivate final Dns
+sec
 Client dnsClient
@@ -1257,22 +1257,46 @@
  dns
+sec
 Client
+ = new DnssecClient()
 ;%0A%0A    p
 ubli
@@ -1287,29 +1287,30 @@
 nt();%0A%0A    p
-ublic
+rivate
  DnsOverXmpp
@@ -1329,66 +1329,11 @@
 ver(
-DnsClient dnsClient) %7B%0A        this.dnsClient = dnsClient;
+) %7B
 %0A   
@@ -1477,16 +1477,22 @@
         
+final 
 DnsQuery
@@ -1498,16 +1498,244 @@
 yResult 
+dnsQueryResult;%0A        if (query.isDnssecOk()) %7B%0A            DnssecQueryResult dnssecQueryResult = dnssecClient.queryDnssec(question);%0A            dnsQueryResult = dnssecQueryResult.dnsQueryResult;%0A        %7D else %7B%0A            
 dnsQuery
@@ -1769,16 +1769,26 @@
 estion);
+%0A        %7D
 %0A%0A      

Add DNSSEC support to DnsOverXmppMiniDnsResolver