summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/Test.hs4
-rw-r--r--src/Erebos/Invite.hs10
2 files changed, 7 insertions, 7 deletions
diff --git a/main/Test.hs b/main/Test.hs
index a3b91c2..7fdf5fc 100644
--- a/main/Test.hs
+++ b/main/Test.hs
@@ -235,9 +235,9 @@ discoveryAttributes = (defaultServiceAttributes Proxy)
inviteAttributes :: Output -> InviteServiceAttributes
inviteAttributes out = (defaultServiceAttributes Proxy)
- { inviteHookAccepted = \token -> do
+ { inviteHookAccepted = \Invite {..} -> do
pid <- asks svcPeerIdentity
- afterCommit $ outLine out $ "invite-accepted " <> showInviteToken token <> " " <> (BC.unpack $ showRef $ storedRef $ idExtData pid)
+ afterCommit $ outLine out $ "invite-accepted " <> maybe "<missing-token>" showInviteToken inviteToken <> " " <> (BC.unpack $ showRef $ storedRef $ idExtData pid)
, inviteHookReplyContact = \token _ -> do
afterCommit $ outLine out $ "invite-accept-done " <> showInviteToken token <> " contact"
, inviteHookReplyInvalid = \token -> do
diff --git a/src/Erebos/Invite.hs b/src/Erebos/Invite.hs
index 89670ec..d815625 100644
--- a/src/Erebos/Invite.hs
+++ b/src/Erebos/Invite.hs
@@ -136,17 +136,17 @@ data InviteService
| UnknownInvitePacket
data InviteServiceAttributes = InviteServiceAttributes
- { inviteHookAccepted :: InviteToken -> ServiceHandler InviteService ()
+ { inviteHookAccepted :: Invite -> ServiceHandler InviteService ()
, inviteHookReplyContact :: InviteToken -> Maybe Text -> ServiceHandler InviteService ()
, inviteHookReplyInvalid :: InviteToken -> ServiceHandler InviteService ()
}
defaultInviteServiceAttributes :: InviteServiceAttributes
defaultInviteServiceAttributes = InviteServiceAttributes
- { inviteHookAccepted = \token -> do
+ { inviteHookAccepted = \Invite {..} -> do
pid <- asks $ svcPeerIdentity
- svcPrint $ T.unpack $ "Invite accepted by " <> displayIdentity pid
- <> " (token: " <> textInviteToken token <> ")"
+ svcPrint $ T.unpack $ "Invite" <> maybe "" ((" for “" <>) . (<> "”")) inviteContact <> " accepted by " <> displayIdentity pid
+ <> " (token: " <> maybe "??" textInviteToken inviteToken <> ")"
, inviteHookReplyContact = \token mbName -> do
pid <- asks $ svcPeerIdentity
svcPrint $ T.unpack $ "Invite confirmed by " <> displayIdentity pid
@@ -194,7 +194,7 @@ instance Service InviteService where
| Just name <- inviteContact invite
, [] <- inviteAccepted invite
-> do
- asks (inviteHookAccepted . svcAttributes) >>= ($ token)
+ asks (inviteHookAccepted . svcAttributes) >>= ($ invite)
identity <- asks svcPeerIdentity
cdata <- mstore ContactData
{ cdPrev = []