irc 0.4.3 → 0.4.4.2
raw patch · 6 files changed
+21/−65 lines, 6 filesdep ~basedep ~parsecPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, parsec
API changes (from Hackage documentation)
+ Network.IRC.Base: msg_command :: Message -> Command
+ Network.IRC.Base: msg_params :: Message -> [Parameter]
+ Network.IRC.Base: msg_prefix :: Message -> Maybe Prefix
- Network.IRC.Base: Message :: (Maybe Prefix) -> Command -> [Parameter] -> Message
+ Network.IRC.Base: Message :: Maybe Prefix -> Command -> [Parameter] -> Message
Files
- Network/IRC.hs +1/−16
- Network/IRC/Base.hs +7/−21
- Network/IRC/Parser.hs +3/−16
- irc.cabal +8/−5
- tests/Makefile +1/−1
- tests/Tests.hs +1/−6
Network/IRC.hs view
@@ -1,22 +1,7 @@--- This file is part of irc.---- irc is free software; you can redistribute it and/or modify--- it under the terms of the GNU Lesser General Public License as published by--- the Free Software Foundation; either version 3 of the License, or--- (at your option) any later version.---- irc is distributed in the hope that it will be useful,--- but WITHOUT ANY WARRANTY; without even the implied warranty of--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the--- GNU Lesser General Public License for more details.---- You should have received a copy of the GNU Lesser General Public License--- along with this program. If not, see <http://www.gnu.org/licenses/>.- -- | -- Module : Network.IRC -- Copyright : (c) Trevor Elliott 2007--- License : LGPL+-- License : BSD3 -- -- Maintainer : trevor@geekgateway.com -- Stability : experimental
Network/IRC/Base.hs view
@@ -1,18 +1,3 @@--- This file is part of irc.---- irc is free software; you can redistribute it and/or modify--- it under the terms of the GNU Lesser General Public License as published by--- the Free Software Foundation; either version 3 of the License, or--- (at your option) any later version.---- irc is distributed in the hope that it will be useful,--- but WITHOUT ANY WARRANTY; without even the implied warranty of--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the--- GNU Lesser General Public License for more details.---- You should have received a copy of the GNU Lesser General Public License--- along with this program. If not, see <http://www.gnu.org/licenses/>.- -- | Datatypes for representing IRC messages, as well as formatting them. module Network.IRC.Base ( -- * Type Synonyms@@ -23,8 +8,8 @@ , Command -- * IRC Datatypes- , Prefix(Server, NickName)- , Message(Message)+ , Prefix(..)+ , Message(..) -- * Formatting functions , encode -- :: Message -> String@@ -50,10 +35,11 @@ -- | IRC messages are parsed as: -- [ ':' prefix space ] command { space param } crlf-data Message- = -- | IRC Message- Message (Maybe Prefix) Command [Parameter]- deriving (Show,Read,Eq)+data Message = Message + { msg_prefix :: Maybe Prefix+ , msg_command :: Command+ , msg_params :: [Parameter]+ } deriving (Show,Read,Eq) -- | The optional beginning of an IRC messages
Network/IRC/Parser.hs view
@@ -1,18 +1,3 @@--- This file is part of irc.---- irc is free software; you can redistribute it and/or modify--- it under the terms of the GNU Lesser General Public License as published by--- the Free Software Foundation; either version 3 of the License, or--- (at your option) any later version.---- irc is distributed in the hope that it will be useful,--- but WITHOUT ANY WARRANTY; without even the implied warranty of--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the--- GNU Lesser General Public License for more details.---- You should have received a copy of the GNU Lesser General Public License--- along with this program. If not, see <http://www.gnu.org/licenses/>.- -- | Parsec parsers and a general parsing interface for IRC messages module Network.IRC.Parser ( -- * Parsing and Formatting Functions@@ -96,7 +81,9 @@ -- | Parse a cr lf crlf :: CharParser st ()-crlf = optional (char '\r') >> char '\n' >> return ()+crlf = (char '\r' >> optional (char '\n'))+ <|> (char '\n' >> return () )+ -- | Parse a Message message :: CharParser st Message
irc.cabal view
@@ -1,21 +1,24 @@ name: irc synopsis: A small library for parsing IRC messages. description: A set of combinators and types for parsing IRC messages.-version: 0.4.3-category: Data+version: 0.4.4.2+category: Data, Network license: BSD3 license-file: LICENSE author: Trevor Elliott maintainer: trevor@geekgateway.com-homepage: http://code.haskell.org/~elliottt/code/irc extra-source-files: tests/Makefile, tests/Tests.hs-cabal-version: >= 1.2.0+cabal-version: >= 1.6.0 build-type: Simple +source-repository head+ type: git+ location: git://github.com/elliottt/hsirc.git+ library ghc-options: -Wall- build-depends: base, parsec >= 2.1.0.0+ build-depends: base == 4.*, parsec == 2.1.* exposed-Modules: Network.IRC, Network.IRC.Base, Network.IRC.Commands,
tests/Makefile view
@@ -2,7 +2,7 @@ TARGET = Tests all : $(ODIR)- ghc --make -odir=$(ODIR) -hidir=$(ODIR) $(TARGET)+ ghc --make -odir=$(ODIR) -hidir=$(ODIR) $(TARGET) -i../ ./$(TARGET) $(ODIR) :
tests/Tests.hs view
@@ -24,7 +24,6 @@ deriving (Read,Show,Eq) instance Arbitrary Identifier where- coarbitrary = undefined arbitrary = do l <- letter ls <- sized $ \n -> loop n@@ -39,7 +38,6 @@ newtype Host = Host { unHost :: String } instance Arbitrary Host where- coarbitrary = undefined arbitrary = do l <- identifier ls <- sized $ \n -> loop n@@ -87,7 +85,6 @@ arbitrary = let c = (replyTable !!) <$> choose (0, length replyTable - 1) in Cmd . fst <$> c- coarbitrary = undefined instance Arbitrary Prefix where@@ -99,7 +96,6 @@ , do host <- unHost <$> arbitrary return $ Server host ]- coarbitrary = undefined instance Arbitrary Message where@@ -107,7 +103,6 @@ let params = map unIdentifier <$> sized vector cmd = unCmd <$> arbitrary in Message <$> arbitrary <*> cmd <*> params- coarbitrary = undefined -- ---------------------------------------------------------@@ -126,7 +121,7 @@ [ encode (Message Nothing "PRIVMSG" ["#foo", ":bar bas"]) @?= "PRIVMSG #foo ::bar bas" , encode (Message Nothing "PRIVMSG" ["#foo", ":bar"]) @?=- "PRIVMSG #foo :bar"+ "PRIVMSG #foo ::bar" -- Corrected case , decode ":talon.nl.eu.SwiftIRC.net 332 foo #bar :\n" @?=