- [(name, "SOA", email ++ " 99999999 10800 3600 604800 86400")]
-nmc2pdns name RRTypeRP dom = [] --FIXME
-nmc2pdns name RRTypeLOC dom = takejust name "LOC" $ domLoc dom
-nmc2pdns name RRTypeNS dom = mapto name "NS" $ domNs dom
-nmc2pdns name RRTypeDS dom = [] --FIXME
-
-mapto name rrstr maybel = case maybel of
- Nothing -> []
- Just l -> map (\x -> (name, rrstr, x)) l
+ if dom == emptyNmcDom then []
+ else
+ -- Follows a relatively ugly hack to figure if we are at the top
+ -- level domain ("something.bit"). Only in such case we provide
+ -- the synthetic SOA RR. Otherwise yield empty.
+ -- Alternative would be to carry "top-ness" as a parameter through
+ -- all the calls from the very top where we split the fqdn.
+ case splitOn (pack ".") (pack name) of
+ [_,_] -> [ns ++ " " ++ email ++ " 99999 10800 3600 604800 86400"]
+ _ -> []
+dataRR RRTypeRP = \ _ dom ->
+ case domEmail dom of
+ Nothing -> []
+ Just addr -> [(dotmail addr) ++ " ."]
+dataRR RRTypeLOC = justv domLoc
+dataRR RRTypeNS = justl domNs -- FIXME Terminate with a dot?
+dataRR RRTypeDS = \ _ dom ->
+ case domDs dom of
+ Nothing -> []
+ Just dss -> map dsStr dss
+ where
+ dsStr x = (show (dsKeyTag x)) ++ " "
+ ++ (show (dsAlgo x)) ++ " "
+ ++ (show (dsHashType x)) ++ " "
+ ++ (dsHashValue x)