aboutsummaryrefslogtreecommitdiff
path: root/src/ejabberd_sm.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/ejabberd_sm.erl')
-rw-r--r--src/ejabberd_sm.erl17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/ejabberd_sm.erl b/src/ejabberd_sm.erl
index bb8fb4951..ef0fa1e1c 100644
--- a/src/ejabberd_sm.erl
+++ b/src/ejabberd_sm.erl
@@ -10,7 +10,9 @@
-author('alexey@sevcom.net').
-vsn('$Revision$ ').
--export([start_link/0, init/0, open_session/2, close_session/2,
+-export([start_link/0, init/0,
+ route/3,
+ open_session/2, close_session/2,
bounce_offline_message/3,
get_user_resources/1,
set_presence/3,
@@ -89,11 +91,20 @@ loop() ->
end.
+route(From, To, Packet) ->
+ case catch do_route(From, To, Packet) of
+ {'EXIT', Reason} ->
+ ?ERROR_MSG("~p~nwhen processing: ~p",
+ [Reason, {From, To, Packet}]);
+ _ ->
+ ok
+ end.
+
open_session(User, Resource) ->
- ejabberd_sm ! {open_session, User, Resource, self()}.
+ register_connection(User, Resource, self()).
close_session(User, Resource) ->
- ejabberd_sm ! {close_session, User, Resource}.
+ remove_connection(User, Resource).
register_connection(User, Resource, Pid) ->