auto-accept pair requests from JIDs already paired with
This commit is contained in:
parent
7c30be0e8c
commit
522e228aef
1 changed files with 13 additions and 3 deletions
|
@ -204,14 +204,24 @@ pull us = do
|
||||||
|
|
||||||
pairMsgReceived :: UrlRenderer -> PairStage -> UUID -> JID -> JID -> Assistant ()
|
pairMsgReceived :: UrlRenderer -> PairStage -> UUID -> JID -> JID -> Assistant ()
|
||||||
pairMsgReceived urlrenderer PairReq theiruuid selfjid theirjid
|
pairMsgReceived urlrenderer PairReq theiruuid selfjid theirjid
|
||||||
-- PairReq from another client using our JID is automatically accepted.
|
| baseJID selfjid == baseJID theirjid = autoaccept
|
||||||
| baseJID selfjid == baseJID theirjid = do
|
| otherwise = do
|
||||||
|
knownjids <- catMaybes . map (parseJID . getXMPPClientID)
|
||||||
|
. filter isXMPPRemote . syncRemotes <$> getDaemonStatus
|
||||||
|
if any (== baseJID theirjid) knownjids
|
||||||
|
then autoaccept
|
||||||
|
else showalert
|
||||||
|
|
||||||
|
where
|
||||||
|
-- PairReq from another client using our JID, or the JID of
|
||||||
|
-- any repo we're already paired with is automatically accepted.
|
||||||
|
autoaccept = do
|
||||||
selfuuid <- liftAnnex getUUID
|
selfuuid <- liftAnnex getUUID
|
||||||
sendNetMessage $
|
sendNetMessage $
|
||||||
PairingNotification PairAck (formatJID theirjid) selfuuid
|
PairingNotification PairAck (formatJID theirjid) selfuuid
|
||||||
finishXMPPPairing theirjid theiruuid
|
finishXMPPPairing theirjid theiruuid
|
||||||
-- Show an alert to let the user decide if they want to pair.
|
-- Show an alert to let the user decide if they want to pair.
|
||||||
| otherwise = do
|
showalert = do
|
||||||
let route = FinishXMPPPairR (PairKey theiruuid $ formatJID theirjid)
|
let route = FinishXMPPPairR (PairKey theiruuid $ formatJID theirjid)
|
||||||
url <- liftIO $ renderUrl urlrenderer route []
|
url <- liftIO $ renderUrl urlrenderer route []
|
||||||
close <- asIO1 removeAlert
|
close <- asIO1 removeAlert
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue