From ca7a0bfa5dd63fc45df0a46800a76d7048e70f2b Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 17 Jun 2010 02:23:53 +0200 Subject: Started writing GUI --- ephraim_conn.erl | 45 --------------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 ephraim_conn.erl (limited to 'ephraim_conn.erl') 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. -- cgit v1.2.3