diff options
Diffstat (limited to 'src/Network/BitTorrent/Exchange')
-rw-r--r-- | src/Network/BitTorrent/Exchange/Block.hs | 3 | ||||
-rw-r--r-- | src/Network/BitTorrent/Exchange/Status.hs | 7 |
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 | |||
41 | import Text.PrettyPrint | 41 | import Text.PrettyPrint |
42 | import Text.PrettyPrint.Class | 42 | import Text.PrettyPrint.Class |
43 | 43 | ||
44 | import Data.Torrent.JSON | ||
44 | import Data.Torrent.Piece | 45 | import 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 | ||
89 | getInt :: S.Get Int | 90 | getInt :: S.Get Int |
90 | getInt = fromIntegral <$> S.getWord32be | 91 | getInt = 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 | |||
36 | import Control.Lens | 36 | import Control.Lens |
37 | import Data.Aeson.TH | 37 | import Data.Aeson.TH |
38 | import Data.Default | 38 | import Data.Default |
39 | import Data.List as L | ||
40 | import Data.Maybe | 39 | import Data.Maybe |
41 | import Data.Monoid | 40 | import Data.Monoid |
42 | import Text.PrettyPrint as PP hiding ((<>)) | 41 | import Text.PrettyPrint as PP hiding ((<>)) |
43 | import Text.PrettyPrint.Class | 42 | import Text.PrettyPrint.Class |
44 | 43 | ||
44 | import Data.Torrent.JSON | ||
45 | import Network.BitTorrent.Exchange.Message | 45 | import 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 | ||
65 | instance Pretty PeerStatus where | 66 | instance 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 | ||
108 | instance Pretty SessionStatus where | 109 | instance Pretty SessionStatus where |
109 | pretty SessionStatus {..} = | 110 | pretty SessionStatus {..} = |