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 PairReq theiruuid selfjid theirjid
|
||||
-- PairReq from another client using our JID is automatically accepted.
|
||||
| baseJID selfjid == baseJID theirjid = do
|
||||
| baseJID selfjid == baseJID theirjid = autoaccept
|
||||
| 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
|
||||
sendNetMessage $
|
||||
PairingNotification PairAck (formatJID theirjid) selfuuid
|
||||
finishXMPPPairing theirjid theiruuid
|
||||
-- Show an alert to let the user decide if they want to pair.
|
||||
| otherwise = do
|
||||
showalert = do
|
||||
let route = FinishXMPPPairR (PairKey theiruuid $ formatJID theirjid)
|
||||
url <- liftIO $ renderUrl urlrenderer route []
|
||||
close <- asIO1 removeAlert
|
||||
|
|
Loading…
Reference in a new issue