netserver/HWProto.hs
author unc0rr
Wed, 30 Apr 2008 20:18:30 +0000
changeset 892 dfe97199f17e
parent 891 701f86df9b4c
child 893 149244d86bf1
permissions -rw-r--r--
Better QUIT handling imlementation - reduces function return values count
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
892
dfe97199f17e Better QUIT handling imlementation - reduces function return values count
unc0rr
parents: 891
diff changeset
     6
handleCmd :: ClientInfo -> [ClientInfo] -> [RoomInfo] -> [String] -> ([ClientInfo], [String])
891
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
892
dfe97199f17e Better QUIT handling imlementation - reduces function return values count
unc0rr
parents: 891
diff changeset
    10
		([client], ["QUIT"])
891
701f86df9b4c Properly handle QUIT command. Now, we can concentrate on protocol implementation
unc0rr
parents: 890
diff changeset
    11
	else
892
dfe97199f17e Better QUIT handling imlementation - reduces function return values count
unc0rr
parents: 891
diff changeset
    12
		(clients, ["QUIT", nick client])
891
701f86df9b4c Properly handle QUIT command. Now, we can concentrate on protocol implementation
unc0rr
parents: 890
diff changeset
    13
892
dfe97199f17e Better QUIT handling imlementation - reduces function return values count
unc0rr
parents: 891
diff changeset
    14
handleCmd client _ _ _ = ([client], ["Bad command"])