summaryrefslogtreecommitdiffstats
path: root/src/core/ephraim_conv.erl
blob: 8f530988c2b9991b7f31c4a1019bafa8cc2e05ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
-module(ephraim_conv).
-compile([debug_info, export_all]).

-record(conv_state, {
	  jid :: exmpp_jid:jid()
	 }).

-spec init(exmpp_jid:jid()) -> ok.
init(JID) ->
    io:format("Starting a conversation with ~p~n", [JID]),
    loop(#conv_state{jid=JID}),
    io:format("Stopping a conversation with ~p~n", [JID]).

-spec loop(#conv_state{}) -> ok.
loop(State) ->
    receive
        stop ->
	    ok;
	
	{receive_message, _Packet} ->
	    %io:format("Received packet from ~p: ~p~n", [State#conv_state.jid, Packet]),
	    loop(State);
	
	Msg ->
	    io:format("ephraim_conv (~p): ~p~n", [State#conv_state.jid, Msg]),
	    loop(State)
    end.