Skip to content

Commit

Permalink
Move functions
Browse files Browse the repository at this point in the history
  • Loading branch information
d1ffuz0r committed Jun 23, 2012
1 parent f857a73 commit 4462fc5
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions apps/bot/src/bot_wrk.erl
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
-module(bot_wrk).
-behaviour(gen_server).
-define(SERVER, ?MODULE).

%% ------------------------------------------------------------------
%% Settings

%% ------------------------------------------------------------------
-define(SERVER, ?MODULE).
-define(USERNAME, "username").
-define(JSERVER, "jabber.ru").
-define(PASSWORD, "password").

%% ------------------------------------------------------------------
%% Includes
%% ------------------------------------------------------------------

-include_lib("exmpp/include/exmpp_client.hrl").
-include_lib("exmpp/include/exmpp_xml.hrl").
-include_lib("exmpp/include/exmpp_nss.hrl").

%% ------------------------------------------------------------------
%% Records
%% ------------------------------------------------------------------

-record(state, {session, name, rooms=[]}).

Expand All @@ -36,6 +43,15 @@
start_link() ->
gen_server:start_link({local, ?SERVER}, ?MODULE, [], []).

stop() ->
gen_server:call(?MODULE, stop).

join(Room) ->
gen_server:call(?MODULE, {join, Room}).

rooms() ->
gen_server:call(?MODULE, listrooms).

%% ------------------------------------------------------------------
%% gen_server Function Definitions
%% ------------------------------------------------------------------
Expand Down Expand Up @@ -90,6 +106,7 @@ code_change(_OldVsn, State, _Extra) ->
%% ------------------------------------------------------------------
%% Internal Function Definitions
%% ------------------------------------------------------------------

process_message("ping" = Message, To, State) ->
io:format("You receiveds: ~s: ~s~n",[To, Message]),
case string:tokens(To, "/") of
Expand All @@ -113,12 +130,3 @@ process_received_packet(#state{name=Name} = State, #received_packet{packet_type=

process_received_packet(_State, _Packet) ->
ok.

stop() ->
gen_server:call(?MODULE, stop).

join(Room) ->
gen_server:call(?MODULE, {join, Room}).

rooms() ->
gen_server:call(?MODULE, listrooms).

0 comments on commit 4462fc5

Please sign in to comment.