netserver/HWProto.hs
author unc0rr
Wed, 30 Apr 2008 20:14:09 +0000
changeset 891 701f86df9b4c
parent 890 1d8c4a5ec622
child 892 dfe97199f17e
permissions -rw-r--r--
Properly handle QUIT command. Now, we can concentrate on protocol implementation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
890
1d8c4a5ec622 - Improve server core
unc0rr
parents:
diff changeset
     1
module HWProto where
1d8c4a5ec622 - Improve server core
unc0rr
parents:
diff changeset
     2
1d8c4a5ec622 - Improve server core
unc0rr
parents:
diff changeset
     3
import IO
1d8c4a5ec622 - Improve server core
unc0rr
parents:
diff changeset
     4
import Miscutils
1d8c4a5ec622 - Improve server core
unc0rr
parents:
diff changeset
     5
891
701f86df9b4c Properly handle QUIT command. Now, we can concentrate on protocol implementation
unc0rr
parents: 890
diff changeset
     6
handleCmd :: ClientInfo -> [ClientInfo] -> [RoomInfo] -> [String] -> (Bool, [ClientInfo], [String])
701f86df9b4c Properly handle QUIT command. Now, we can concentrate on protocol implementation
unc0rr
parents: 890
diff changeset
     7
701f86df9b4c Properly handle QUIT command. Now, we can concentrate on protocol implementation
unc0rr
parents: 890
diff changeset
     8
handleCmd client clients _ ("QUIT":xs) =
701f86df9b4c Properly handle QUIT command. Now, we can concentrate on protocol implementation
unc0rr
parents: 890
diff changeset
     9
	if null (room client) then
701f86df9b4c Properly handle QUIT command. Now, we can concentrate on protocol implementation
unc0rr
parents: 890
diff changeset
    10
		(True, [client], ["QUIT"])
701f86df9b4c Properly handle QUIT command. Now, we can concentrate on protocol implementation
unc0rr
parents: 890
diff changeset
    11
	else
701f86df9b4c Properly handle QUIT command. Now, we can concentrate on protocol implementation
unc0rr
parents: 890
diff changeset
    12
		(True, clients, ["QUIT " ++ nick client])
701f86df9b4c Properly handle QUIT command. Now, we can concentrate on protocol implementation
unc0rr
parents: 890
diff changeset
    13
701f86df9b4c Properly handle QUIT command. Now, we can concentrate on protocol implementation
unc0rr
parents: 890
diff changeset
    14
handleCmd client _ _ _ = (False, [client], ["Bad command"])