aboutsummaryrefslogblamecommitdiffstats
path: root/server/client.erl
blob: 9d778f0b11a9921a5b003c83c7c461c5b111422a (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                
                                                

                

                                  



                 

                               




                                              





                                                 
-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}}}.