twidge 0.99.1 → 0.99.2
raw patch · 4 files changed
+75/−7 lines, 4 filesdep +utf8-stringdep −Cabal
Dependencies added: utf8-string
Dependencies removed: Cabal
Files
- COPYRIGHT +38/−0
- Commands/Ls.hs +5/−5
- Utils.hs +30/−0
- twidge.cabal +2/−2
COPYRIGHT view
@@ -24,3 +24,41 @@ If the GPL is unacceptable for your uses, please e-mail me; alternative terms can be negotiated for your project. +----------------------------------------------------------------------++Two small functions, wrapText and wrapLines, in Utils.hs were copied+from Cabal 1.4.0.2. It bears this license:++Copyright (c) 2003-2007, Isaac Jones, Simon Marlow, Martin Sjögren,+ Bjorn Bringert, Krasimir Angelov,+ Malcolm Wallace, Ross Patterson, Ian Lynagh,+ Duncan Coutts, Thomas Schilling+All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are+met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Isaac Jones nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Commands/Ls.hs view
@@ -31,9 +31,9 @@ import Config import Data.Either.Utils(forceEither) import Control.Monad(when)-import Distribution.Simple.Utils(wrapText) import HSH import System.Console.GetOpt.Utils+import qualified System.IO.UTF8 as UTF8 i = infoM "ls" @@ -228,7 +228,7 @@ (printf "%-22s %s\n" ("<" ++ sSender m ++ ">") (head wrappedtext)) ++ concatMap (printf "%-22s %s\n" "") (tail wrappedtext)- where wrappedtext = wrapText (80 - 22 - 2) (words (sText m))+ where wrappedtext = map unwords $ wrapLine (80 - 22 - 2) (words (sText m)) shortDM :: Message -> String shortDM m =@@ -236,7 +236,7 @@ ("<" ++ sRecipient m ++ ">") (head wrappedtext)) ++ concatMap (printf "%-22s %-22s %s\n" "" "") (tail wrappedtext)- where wrappedtext = wrapText (80 - 22 - 22 - 3) (words (sText m))+ where wrappedtext = map unwords $ wrapLine (80 - 22 - 22 - 3) (words (sText m)) printStatus section cp args m = printGeneric shortStatus longStatus section cp args m@@ -251,8 +251,8 @@ (Just cmd, _) -> runIO $ (cmd, [sId m, sSender m, sRecipient m, sText m, sDate m])- (Nothing, Nothing) -> putStr (shortfunc m)- (Nothing, Just _) -> putStr (longfunc m)+ (Nothing, Nothing) -> UTF8.putStr (shortfunc m)+ (Nothing, Just _) -> UTF8.putStr (longfunc m) Just recipient -> mailto section cp args m recipient where msgid = genMsgId section m cp
Utils.hs view
@@ -117,3 +117,33 @@ host, section) _ -> Nothing where repat = "^<([^.@]+)\\.([^.@]+)\\.([^@.]*)@([^.]+)\\.(.+)\\.twidge>"++----------------------------------------------------------------------+-- Start of code from Cabal 1.4.0.2++-- | Wraps text to the default line width. Existing newlines are preserved.+wrapText :: String -> String+wrapText = unlines+ . concatMap (map unwords+ . wrapLine 79+ . words)+ . lines++-- | Wraps a list of words to a list of lines of words of a particular width.+wrapLine :: Int -> [String] -> [[String]]+wrapLine width = wrap 0 []+ where wrap :: Int -> [String] -> [String] -> [[String]]+ wrap 0 [] (w:ws)+ | length w + 1 > width+ = wrap (length w) [w] ws+ wrap col line (w:ws)+ | col + length w + 1 > width+ = reverse line : wrap 0 [] (w:ws)+ wrap col line (w:ws)+ = let col' = col + length w + 1+ in wrap col' (w:line) ws+ wrap _ [] [] = []+ wrap _ line [] = [reverse line]++-- End of code from Cabal 1.4.0.2+----------------------------------------------------------------------
twidge.cabal view
@@ -1,5 +1,5 @@ Name: twidge-Version: 0.99.1+Version: 0.99.2 License: GPL Maintainer: John Goerzen <jgoerzen@complete.org> Author: John Goerzen@@ -40,7 +40,7 @@ Build-Depends: network, unix, parsec, MissingH>=1.0.0, mtl, base, HaXml>=1.13.2, HaXml<1.19, hslogger,- ConfigFile, directory, HSH, Cabal, regex-posix+ ConfigFile, directory, HSH, regex-posix, utf8-string Executable: twidge Main-Is: twidge.hs