aboutsummaryrefslogtreecommitdiffstats
path: root/server/client.erl
blob: 9d778f0b11a9921a5b003c83c7c461c5b111422a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
-module(client).
-export([start/1, loop/1, register/2, login/2]).

start(Client) ->
    process_flag(trap_exit, true),
    spawn(client, loop, [Client]).

loop(Client) ->
    receive
	{list} ->
	    Client ! {ok, foo},
	    loop(Client);

	true ->
	    Client ! {error, unknown_command},
	    loop(Client)
    end.

register(Client, {Name, Password}) ->
    dis ! {Client, {register, {Name, Password}}}.

login(Client, {Name, Password}) ->
    dis ! {Client, {login, {Name, Password}}}.