xdcc 1.0.1 → 1.0.2
raw patch · 3 files changed
+23/−8 lines, 3 filesdep ~irc-dcc
Dependency ranges changed: irc-dcc
Files
- src/Dcc.hs +2/−1
- src/Main.hs +19/−5
- xdcc.cabal +2/−2
src/Dcc.hs view
@@ -33,7 +33,8 @@ data DccEnv = DccEnv { connection :: Connection , remoteNick :: Nickname- , publicIp :: Maybe IPv4 }+ , publicIp :: Maybe IPv4+ , localPort :: Maybe PortNumber } sendResumeRequest :: OfferFile -> FileOffset -> DccIO FileOffset sendResumeRequest (OfferFile tt f) pos =
src/Main.hs view
@@ -12,6 +12,7 @@ import Control.Monad.Trans.Reader (ask, runReaderT) import qualified Data.CaseInsensitive as CI (mk) import Data.IP (IPv4)+import Network.Socket (PortNumber) import Options.Applicative import Path (fromRelFile) import System.Console.AsciiProgress hiding (Options)@@ -26,6 +27,7 @@ , nick :: Nickname , additionalChannels :: [Channel] , publicIp :: Maybe IPv4+ , lPort :: Maybe PortNumber , verbose :: Bool } deriving (Show) @@ -64,6 +66,13 @@ <> metavar "IP" <> help ( "IPv4 address where you are reachable (only needed for " ++ "Reverse DCC support)." )))+ <*> optional ( fromIntegral <$> option auto+ ( long "localPort"+ <> short 'p'+ <> metavar "LOCAL_PORT"+ <> help ( "Local port to bind to, by default the port is selected "+ ++ "by the operating system (only needed for Reverse DCC "+ ++ "support)." ))) <*> switch ( long "verbose" <> short 'v'@@ -99,7 +108,8 @@ withDccEnv :: Options -> (DccEnv -> a) -> Connection -> a withDccEnv Options {..} f con = f DccEnv { connection = con , publicIp = publicIp- , remoteNick = rNick }+ , remoteNick = rNick+ , localPort = lPort } connectAndJoin :: Network -> Nickname -> [Channel] -> Bool -> ExceptT String IO Connection@@ -113,14 +123,18 @@ download :: OfferFile -> DccIO () download o@(OfferFile _ f) = do env <- ask- lift $ withProgressBar f 0 $- acceptFile o (offerSink env o)+ lift $ withProgressBar f 0 (\onChunk ->+ runReaderT+ (acceptFile o (offerSink env o) onChunk)+ (localPort env) ) resume :: OfferFile -> FileOffset -> DccIO () resume o@(OfferFile tt f) pos = do env <- ask- lift $ withProgressBar f pos $- resumeFile (AcceptResumeFile tt f pos) (offerSink env o)+ lift $ withProgressBar f pos (\onChunk ->+ runReaderT+ (resumeFile (AcceptResumeFile tt f pos) (offerSink env o) onChunk)+ (localPort env) ) withProgressBar :: FileMetadata -> FileOffset
xdcc.cabal view
@@ -1,5 +1,5 @@ name: xdcc-version: 1.0.1+version: 1.0.2 synopsis: A wget-like utility for retrieving files from XDCC bots on IRC description: XDCC (eXtended DCC) is a protocol used by IRC bots to make@@ -34,7 +34,7 @@ , errors >= 2.1.2 && < 2.2 , iproute >= 1.7.0 && < 1.8 , irc-ctcp >= 0.1.3.0 && < 0.2- , irc-dcc >= 1.0.0 && < 1.2+ , irc-dcc >= 1.2.0 && < 1.3 , network >= 2.6.2.1 && < 2.7 , optparse-applicative >= 0.12.1.0 && < 0.13 , path >= 0.5.7 && < 0.6