irc-core 2.11 → 2.12
raw patch · 5 files changed
+34/−15 lines, 5 filesdep ~basedep ~bytestringdep ~primitivePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, bytestring, primitive, text, time, vector
API changes (from Hackage documentation)
+ Irc.Codes: pattern RPL_WHOISTEXT :: ReplyCode
+ Irc.Message: Away :: !Source -> Maybe Text -> IrcMsg
+ Irc.Message: TargetExisting :: !Identifier -> MessageTarget
+ Irc.UserInfo: instance GHC.Classes.Ord Irc.UserInfo.UserInfo
Files
- ChangeLog.md +4/−0
- irc-core.cabal +10/−9
- src/Irc/Codes.hs +2/−0
- src/Irc/Message.hs +16/−4
- src/Irc/UserInfo.hs +2/−2
ChangeLog.md view
@@ -1,5 +1,9 @@ # Revision history for irc-core +## 2.12++* Added constructors for AWAY+ ## 2.11 * Added extra reply code patterns. Sasl errors renamed to ERR_ prefix
irc-core.cabal view
@@ -1,6 +1,6 @@-cabal-version: 2.4+cabal-version: 3.0 name: irc-core-version: 2.11+version: 2.12 synopsis: IRC core library for glirc description: IRC core library for glirc .@@ -12,9 +12,10 @@ copyright: 2016 Eric Mertens category: Network build-type: Simple-extra-source-files: ChangeLog.md+extra-doc-files: ChangeLog.md homepage: https://github.com/glguy/irc-core bug-reports: https://github.com/glguy/irc-core/issues+tested-with: GHC==9.4.7 source-repository head type: git@@ -32,15 +33,15 @@ Irc.UserInfo other-modules: View - build-depends: base >=4.11 && <4.17,+ build-depends: base >=4.11 && <4.20, base64-bytestring >= 1.0.0.1 && <1.3, attoparsec ^>=0.14,- bytestring >=0.10 && <0.12,+ bytestring >=0.10 && <0.13, hashable >=1.2 && <1.5,- primitive >=0.6 && <0.8,- text >=1.2 && <2.1,- time >=1.6 && <1.12,- vector >=0.11 && <0.13+ primitive >=0.6 && <0.10,+ text >=1.2 && <2.2,+ time >=1.6 && <1.13,+ vector >=0.11 && <0.14 hs-source-dirs: src default-language: Haskell2010
src/Irc/Codes.hs view
@@ -175,6 +175,7 @@ pattern RPL_LISTUSAGE = ReplyCode 334 pattern RPL_COMMANDSYNTAX = ReplyCode 334 pattern RPL_LISTSYNTAX = ReplyCode 334+pattern RPL_WHOISTEXT = ReplyCode 337 pattern RPL_WHOISACTUALLY = ReplyCode 338 pattern RPL_BADCHANPASS = ReplyCode 339 pattern RPL_INVITING = ReplyCode 341@@ -605,6 +606,7 @@ , (RPL_LISTUSAGE , ReplyCodeInfo CommandReply "list-usage") , (RPL_COMMANDSYNTAX , ReplyCodeInfo CommandReply "command-syntax") , (RPL_LISTSYNTAX , ReplyCodeInfo CommandReply "list-syntax")+ , (RPL_WHOISTEXT , ReplyCodeInfo CommandReply "whois-text") , (RPL_WHOISACTUALLY , ReplyCodeInfo CommandReply "whois-actually") , (RPL_BADCHANPASS , ReplyCodeInfo CommandReply "bad-chanpass") , (RPL_INVITING , ReplyCodeInfo CommandReply "inviting")
src/Irc/Message.hs view
@@ -74,6 +74,7 @@ | Chghost !Source !Text !Text -- ^ Target, new username and new hostname | Wallops !Source !Text -- ^ Braodcast message: Source, message | Invite !Source !Identifier !Identifier -- ^ sender target channel+ | Away !Source (Maybe Text) deriving Show data Source = Source { srcUser :: {-# UNPACK #-}!UserInfo, srcAcct :: !Text }@@ -208,6 +209,10 @@ , [target, channel] <- view msgParams msg -> Invite source (mkId target) (mkId channel) + "AWAY" | Just source <- msgSource msg+ , message <- view msgParams msg ->+ Away source (listToMaybe message)+ _ -> UnknownMsg msg -- | Parse a CTCP encoded message:@@ -223,9 +228,10 @@ -- | Targets used to direct a message to a window for display data MessageTarget- = TargetUser !Identifier -- ^ Metadata update for a user- | TargetWindow !Identifier -- ^ Directed message to channel or from user- | TargetNetwork -- ^ Network-level message+ = TargetUser !Identifier -- ^ Metadata update for a user+ | TargetExisting !Identifier -- ^ Directed message to window that already exists+ | TargetWindow !Identifier -- ^ Directed message to channel or from user+ | TargetNetwork -- ^ Network-level message deriving (Show) -- | Target information for the window that could be appropriate to@@ -259,6 +265,7 @@ Account user _ -> TargetUser (userNick (srcUser user)) Chghost user _ _ -> TargetUser (userNick (srcUser user)) Wallops _ _ -> TargetNetwork+ Away user _ -> TargetExisting (userNick (srcUser user)) where directed src tgt | Text.null (userHost src) = TargetNetwork -- server message@@ -267,7 +274,9 @@ replyTarget RPL_TOPIC (_:chan:_) = TargetWindow (mkId chan) replyTarget RPL_INVITING (_:_:chan:_) = TargetWindow (mkId chan)- replyTarget _ _ = TargetNetwork+ replyTarget RPL_NOWAWAY (who:_) = TargetUser (mkId who)+ replyTarget RPL_UNAWAY (who:_) = TargetUser (mkId who)+ replyTarget _ _ = TargetNetwork -- | 'UserInfo' of the user responsible for a message. msgActor :: IrcMsg -> Maybe Source@@ -298,6 +307,7 @@ BatchEnd{} -> Nothing Chghost x _ _ -> Just x Wallops x _ -> Just x+ Away x _ -> Just x renderSource :: Source -> Text renderSource (Source u "") = renderUserInfo u@@ -333,6 +343,8 @@ Invite _ _ _ -> "" Chghost x a b -> Text.unwords [renderSource x, a, b] Wallops x t -> Text.unwords [renderSource x, t]+ Away x (Just t) -> Text.unwords [renderSource x, "away", t]+ Away x Nothing -> Text.unwords [renderSource x, "back"] capCmdText :: CapCmd -> Text capCmdText cmd =
src/Irc/UserInfo.hs view
@@ -32,14 +32,14 @@ import Irc.Identifier --- | 'UserInfo' packages a nickname along with the username and hsotname+-- | 'UserInfo' packages a nickname along with the username and hostname -- if they are known in the current context. data UserInfo = UserInfo { userNick :: {-# UNPACK #-} !Identifier -- ^ nickname , userName :: {-# UNPACK #-} !Text -- ^ username, empty when missing , userHost :: {-# UNPACK #-} !Text -- ^ hostname, empty when missing }- deriving (Eq, Read, Show)+ deriving (Eq, Ord, Read, Show) -- | Lens into 'userNick' field. uiNick :: Functor f => (Identifier -> f Identifier) -> UserInfo -> f UserInfo