Permalink
Browse files

Moved the join/leave calls to the server process.

  • Loading branch information...
1 parent 1c53aba commit 5c1bfd8a5ac0c1a0ac5a765aa0c9db80a31da292 @baphled committed Mar 29, 2010
Showing with 22 additions and 8 deletions.
  1. +1 −7 lib/chatterl/src/chatterl_client.erl
  2. +21 −1 lib/chatterl/src/chatterl_serv.erl
@@ -22,7 +22,7 @@
%% API
%% Client based
--export([start/1,stop/1, join_group/2, leave_group/2, private_msg/3,get_messages/1]).
+-export([start/1, stop/1, private_msg/3, get_messages/1]).
%% gen_server callbacks
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
@@ -59,12 +59,6 @@ stop(Client) ->
end;
_ -> {error,"Unable to stop"}
end.
-
-join_group(User, Group) ->
- gen_server:call({global, User}, {join_group, Group}).
-
-leave_group(User, Group) ->
- gen_server:call({global, User}, {leave_group, Group}).
%%--------------------------------------------------------------------
%% @doc
@@ -17,7 +17,7 @@
%% API
-export([start/0,stop/0,login/2,logout/1,connect/1,disconnect/1,create/2,drop/1]).
%% User specific
--export([list_users/0,register/2]).
+-export([list_users/0,register/2, join_group/2, leave_group/2]).
%% Group specific
-export([group_description/1,list_groups/0,list_users/1]).
%% gen_server callbacks
@@ -94,6 +94,26 @@ logout(User) ->
{error,Error} -> {error,Error}
end.
+
+%%--------------------------------------------------------------------
+%% @doc
+%% Allows a user to join a group
+%%
+%% @spec join_group(User, Group) -> {ok,Msg} | {error,Error}
+%% @end
+%%--------------------------------------------------------------------
+join_group(User, Group) ->
+ gen_server:call({global, User}, {join_group, Group}).
+
+%%--------------------------------------------------------------------
+%% @doc
+%% Allows a user to leave a group
+%%
+%% @spec leave_group(User, Group) -> {ok,Msg} | {error,Error}
+%% @end
+%%--------------------------------------------------------------------
+leave_group(User, Group) ->
+ gen_server:call({global, User}, {leave_group, Group}).
%%--------------------------------------------------------------------
%% @doc
%% Register a client to chatterl

0 comments on commit 5c1bfd8

Please sign in to comment.