equal
deleted
inserted
replaced
1 {-# LANGUAGE OverloadedStrings #-} |
1 {-# LANGUAGE OverloadedStrings #-} |
2 module HWProtoNEState where |
2 module HWProtoNEState where |
3 |
3 |
4 import qualified Data.IntMap as IntMap |
|
5 import Data.Maybe |
4 import Data.Maybe |
6 import Data.List |
5 import Data.List |
7 import Data.Word |
|
8 import Control.Monad.Reader |
6 import Control.Monad.Reader |
9 import qualified Data.ByteString.Char8 as B |
7 import qualified Data.ByteString.Char8 as B |
10 -------------------------------------- |
8 -------------------------------------- |
11 import CoreTypes |
9 import CoreTypes |
12 import Actions |
10 import Actions |
43 AnswerClients [sendChan cl] ["PROTO", B.pack $ show parsedProto] : |
41 AnswerClients [sendChan cl] ["PROTO", B.pack $ show parsedProto] : |
44 [CheckRegistered | not . B.null $ nick cl] |
42 [CheckRegistered | not . B.null $ nick cl] |
45 where |
43 where |
46 parsedProto = case B.readInt protoNum of |
44 parsedProto = case B.readInt protoNum of |
47 Just (i, t) | B.null t -> fromIntegral i |
45 Just (i, t) | B.null t -> fromIntegral i |
48 otherwise -> 0 |
46 _ -> 0 |
49 |
47 |
50 |
48 |
51 handleCmd_NotEntered ["PASSWORD", passwd] = do |
49 handleCmd_NotEntered ["PASSWORD", passwd] = do |
52 (ci, irnc) <- ask |
50 (ci, irnc) <- ask |
53 let cl = irnc `client` ci |
51 let cl = irnc `client` ci |