diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2013-12-07 23:10:27 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2013-12-07 23:10:27 +0400 |
commit | 1ae7d4877a2a30131babbee54bc0c24651eaba90 (patch) | |
tree | 1d2b6835d70a546859569933d0a34037b029d7c5 /src/Network/BitTorrent/Tracker | |
parent | 44fc77ee51b5aef9d43e3d384845d73646ea1d0e (diff) |
Move JSON options to separate module
Diffstat (limited to 'src/Network/BitTorrent/Tracker')
-rw-r--r-- | src/Network/BitTorrent/Tracker/Message.hs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/Network/BitTorrent/Tracker/Message.hs b/src/Network/BitTorrent/Tracker/Message.hs index 212181b9..943c3af5 100644 --- a/src/Network/BitTorrent/Tracker/Message.hs +++ b/src/Network/BitTorrent/Tracker/Message.hs | |||
@@ -34,6 +34,9 @@ module Network.BitTorrent.Tracker.Message | |||
34 | 34 | ||
35 | -- ** Request | 35 | -- ** Request |
36 | , AnnounceQueryExt (..) | 36 | , AnnounceQueryExt (..) |
37 | , renderAnnounceQueryExt | ||
38 | , parseAnnounceQueryExt | ||
39 | |||
37 | , AnnounceRequest (..) | 40 | , AnnounceRequest (..) |
38 | , parseAnnounceRequest | 41 | , parseAnnounceRequest |
39 | , renderAnnounceRequest | 42 | , renderAnnounceRequest |
@@ -87,6 +90,7 @@ import Network.Socket | |||
87 | import Text.Read (readMaybe) | 90 | import Text.Read (readMaybe) |
88 | 91 | ||
89 | import Data.Torrent.InfoHash | 92 | import Data.Torrent.InfoHash |
93 | import Data.Torrent.JSON | ||
90 | import Data.Torrent.Progress | 94 | import Data.Torrent.Progress |
91 | import Network.BitTorrent.Core | 95 | import Network.BitTorrent.Core |
92 | 96 | ||
@@ -104,7 +108,7 @@ data Event = Started | |||
104 | -- ^ To be sent when the peer completes a download. | 108 | -- ^ To be sent when the peer completes a download. |
105 | deriving (Show, Read, Eq, Ord, Enum, Bounded, Typeable) | 109 | deriving (Show, Read, Eq, Ord, Enum, Bounded, Typeable) |
106 | 110 | ||
107 | $(deriveJSON defaultOptions { fieldLabelModifier = (L.map toLower . L.dropWhile isLower) } ''Event) | 111 | $(deriveJSON omitRecordPrefix ''Event) |
108 | 112 | ||
109 | -- | HTTP tracker protocol compatible encoding. | 113 | -- | HTTP tracker protocol compatible encoding. |
110 | instance QueryValueLike Event where | 114 | instance QueryValueLike Event where |
@@ -174,7 +178,7 @@ data AnnounceQuery = AnnounceQuery | |||
174 | , reqEvent :: Maybe Event | 178 | , reqEvent :: Maybe Event |
175 | } deriving (Show, Eq, Typeable) | 179 | } deriving (Show, Eq, Typeable) |
176 | 180 | ||
177 | $(deriveJSON defaultOptions { fieldLabelModifier = (L.map toLower . L.dropWhile isLower) } ''AnnounceQuery) | 181 | $(deriveJSON omitRecordPrefix ''AnnounceQuery) |
178 | 182 | ||
179 | -- | UDP tracker protocol compatible encoding. | 183 | -- | UDP tracker protocol compatible encoding. |
180 | instance Serialize AnnounceQuery where | 184 | instance Serialize AnnounceQuery where |
@@ -480,7 +484,7 @@ data AnnounceInfo = | |||
480 | , respWarning :: !(Maybe Text) | 484 | , respWarning :: !(Maybe Text) |
481 | } deriving (Show, Typeable) | 485 | } deriving (Show, Typeable) |
482 | 486 | ||
483 | $(deriveJSON defaultOptions { fieldLabelModifier = (L.map toLower . L.dropWhile isLower) } ''AnnounceInfo) | 487 | $(deriveJSON omitRecordPrefix ''AnnounceInfo) |
484 | 488 | ||
485 | -- | HTTP tracker protocol compatible encoding. | 489 | -- | HTTP tracker protocol compatible encoding. |
486 | instance BEncode AnnounceInfo where | 490 | instance BEncode AnnounceInfo where |
@@ -630,7 +634,7 @@ data ScrapeEntry = ScrapeEntry { | |||
630 | , siName :: !(Maybe Text) | 634 | , siName :: !(Maybe Text) |
631 | } deriving (Show, Eq, Typeable) | 635 | } deriving (Show, Eq, Typeable) |
632 | 636 | ||
633 | $(deriveJSON defaultOptions { fieldLabelModifier = (L.map toLower . L.dropWhile isLower) } ''ScrapeEntry) | 637 | $(deriveJSON omitRecordPrefix ''ScrapeEntry) |
634 | 638 | ||
635 | -- | HTTP tracker protocol compatible encoding. | 639 | -- | HTTP tracker protocol compatible encoding. |
636 | instance BEncode ScrapeEntry where | 640 | instance BEncode ScrapeEntry where |