packages feed

tellbot 0.6.0.3 → 0.6.0.4

raw patch · 4 files changed

+12/−6 lines, 4 files

Files

CHANGELOG.md view
@@ -1,6 +1,12 @@ tellbot CHANGELOG ================= +### 0.6.0.4++- Nicer colors for titles.+    - Nicer colors for titles.+- Fixed title (whitespaces trimming).+ ### 0.6.0.3  #### Patch changes
src/HTML.hs view
@@ -3,17 +3,17 @@ import Control.Exception ( SomeException, catch ) import Data.ByteString.Lazy ( toStrict ) import Network.HTTP.Conduit-import Data.Text ( pack, strip, unpack )+import Data.Text as T ( concat, lines, pack, strip, unpack ) import Data.Text.Encoding ( decodeUtf8 ) import Text.HTML.TagSoup import Text.Regex.PCRE ( (=~) )  htmlTitle :: FilePath -> String -> IO (Maybe String) htmlTitle regPath url = flip catch handleException $ do-    regexps <- fmap lines $ readFile regPath +    regexps <- fmap Prelude.lines $ readFile regPath      if (safeHost regexps url) then do       putStrLn $ url ++ " is safe"-      fmap (extractTitle . unpack . decodeUtf8 . toStrict) (simpleHttp url)+      fmap (extractTitle . unpack . T.concat . T.lines . decodeUtf8 . toStrict) (simpleHttp url)       else         pure Nothing   where@@ -23,7 +23,7 @@ extractTitle :: String -> Maybe String extractTitle body =   case dropTillTitle (parseTags body) of-    (TagText title:TagClose "title":_) -> pure (chomp $ "\ETX9« " ++ title ++ " »\SI")+    (TagText title:TagClose "title":_) -> pure ("\ETX7« \ETX6" ++ chomp title ++ " \ETX7»\SI")     _ -> Nothing  dropTillTitle :: [Tag String] -> [Tag String]
src/Main.hs view
@@ -19,7 +19,7 @@ import System.IO  version :: Version-version = Version [0,6,0,2] ["Apfelschorle"]+version = Version [0,6,0,4] ["Apfelschorle"]  type Server     = String type Chan       = String
tellbot.cabal view
@@ -1,5 +1,5 @@ name:                tellbot-version:             0.6.0.3+version:             0.6.0.4 synopsis:            IRC tellbot description:         An IRC bot that can be used to create queuing message.                      It also offers a simple administration IRC bot interface.