aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/client.erl11
-rw-r--r--server/dispatcher.erl12
2 files changed, 12 insertions, 11 deletions
diff --git a/server/client.erl b/server/client.erl
index 6c81349..03f6276 100644
--- a/server/client.erl
+++ b/server/client.erl
@@ -1,5 +1,5 @@
-module(client).
--export([start/2, loop/2, register/2, login/2]).
+-export([start/2, loop/2]).
start(Node, User) ->
%% start linked processes on client and server to get notice if
@@ -68,12 +68,3 @@ loop(Client, User) ->
Client ! {error, {unknown_command, Cmd}}
end,
loop(Client, User).
-
-register(Client, {Name, Password}) ->
- %% forward the register messages to the dispatcher (if user is not
- %% logged in)
- dis ! {Client, {register, {Name, Password}}}.
-
-login(Client, {Node, Name, Password}) ->
- %% forward the login messages to the dispatcher
- dis ! {Client, {login, {Node, Name, Password}}}.
diff --git a/server/dispatcher.erl b/server/dispatcher.erl
index 08b19ec..a0a0459 100644
--- a/server/dispatcher.erl
+++ b/server/dispatcher.erl
@@ -1,5 +1,5 @@
-module(dispatcher).
--export([start/0, handle/2]).
+-export([start/0, handle/2, register/2, login/2]).
checkUserExists([_|_]) ->
%% helper function to check if given array contains at least one element
@@ -74,3 +74,13 @@ handle({'EXIT', From, _}, State) ->
handle(Cmd, State) ->
%% standard command to find invalid commands and emit an error
{{error, {unknown_command, Cmd}}, State}.
+
+register(Client, {Name, Password}) ->
+ %% forward the register messages to the dispatcher (called form
+ %% the client)
+ dis ! {Client, {register, {Name, Password}}}.
+
+login(Client, {Node, Name, Password}) ->
+ %% forward the login messages to the dispatcher (called form the
+ %% client)
+ dis ! {Client, {login, {Node, Name, Password}}}.