aboutsummaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/client.erl30
1 files changed, 30 insertions, 0 deletions
diff --git a/client/client.erl b/client/client.erl
index d0bae4c..a287af3 100644
--- a/client/client.erl
+++ b/client/client.erl
@@ -74,3 +74,33 @@ handle({change_state, NewState}, _) ->
handle(Cmd, Server) ->
{{error, {unknown_command, Cmd}}, Server}.
+
+%queries the server for the current votes this client possesses
+getVotes() ->
+ rpc(Server, getVotes, self()),
+ receive
+ Msg ->
+ Msg
+ end.
+
+%positive vote, increments the votes for {Artist, Title} by one
+vote(Artist, Title) ->
+ rpc(Server, vote, [Artist, Title]),
+ receive
+ {_, ok, Msg} ->
+ Msg;
+ {_, error, Msg} ->
+ {error, Msg}
+ end.
+
+%negative vote, decrements the votes for {Artist, Title} by one
+devote(Artist, Title) ->
+ rpc(Server, devote, [Artist, Title]),
+ receive
+ {_, ok, Msg} ->
+ Msg;
+ {_, error, Msg} ->
+ {error, Msg}
+ end.
+
+