DomainAdded message. List of domains auto-update when adding a message.
parent
a1c1c462c9
commit
81bdec302c
|
@ -376,8 +376,8 @@ handleAction = case _ of
|
||||||
(DNSManager.UnknownNumber ) -> handleAction $ WebSocketParseError ("Parsing error: DNSManager.UnknownNumber")
|
(DNSManager.UnknownNumber ) -> handleAction $ WebSocketParseError ("Parsing error: DNSManager.UnknownNumber")
|
||||||
|
|
||||||
-- Cases where we understood the message.
|
-- Cases where we understood the message.
|
||||||
Right response -> do
|
Right received_msg -> do
|
||||||
case response of
|
case received_msg of
|
||||||
-- The authentication failed.
|
-- The authentication failed.
|
||||||
(DNSManager.MkError errmsg) -> do
|
(DNSManager.MkError errmsg) -> do
|
||||||
appendMessage $ "[😈] Failed, reason is: " <> errmsg.reason
|
appendMessage $ "[😈] Failed, reason is: " <> errmsg.reason
|
||||||
|
@ -400,8 +400,14 @@ handleAction = case _ of
|
||||||
handleAction $ UpdateAcceptedDomains response.accepted_domains
|
handleAction $ UpdateAcceptedDomains response.accepted_domains
|
||||||
handleAction $ UpdateMyDomains response.my_domains
|
handleAction $ UpdateMyDomains response.my_domains
|
||||||
|
|
||||||
|
(DNSManager.MkDomainAdded response) -> do
|
||||||
|
{ my_domains } <- H.get
|
||||||
|
appendMessage $ "[😈] Domain added: " <> response.domain
|
||||||
|
handleAction $ UpdateMyDomains (my_domains <> [response.domain])
|
||||||
|
|
||||||
(DNSManager.MkInvalidDomainName _) -> do
|
(DNSManager.MkInvalidDomainName _) -> do
|
||||||
appendMessage $ "[😈] Failed! The domain is not valid!"
|
appendMessage $ "[😈] Failed! The domain is not valid!"
|
||||||
|
|
||||||
(DNSManager.MkSuccess _) -> do
|
(DNSManager.MkSuccess _) -> do
|
||||||
appendMessage $ "[😈] Success!"
|
appendMessage $ "[😈] Success!"
|
||||||
-- WTH?!
|
-- WTH?!
|
||||||
|
|
|
@ -169,6 +169,11 @@ codecLogged ∷ CA.JsonCodec Logged
|
||||||
codecLogged = CA.object "Logged" (CAR.record { accepted_domains: CA.array CA.string
|
codecLogged = CA.object "Logged" (CAR.record { accepted_domains: CA.array CA.string
|
||||||
, my_domains: CA.array CA.string })
|
, my_domains: CA.array CA.string })
|
||||||
|
|
||||||
|
{- 17 -}
|
||||||
|
type DomainAdded = { domain :: String }
|
||||||
|
codecDomainAdded ∷ CA.JsonCodec DomainAdded
|
||||||
|
codecDomainAdded = CA.object "DomainAdded" (CAR.record { domain: CA.string })
|
||||||
|
|
||||||
{- 50 -}
|
{- 50 -}
|
||||||
type UnknownUser = { }
|
type UnknownUser = { }
|
||||||
codecUnknownUser ∷ CA.JsonCodec UnknownUser
|
codecUnknownUser ∷ CA.JsonCodec UnknownUser
|
||||||
|
@ -211,6 +216,7 @@ data AnswerMessage
|
||||||
| MkDomainList DomainList -- 14
|
| MkDomainList DomainList -- 14
|
||||||
| MkAcceptedDomains AcceptedDomains -- 15
|
| MkAcceptedDomains AcceptedDomains -- 15
|
||||||
| MkLogged Logged -- 16
|
| MkLogged Logged -- 16
|
||||||
|
| MkDomainAdded DomainAdded -- 17
|
||||||
| MkUnknownUser UnknownUser -- 50
|
| MkUnknownUser UnknownUser -- 50
|
||||||
| MkNoOwnership NoOwnership -- 51
|
| MkNoOwnership NoOwnership -- 51
|
||||||
|
|
||||||
|
@ -255,6 +261,7 @@ decode number string
|
||||||
14 -> error_management codecDomainList MkDomainList
|
14 -> error_management codecDomainList MkDomainList
|
||||||
15 -> error_management codecAcceptedDomains MkAcceptedDomains
|
15 -> error_management codecAcceptedDomains MkAcceptedDomains
|
||||||
16 -> error_management codecLogged MkLogged
|
16 -> error_management codecLogged MkLogged
|
||||||
|
17 -> error_management codecDomainAdded MkDomainAdded
|
||||||
50 -> error_management codecUnknownUser MkUnknownUser
|
50 -> error_management codecUnknownUser MkUnknownUser
|
||||||
51 -> error_management codecNoOwnership MkNoOwnership
|
51 -> error_management codecNoOwnership MkNoOwnership
|
||||||
_ -> Left UnknownNumber
|
_ -> Left UnknownNumber
|
||||||
|
|
Loading…
Reference in New Issue