summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/Exchange
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/BitTorrent/Exchange')
-rw-r--r--src/Network/BitTorrent/Exchange/Block.hs3
-rw-r--r--src/Network/BitTorrent/Exchange/Status.hs7
2 files changed, 6 insertions, 4 deletions
diff --git a/src/Network/BitTorrent/Exchange/Block.hs b/src/Network/BitTorrent/Exchange/Block.hs
index 5ab73b65..d06fe727 100644
--- a/src/Network/BitTorrent/Exchange/Block.hs
+++ b/src/Network/BitTorrent/Exchange/Block.hs
@@ -41,6 +41,7 @@ import Data.Typeable
41import Text.PrettyPrint 41import Text.PrettyPrint
42import Text.PrettyPrint.Class 42import Text.PrettyPrint.Class
43 43
44import Data.Torrent.JSON
44import Data.Torrent.Piece 45import Data.Torrent.Piece
45 46
46{----------------------------------------------------------------------- 47{-----------------------------------------------------------------------
@@ -84,7 +85,7 @@ data BlockIx = BlockIx {
84 , ixLength :: {-# UNPACK #-} !BlockSize 85 , ixLength :: {-# UNPACK #-} !BlockSize
85 } deriving (Show, Eq, Typeable) 86 } deriving (Show, Eq, Typeable)
86 87
87$(deriveJSON defaultOptions { fieldLabelModifier = (L.map toLower . L.dropWhile isLower) } ''BlockIx) 88$(deriveJSON omitRecordPrefix ''BlockIx)
88 89
89getInt :: S.Get Int 90getInt :: S.Get Int
90getInt = fromIntegral <$> S.getWord32be 91getInt = fromIntegral <$> S.getWord32be
diff --git a/src/Network/BitTorrent/Exchange/Status.hs b/src/Network/BitTorrent/Exchange/Status.hs
index 42766428..8472e575 100644
--- a/src/Network/BitTorrent/Exchange/Status.hs
+++ b/src/Network/BitTorrent/Exchange/Status.hs
@@ -36,14 +36,15 @@ module Network.BitTorrent.Exchange.Status
36import Control.Lens 36import Control.Lens
37import Data.Aeson.TH 37import Data.Aeson.TH
38import Data.Default 38import Data.Default
39import Data.List as L
40import Data.Maybe 39import Data.Maybe
41import Data.Monoid 40import Data.Monoid
42import Text.PrettyPrint as PP hiding ((<>)) 41import Text.PrettyPrint as PP hiding ((<>))
43import Text.PrettyPrint.Class 42import Text.PrettyPrint.Class
44 43
44import Data.Torrent.JSON
45import Network.BitTorrent.Exchange.Message 45import Network.BitTorrent.Exchange.Message
46 46
47
47{----------------------------------------------------------------------- 48{-----------------------------------------------------------------------
48-- Peer status 49-- Peer status
49-----------------------------------------------------------------------} 50-----------------------------------------------------------------------}
@@ -60,7 +61,7 @@ data PeerStatus = PeerStatus
60 } deriving (Show, Eq, Ord) 61 } deriving (Show, Eq, Ord)
61 62
62$(makeLenses ''PeerStatus) 63$(makeLenses ''PeerStatus)
63$(deriveJSON defaultOptions { fieldLabelModifier = L.tail } ''PeerStatus) 64$(deriveJSON omitLensPrefix ''PeerStatus)
64 65
65instance Pretty PeerStatus where 66instance Pretty PeerStatus where
66 pretty PeerStatus {..} = 67 pretty PeerStatus {..} =
@@ -103,7 +104,7 @@ data SessionStatus = SessionStatus
103 } deriving (Show, Eq) 104 } deriving (Show, Eq)
104 105
105$(makeLenses ''SessionStatus) 106$(makeLenses ''SessionStatus)
106$(deriveJSON defaultOptions { fieldLabelModifier = L.tail } ''SessionStatus) 107$(deriveJSON omitRecordPrefix ''SessionStatus)
107 108
108instance Pretty SessionStatus where 109instance Pretty SessionStatus where
109 pretty SessionStatus {..} = 110 pretty SessionStatus {..} =