Restructured the project

master
Abhinav Sarkar 9 years ago
parent aaab36d743
commit 7c6bca5028
  1. 8
      hask-irc-runner/Main.hs
  2. 6
      hask-irc-runner/Network/IRC/Runner.hs
  3. 42
      hask-irc.cabal
  4. 0
      src/Network/IRC/Bot.hs
  5. 0
      src/Network/IRC/Client.hs
  6. 0
      src/Network/IRC/Handlers.hs
  7. 0
      src/Network/IRC/Handlers/Auth.hs
  8. 0
      src/Network/IRC/Handlers/Auth/Types.hs
  9. 0
      src/Network/IRC/Handlers/MessageLogger.hs
  10. 15
      src/Network/IRC/Handlers/NickTracker.hs
  11. 0
      src/Network/IRC/Handlers/NickTracker/Types.hs
  12. 0
      src/Network/IRC/Handlers/SongSearch.hs
  13. 0
      src/Network/IRC/Protocol.hs
  14. 0
      src/Network/IRC/Types.hs
  15. 0
      src/Network/IRC/Util.hs

@ -0,0 +1,8 @@
module Main where
import qualified Network.IRC.Runner as Runner
import Prelude
main :: IO ()
main = Runner.run

@ -1,6 +1,6 @@
{-# LANGUAGE OverlappingInstances #-}
module Main (main) where
module Network.IRC.Runner (run) where
import qualified Data.Configurator as CF
@ -24,8 +24,8 @@ instance Configured a => Configured [a] where
convert (List xs) = Just . mapMaybe convert $ xs
convert _ = Nothing
main :: IO ()
main = do
run :: IO ()
run = do
-- get args
args <- getArgs
prog <- getProgName

@ -37,7 +37,7 @@ maintainer: abhinav@abhinavsarkar.net
-- A copyright notice.
-- copyright:
category: Network
category: Network, IRC
build-type: Simple
@ -79,8 +79,20 @@ library
transformers-base >=0.4 && <0.5,
unordered-containers >=0.2 && <0.3
exposed-modules: Network.IRC.Types, Network.IRC.Protocol,
Network.IRC.Handlers, Network.IRC.Client
exposed-modules: Network.IRC.Types,
Network.IRC.Protocol,
Network.IRC.Util,
Network.IRC.Bot,
Network.IRC.Client,
Network.IRC.Handlers,
Network.IRC.Handlers.Auth,
Network.IRC.Handlers.Auth.Types,
Network.IRC.Handlers.MessageLogger,
Network.IRC.Handlers.NickTracker,
Network.IRC.Handlers.NickTracker.Types,
Network.IRC.Handlers.SongSearch
hs-source-dirs: src
default-language: Haskell2010
@ -101,33 +113,15 @@ executable hask-irc
-- Other library packages from which modules are imported.
build-depends: base >=4.5 && <4.8,
text >=0.11 && <0.12,
mtl >=2.1 && <2.2,
network >=2.3 && <2.5,
hask-irc ==0.1.0,
configurator >=0.2 && <0.3,
time >=1.4 && <1.5,
curl-aeson >=0.0.3 && <0.1,
aeson >=0.6.0.0 && <0.7,
HTTP >=4000 && <5000,
transformers >=0.3 && <0.4,
classy-prelude >=0.9 && <1.0,
text-format >=0.3 && <0.4,
filepath >=1.3 && <1.4,
directory >=1.2 && <1.3,
lifted-base >=0.2 && <0.3,
unix >=2.7 && <2.8,
convertible >=1.1 && <1.2,
hslogger >=1.2 && <1.3,
hslogger-template >=2.0 && <2.1,
ixset >=1.0 && <1.1,
acid-state >=0.12 && <0.13,
safecopy >=0.8 && <0.9,
uuid >=1.3 && <1.4,
transformers-base >=0.4 && <0.5,
unordered-containers >=0.2 && <0.3
hslogger >=1.2 && <1.3
-- Directories containing source files.
-- hs-source-dirs:
hs-source-dirs: hask-irc-runner
-- Base language which the package is written in.
default-language: Haskell2010

@ -58,7 +58,7 @@ nickTrackerMsg state Message { .. } = case msgDetails of
NickMsg { .. } ->
handleNickChange state user newNick msgTime >> swap (user, User newNick "") >> return Nothing
NamesMsg { .. } -> do
mapM_ (\n -> updateNickTrack state (User n "") "" msgTime) nicks
forM_ nicks $ \n -> updateNickTrack state (User n "") "" msgTime
refresh nicks >> updateRefreshTime >> return Nothing
IdleMsg { .. } -> do
NickTrackingState { .. } <- readIORef state
@ -69,12 +69,12 @@ nickTrackerMsg state Message { .. } = case msgDetails of
where
updateRefreshTime = atomicModIORef state $ \ s -> s { lastRefreshOn = msgTime }
add = atomicModIORef state . modifyOnlineNicks . flip ((. (Nick . userNick)) . flip insertSet)
remove = atomicModIORef state . modifyOnlineNicks . flip ((. (Nick . userNick)) . flip deleteSet)
add = atomicModIORef state . modifyOnlineNicks . flip ((. (Nick . userNick)) . flip insertSet)
remove = atomicModIORef state . modifyOnlineNicks . flip ((. (Nick . userNick)) . flip deleteSet)
swap users = atomicModIORef state . modifyOnlineNicks $
let (oNick, nNick) = both (Nick . userNick) users
in deleteSet oNick . insertSet nNick
refresh = atomicModIORef state . modifyOnlineNicks . const . setFromList . map Nick
refresh = atomicModIORef state . modifyOnlineNicks . const . setFromList . map Nick
commands = [ ("!nick", handleNickCommand)
, ("!seen", handleSeenCommand) ]
@ -144,9 +144,10 @@ handleSeenCommand = withNickTracks $ \nck nickTracks onlineNicks -> do
, lastMessage = lastMessage'
, nick = Nick lastMessageAs } = maximumByEx (comparing lastMessageOn) nickTracks
return $ (if any (`member` onlineNicks) . map nick $ nickTracks
then nck ++ " is online now"
else nck ++ " was last seen on " ++ fmtTime lastSeenOn') ++
return $
(if any (`member` onlineNicks) . map nick $ nickTracks
then nck ++ " is online now"
else nck ++ " was last seen on " ++ fmtTime lastSeenOn') ++
(if nck /= lastSeenAs then " as " ++ lastSeenAs else "") ++
(if clean lastMessage' == "" then "" else
" and at " ++ fmtTime lastMessageOn' ++ " " ++ nck ++
Loading…
Cancel
Save