summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2026-01-17 16:33:11 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2026-01-18 11:41:56 +0100
commitc45dcd68255404da844f9b2c4b35c85d48da6866 (patch)
treeced31715f77fc4256140149d4a78822a235942d6 /main
parentb5a7a91b5ab0d6461ba399eb89db4ce5af447325 (diff)
Accept invites via shared state
Diffstat (limited to 'main')
-rw-r--r--main/Main.hs3
-rw-r--r--main/Test.hs8
2 files changed, 5 insertions, 6 deletions
diff --git a/main/Main.hs b/main/Main.hs
index 227451f..ec8c98a 100644
--- a/main/Main.hs
+++ b/main/Main.hs
@@ -992,8 +992,7 @@ cmdInviteAccept = do
, Just from <- readRefDigest $ T.encodeUtf8 $ "blake2#" <> tfrom
, Just token <- parseInviteToken tinv
-> do
- server <- asks ciServer
- acceptInvite server from token
+ acceptInvite from token
_ -> throwOtherError "invalit invite URL"
cmdConversations :: Command
diff --git a/main/Test.hs b/main/Test.hs
index 7fdf5fc..5b6509a 100644
--- a/main/Test.hs
+++ b/main/Test.hs
@@ -239,9 +239,9 @@ inviteAttributes out = (defaultServiceAttributes Proxy)
pid <- asks svcPeerIdentity
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"
+ afterCommit $ outLine out $ "invite-reply " <> showInviteToken token <> " contact"
, inviteHookReplyInvalid = \token -> do
- afterCommit $ outLine out $ "invite-accept-done " <> showInviteToken token <> " invalid"
+ afterCommit $ outLine out $ "invite-reply " <> showInviteToken token <> " invalid"
}
dmThreadWatcher :: ComposedIdentity -> Output -> DirectMessageThread -> DirectMessageThread -> IO ()
@@ -1091,5 +1091,5 @@ cmdInviteAccept = do
[ tokenText, idref ] <- asks tiParams
Just token <- return $ parseInviteToken tokenText
Just from <- return $ readRefDigest $ encodeUtf8 idref
- Just RunningServer {..} <- gets tsServer
- acceptInvite rsServer from token
+ acceptInvite from token
+ cmdOut $ unwords [ "invite-accept-done", showInviteToken token ]