summaryrefslogtreecommitdiffstats
path: root/ephraim_conn.erl
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2010-06-17 02:23:53 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2010-06-17 02:23:53 +0200
commitca7a0bfa5dd63fc45df0a46800a76d7048e70f2b (patch)
tree9af785b9d1171999b5894251c88146faac1366fe /ephraim_conn.erl
parentc3354ad1fd4f843d80ebdd290c8dbaf81919ca38 (diff)
downloadephraim-ca7a0bfa5dd63fc45df0a46800a76d7048e70f2b.tar
ephraim-ca7a0bfa5dd63fc45df0a46800a76d7048e70f2b.zip
Started writing GUI
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.