From aa16b66ce4c64dd165292f5fb931d57f09d436d6 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Thu, 14 Oct 2010 10:25:44 +0200 Subject: removed name in server module use references for assign the answers to the client --- server/client.erl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'server') diff --git a/server/client.erl b/server/client.erl index 31d382f..ab55b3d 100644 --- a/server/client.erl +++ b/server/client.erl @@ -3,13 +3,13 @@ start(Node) -> process_flag(trap_exit, true), - {Client, Ref} = server:start_on_node(Node, client, undef), + Client = server:start_on_node(Node, client, undef), link(Client), - Server = spawn_link(client, loop, [{Client, Ref}]), + Server = spawn_link(client, loop, [Client]), - case server:rpc({Client, Ref}, {change_state, Server}) of + case server:rpc(Client, {change_state, Server}) of {ok} -> - {ok, {Client, Ref}}; + {ok, Client}; _ -> {error, unknown_error} end. @@ -17,11 +17,11 @@ start(Node) -> loop(Client) -> receive list -> - server:send(Client, {ok, {foo}}), + Client ! {ok, {foo}}, loop(Client); Cmd -> - server:send(Client, {error, {unknown_command, Cmd}}), + Client ! {error, {unknown_command, Cmd}}, loop(Client) end. -- cgit v1.2.3 From 37a33b4ef3a8d9c4a1b984e44bfe5be03525c302 Mon Sep 17 00:00:00 2001 From: Jakob Pfender Date: Thu, 14 Oct 2010 10:30:13 +0200 Subject: client-side voting --- server/client.erl | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'server') diff --git a/server/client.erl b/server/client.erl index 31d382f..61260b4 100644 --- a/server/client.erl +++ b/server/client.erl @@ -30,3 +30,16 @@ register(Client, {Name, Password}) -> login(Client, {Node, Name, Password}) -> dis ! {Client, {login, {Node, Name, Password}}}. + +getVotes() -> + media:getVotes(self()), + receive + Msg -> + Client ! Msg + end. + +vote(Artist,Title) -> + media:vote(Artist, Title). + +devote(Artist,Title) -> + media:devote(Artist, Title). -- cgit v1.2.3