summaryrefslogtreecommitdiffstats
path: root/ephraim_conn.erl
diff options
context:
space:
mode:
Diffstat (limited to 'ephraim_conn.erl')
-rw-r--r--ephraim_conn.erl45
1 files changed, 0 insertions, 45 deletions
diff --git a/ephraim_conn.erl b/ephraim_conn.erl
deleted file mode 100644
index 18edd6a..0000000
--- a/ephraim_conn.erl
+++ /dev/null
@@ -1,45 +0,0 @@
--module(ephraim_conn).
--include_lib("exmpp/include/exmpp_client.hrl").
--compile([debug_info, export_all]).
-
--record(conn_state, {
- session :: any(),
- roster :: any()
- }).
-
--spec init() -> ok.
-init() ->
- application:start(exmpp),
- Session = exmpp_session:start(),
- JID = exmpp_jid:make("ephraim-test", "jabber.ccc.de", "Bar"),
- exmpp_session:auth_basic_digest(Session, JID, "foobarbla"),
- exmpp_session:connect_TCP(Session, "jabber.ccc.de", 5222),
- session(#conn_state{session=Session}).
-
--spec session(#conn_state{}) -> ok.
-session(State) ->
- exmpp_session:login(State#conn_state.session),
- exmpp_session:send_packet(State#conn_state.session, exmpp_presence:set_status(exmpp_presence:available(), "Foo/Test\\Bar")),
- loop(State).
-
--spec loop(#conn_state{}) -> ok.
-loop(State) ->
- receive
- stop ->
- exmpp_session:stop(State#conn_state.session);
-
- #received_packet{packet_type=presence, raw_packet=Packet} ->
- From = exmpp_xml:get_attribute(Packet, from, <<"unknown">>),
- Type = atom_to_list(exmpp_presence:get_type(Packet)),
- Status = exmpp_presence:get_status(Packet),
- io:format("~ts is now ~ts: ~ts~n", [From, Type, Status]),
- loop(State);
-
- #received_packet{packet_type=message, raw_packet=Packet} ->
- From = exmpp_xml:get_attribute(Packet, from, <<"unknown">>),
- ephraim ! {receive_message, From, Packet},
- loop(State);
- Msg ->
- io:format("ephraim_conn: ~p~n", [Msg]),
- loop(State)
- end.