add a yes/no confirm for xmpp pairing requests

This commit is contained in:
Joey Hess 2012-11-11 22:29:16 -04:00
parent 9f5b23d49f
commit 8b22bd8831
5 changed files with 18 additions and 4 deletions

View file

@ -222,7 +222,7 @@ pairMsgReceived urlrenderer PairReq theiruuid selfjid theirjid
finishXMPPPairing theirjid theiruuid
-- Show an alert to let the user decide if they want to pair.
showalert = do
let route = FinishXMPPPairR (PairKey theiruuid $ formatJID theirjid)
let route = ConfirmXMPPPairR (PairKey theiruuid $ formatJID theirjid)
url <- liftIO $ renderUrl urlrenderer route []
close <- asIO1 removeAlert
void $ addAlert $ pairRequestReceivedAlert (T.unpack $ buddyName theirjid)

View file

@ -128,6 +128,17 @@ getFinishLocalPairR msg = promptSecret (Just msg) $ \_ secret -> do
getFinishLocalPairR _ = noLocalPairing
#endif
getConfirmXMPPPairR :: PairKey -> Handler RepHtml
#ifdef WITH_XMPP
getConfirmXMPPPairR pairkey@(PairKey _ t) = case parseJID t of
Nothing -> error "bad JID"
Just theirjid -> pairPage $ do
let name = buddyName theirjid
$(widgetFile "configurators/pairing/xmpp/confirm")
#else
getConfirmXMPPPairR _ = noXMPPPairing
#endif
getFinishXMPPPairR :: PairKey -> Handler RepHtml
#ifdef WITH_XMPP
getFinishXMPPPairR (PairKey theiruuid t) = case parseJID t of
@ -140,7 +151,7 @@ getFinishXMPPPairR (PairKey theiruuid t) = case parseJID t of
finishXMPPPairing theirjid theiruuid
xmppPairEnd False $ Just theirjid
#else
getFinishXMPPPairR _ _ = noXMPPPairing
getFinishXMPPPairR _ = noXMPPPairing
#endif
#ifdef WITH_XMPP

View file

@ -31,6 +31,7 @@
/config/repository/pair/local/finish/#PairMsg FinishLocalPairR GET
/config/repository/pair/xmpp/start StartXMPPPairR GET
/config/repository/pair/xmpp/running/#BuddyKey RunningXMPPPairR GET
/config/repository/pair/xmpp/accept/#PairKey ConfirmXMPPPairR GET
/config/repository/pair/xmpp/finish/#PairKey FinishXMPPPairR GET
/config/repository/enable/rsync/#UUID EnableRsyncR GET

View file

@ -7,8 +7,8 @@
two git annex repositories will be combined into one, with changes #
kept in sync between them.
$else
Pairing with #{username}@#{hostname} will combine the two git annex #
repositories into one, with changes kept in sync between them.
Pairing with #{username}@#{hostname} will combine your two git annex #
repositories into one, allowing you to share files.
<p>
$if start
For security, enter a secret phrase. This same secret phrase will #

View file

@ -9,6 +9,8 @@
$nothing
A pair request has been sent to all other devices using your jabber #
account.
$else
Pair request accepted.
<h2>
Configure a shared cloud repository
$maybe name <- friend