workaround for Google Talk's insane handling of self-directed presence

Maybe the spec allows it, but broadcasting self-directed presence info to
all buddies is just insane.

I had to bring back the IQ messages for self-pairing, while still using
directed presence for other pairing. Ugly.
This commit is contained in:
Joey Hess 2012-11-03 22:52:41 -04:00
parent 9cff286ea3
commit a6cecfcf33
6 changed files with 85 additions and 33 deletions

View file

@ -29,6 +29,7 @@ import Utility.Network
import Annex.UUID
#endif
#ifdef WITH_XMPP
import Assistant.XMPP
import Assistant.XMPP.Client
import Assistant.XMPP.Buddies
import Network.Protocol.XMPP
@ -88,16 +89,17 @@ getStartXMPPPairR bid = do
Nothing -> redirect StartPairR
(Just []) -> redirect StartPairR
(Just clients@((Client exemplar):_)) -> do
let samejid = basejid ourjid == basejid exemplar
let account = formatJID $ basejid exemplar
let samejid = baseJID ourjid == baseJID exemplar
let account = formatJID $ baseJID exemplar
liftAssistant $ do
u <- liftAnnex getUUID
sendNetMessage $ PairingNotification PairReq account u
if samejid
then forM_ clients $ \(Client c) ->
sendNetMessage $ SelfPairingNotification PairReq (formatJID c) u
else sendNetMessage $ PairingNotification PairReq account u
pairPage $ do
let name = buddyName exemplar
$(widgetFile "configurators/pairing/xmpp/inprogress")
where
basejid j = JID (jidNode j) (jidDomain j) Nothing
#else
getStartXMPPPairR _ = noXMPPPairing