diff options
author | 2013-05-22 16:32:35 -0400 | |
---|---|---|
committer | 2013-05-22 17:03:46 -0400 | |
commit | 063159094dd61b18eeecce621e2836060738b068 (patch) | |
tree | 234fea50f88fd1ee4107f360d6a4cd274e6537a0 /Assistant/XMPP.hs | |
parent | a6e4d912f77815ba09ac5fe402c18af4a688397f (diff) |
XMPP: Send pings and use them to detect when contact with the server is lost.
I noticed that when my modem hung up and redialed, my xmpp client was left
sending messages into the void. This will also handle any idle
disconnection issues.
Diffstat (limited to 'Assistant/XMPP.hs')
-rw-r--r-- | Assistant/XMPP.hs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Assistant/XMPP.hs b/Assistant/XMPP.hs index 0748c0581..ed28ac7d2 100644 --- a/Assistant/XMPP.hs +++ b/Assistant/XMPP.hs @@ -84,6 +84,18 @@ gitAnnexPresence = insertGitAnnexTag $ emptyPresence PresenceAvailable gitAnnexSignature :: Presence gitAnnexSignature = gitAnnexPresence $ Element gitAnnexTagName [] [] +{- XMPP client to server ping -} +xmppPing :: JID -> IQ +xmppPing selfjid = (emptyIQ IQGet) + { iqID = Just "c2s1" + , iqFrom = Just selfjid + , iqTo = Just $ JID Nothing (jidDomain selfjid) Nothing + , iqPayload = Just $ Element xmppPingTagName [] [] + } + +xmppPingTagName :: Name +xmppPingTagName = "{urn:xmpp}ping" + {- A message with a git-annex tag in it. -} gitAnnexMessage :: Element -> JID -> JID -> Message gitAnnexMessage elt tojid fromjid = (insertGitAnnexTag silentMessage elt) |