Handle DomainChanged message.

display
Philippe PITTOLI 2024-04-27 19:59:00 +02:00
parent 04f9334f29
commit ea2160b857
2 changed files with 7 additions and 2 deletions

View File

@ -684,8 +684,9 @@ handleAction = case _ of
(DNSManager.MkInvalidZone _) -> do (DNSManager.MkInvalidZone _) -> do
handleAction $ Log $ ErrorLog $ "InvalidZone" handleAction $ Log $ ErrorLog $ "InvalidZone"
handleAction $ AddNotif $ BadNotification $ "The domain zone is invalid." handleAction $ AddNotif $ BadNotification $ "The domain zone is invalid."
(DNSManager.MkDomainChanged _) -> do m@(DNSManager.MkDomainChanged response) -> do
handleAction $ Log $ ErrorLog $ "DomainChanged" handleAction $ Log $ SystemLog $ "Domain \"" <> response.domain.name <> "\" has been updated."
handleAction $ DispatchDNSMessage m
(DNSManager.MkUnknownZone _) -> do (DNSManager.MkUnknownZone _) -> do
handleAction $ Log $ ErrorLog $ "UnknownZone" handleAction $ Log $ ErrorLog $ "UnknownZone"
handleAction $ AddNotif $ BadNotification $ "The domain zone is unknown." handleAction $ AddNotif $ BadNotification $ "The domain zone is unknown."

View File

@ -405,6 +405,10 @@ handleQuery = case _ of
(DNSManager.MkDomainAdded response) -> do (DNSManager.MkDomainAdded response) -> do
{ my_domains } <- H.get { my_domains } <- H.get
handleAction $ UpdateMyDomains (my_domains <> [ emptyDomainInfo { name = response.domain } ]) handleAction $ UpdateMyDomains (my_domains <> [ emptyDomainInfo { name = response.domain } ])
(DNSManager.MkDomainChanged response) -> do
{ my_domains } <- H.get
let new_domains = map (\d -> if d.name == response.domain.name then response.domain else d) my_domains
handleAction $ UpdateMyDomains new_domains
(DNSManager.MkDomainDeleted response) -> do (DNSManager.MkDomainDeleted response) -> do
{ my_domains } <- H.get { my_domains } <- H.get
handleAction $ UpdateMyDomains $ A.filter (\d -> d.name /= response.domain) my_domains handleAction $ UpdateMyDomains $ A.filter (\d -> d.name /= response.domain) my_domains