diff options
author | Joey Hess <joey@kitenet.net> | 2013-03-16 15:29:51 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-03-16 15:29:51 -0400 |
commit | d6eddd505e7df63c4fa1b96ba7bcab551691d1ff (patch) | |
tree | a4d145aa6dba06b44ff657cf5ad3124014474d6f /Assistant/Types | |
parent | cd35bcc54529dbc926fdf92d11622e2f760f5142 (diff) |
xmpp: --debug now enables a sanitized dump of the XMPP protocol
So I can debug these damn google talk presence issues.
Diffstat (limited to 'Assistant/Types')
-rw-r--r-- | Assistant/Types/NetMessager.hs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Assistant/Types/NetMessager.hs b/Assistant/Types/NetMessager.hs index 55bf896bd..05e51045d 100644 --- a/Assistant/Types/NetMessager.hs +++ b/Assistant/Types/NetMessager.hs @@ -14,6 +14,7 @@ import Data.Text (Text) import Control.Concurrent.STM import Control.Concurrent.MSampleVar import Data.ByteString (ByteString) +import qualified Data.ByteString.Char8 as B8 import qualified Data.Set as S import qualified Data.Map as M @@ -60,6 +61,16 @@ readdressNetMessage (PairingNotification stage _ uuid) c = PairingNotification s readdressNetMessage (Pushing _ stage) c = Pushing c stage readdressNetMessage m _ = m +{- Convert a NetMessage to something that can be logged. -} +sanitizeNetMessage :: NetMessage -> NetMessage +sanitizeNetMessage (Pushing c stage) = Pushing c $ case stage of + ReceivePackOutput _ -> ReceivePackOutput elided + SendPackOutput _ -> SendPackOutput elided + s -> s + where + elided = B8.pack "<elided>" +sanitizeNetMessage m = m + {- Things that initiate either side of a push, but do not actually send data. -} isPushInitiation :: PushStage -> Bool isPushInitiation CanPush = True |