xmpp: Re-enable XA flag, since disabling it did not turn out to help with the problems Google Talk has with not always sending presence messages to clients.

This commit is contained in:
Joey Hess 2013-03-16 15:37:23 -04:00
parent 55f20ae099
commit db2fe522ba
4 changed files with 15 additions and 7 deletions

View file

@ -179,16 +179,17 @@ relayNetMessage :: JID -> Assistant (XMPP ())
relayNetMessage selfjid = do relayNetMessage selfjid = do
msg <- waitNetMessage msg <- waitNetMessage
debug ["sending:", show $ sanitizeNetMessage msg] debug ["sending:", show $ sanitizeNetMessage msg]
handleImportant msg a1 <- handleImportant msg
convert msg a2 <- convert msg
return (a1 >> a2)
where where
handleImportant msg = case parseJID =<< isImportantNetMessage msg of handleImportant msg = case parseJID =<< isImportantNetMessage msg of
Just tojid Just tojid
| tojid == baseJID tojid -> do | tojid == baseJID tojid -> do
putStanza presenceQuery
storeImportantNetMessage msg (formatJID tojid) $ storeImportantNetMessage msg (formatJID tojid) $
\c -> (baseJID <$> parseJID c) == Just tojid \c -> (baseJID <$> parseJID c) == Just tojid
_ -> noop return $ putStanza presenceQuery
_ -> return noop
convert (Pushing c pushstage) = withOtherClient selfjid c $ \tojid -> do convert (Pushing c pushstage) = withOtherClient selfjid c $ \tojid -> do
if tojid == baseJID tojid if tojid == baseJID tojid
then do then do

View file

@ -52,8 +52,9 @@ instance GitAnnexTaggable Message where
extractGitAnnexTag = headMaybe . filter isGitAnnexTag . messagePayloads extractGitAnnexTag = headMaybe . filter isGitAnnexTag . messagePayloads
instance GitAnnexTaggable Presence where instance GitAnnexTaggable Presence where
-- always mark extended away and set presence priority to negative
insertGitAnnexTag p elt = p insertGitAnnexTag p elt = p
{ presencePayloads = negativePriority : elt : presencePayloads p } { presencePayloads = extendedAway : negativePriority : elt : presencePayloads p }
extractGitAnnexTag = headMaybe . filter isGitAnnexTag . presencePayloads extractGitAnnexTag = headMaybe . filter isGitAnnexTag . presencePayloads
data GitAnnexTagInfo = GitAnnexTagInfo data GitAnnexTagInfo = GitAnnexTagInfo
@ -204,6 +205,10 @@ silentMessage = (emptyMessage MessageChat)
, elementNodes = [] , elementNodes = []
} }
{- Add to a presence to mark its client as extended away. -}
extendedAway :: Element
extendedAway = Element "show" [] [NodeContent $ ContentText "xa"]
{- Add to a presence to give it a negative priority. -} {- Add to a presence to give it a negative priority. -}
negativePriority :: Element negativePriority :: Element
negativePriority = Element "priority" [] [NodeContent $ ContentText "-1"] negativePriority = Element "priority" [] [NodeContent $ ContentText "-1"]

3
debian/changelog vendored
View file

@ -11,6 +11,9 @@ git-annex (4.20130315) UNRELEASED; urgency=low
* xmpp: --debug now enables a sanitized dump of the XMPP protocol * xmpp: --debug now enables a sanitized dump of the XMPP protocol
* xmpp: Try harder to detect presence of clients when there's a git push * xmpp: Try harder to detect presence of clients when there's a git push
to send. to send.
* xmpp: Re-enable XA flag, since disabling it did not turn out to help
with the problems Google Talk has with not always sending presence
messages to clients.
-- Joey Hess <joeyh@debian.org> Fri, 15 Mar 2013 00:10:07 -0400 -- Joey Hess <joeyh@debian.org> Fri, 15 Mar 2013 00:10:07 -0400

View file

@ -39,8 +39,7 @@ using presence messages, and chat messages (with empty body tags,
so clients don't display them). so clients don't display them).
git-annex sets a negative presence priority, to avoid any regular messages git-annex sets a negative presence priority, to avoid any regular messages
getting eaten by its clients. It also sets itself extended away. (XA getting eaten by its clients. It also sets itself extended away.
no longer used; see 90e47088908c2374d5d9306f4dacdf22de599cf5.)
Note that this means that chat messages always have to be directed at Note that this means that chat messages always have to be directed at
specific git-annex clients. specific git-annex clients.