X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=blackboard-dns.git;a=blobdiff_plain;f=DDNS%2FZone.hs;h=e5d4af519a3ef2ed485f958324366f1d1a76f839;hp=aca51e9b4c8b7cfafe69ae90801e5d81b9a49ab4;hb=1abf9ad51c79257c0bce8e134fdd48a2ff0ef373;hpb=20021ec127c5574db472d88ff47cbf7e656969f4 diff --git a/DDNS/Zone.hs b/DDNS/Zone.hs index aca51e9..e5d4af5 100644 --- a/DDNS/Zone.hs +++ b/DDNS/Zone.hs @@ -1,6 +1,8 @@ module DDNS.Zone ( listZones , completeZoneName + + , getZone ) where @@ -39,3 +41,21 @@ completeZoneName db , display = zn , isFinished = True } + +getZone :: Database -> DomainName -> IO (Maybe SOAFields) +getZone db name + = do rows <- query db $ + do t <- table Zones.zones + restrict (t!Zones.zone .==. constant (show name)) + return t + case rows of + [r] -> return $ Just SOAFields { + soaMasterNameServer = read $ r!Zones.ns + , soaResponsibleMailbox = read $ r!Zones.owner + , soaSerialNumber = fromIntegral $ r!Zones.serial + , soaRefreshInterval = fromIntegral $ r!Zones.refresh + , soaRetryInterval = fromIntegral $ r!Zones.retry + , soaExpirationLimit = fromIntegral $ r!Zones.expire + , soaMinimumTTL = fromIntegral $ r!Zones.minTTL + } + _ -> return Nothing \ No newline at end of file