From fe4a256c05727f43c6c793b620b1638b88c830b3 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 9 Oct 2010 15:04:16 +0200 Subject: Add advanced_event behaviour and use it for account events --- src/core/ephraim_conv_handler.erl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/core/ephraim_conv_handler.erl') diff --git a/src/core/ephraim_conv_handler.erl b/src/core/ephraim_conv_handler.erl index 681e53a..6949661 100644 --- a/src/core/ephraim_conv_handler.erl +++ b/src/core/ephraim_conv_handler.erl @@ -1,6 +1,6 @@ -module(ephraim_conv_handler). -include_lib("exmpp/include/exmpp_client.hrl"). --behaviour(gen_event). +-behaviour(advanced_event). -export([start/4]). -export([init/1, handle_event/2, handle_call/2, handle_info/2, terminate/2, code_change/3]). @@ -13,7 +13,7 @@ }). start(Supervisor, EventManager, Conn, Roster) -> - gen_event:add_handler(EventManager, ?MODULE, #conv_handler_state{supervisor=Supervisor,event_manager=EventManager,connection=Conn,roster=Roster}). + advanced_event:add_handler(EventManager, ?MODULE, #conv_handler_state{supervisor=Supervisor,event_manager=EventManager,connection=Conn,roster=Roster}). init(State) -> {ok, State}. @@ -44,12 +44,12 @@ get_conv(State, JID) -> handle_event({view_request, {conversation,JID,new}}, State) -> {NewState, _} = get_conv(State, JID), - {ok, NewState}; + {handled, NewState}; handle_event({view_request, {conversation,JID,{send_message,Type,Body}}}, State) -> {NewState, Conv} = get_conv(State, JID), ephraim_conv:send_message(Conv, Type, Body), - {ok, NewState}; + {handled, NewState}; handle_event({received_packet, #received_packet{packet_type=message, raw_packet=Packet}}, State) -> From = exmpp_xml:get_attribute(Packet, from, <<"unknown">>), @@ -69,7 +69,7 @@ handle_event({received_packet, #received_packet{packet_type=message, raw_packet= io:format("Received strange message from ~p:~n~p~n", [From, Packet]), State end, - {ok, NewState}; + {handled, NewState}; handle_event(_Event, State) -> {ok, State}. -- cgit v1.2.3