From 579e1972d597c7af284f1c1a4d4fc598e1516b7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20R=C3=A9mond?= Date: Sat, 17 Jan 2009 16:33:35 +0000 Subject: [PATCH] * src/ejabberd_c2s.erl: Added comments. SVN Revision: 1823 --- ChangeLog | 4 ++++ src/ejabberd_c2s.erl | 14 +++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 774585bc2..a1e798807 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2009-01-17 Mickael Remond + + * src/ejabberd_c2s.erl: Added comments. + 2009-01-16 Badlop * src/mod_privacy.erl: Privacy list items must be processed in the diff --git a/src/ejabberd_c2s.erl b/src/ejabberd_c2s.erl index e38037f4f..117bbc9b3 100644 --- a/src/ejabberd_c2s.erl +++ b/src/ejabberd_c2s.erl @@ -836,7 +836,7 @@ wait_for_session({xmlstreamelement, El}, StateData) -> pres_t = ?SETS:from_list(Ts1), privacy_list = PrivList}); _ -> - ejabberd_hooks:run(forbidden_session_hook, + ejabberd_hooks:run(forbidden_session_hook, StateData#state.server, [JID]), ?INFO_MSG("(~w) Forbidden session for ~s", [StateData#state.socket, @@ -895,7 +895,8 @@ session_established({xmlstreamerror, _}, StateData) -> session_established(closed, StateData) -> {stop, normal, StateData}. - +%% Process packets sent by user (coming from user on c2s XMPP +%% connection) session_established2(El, StateData) -> {xmlelement, Name, Attrs, _Els} = El, User = StateData#state.user, @@ -1053,6 +1054,7 @@ handle_info(replaced, _StateName, StateData) -> ?SERRT_CONFLICT(Lang, "Replaced by new connection")) ++ ?STREAM_TRAILER), {stop, normal, StateData#state{authenticated = replaced}}; +%% Process Packets that are to be send to the user handle_info({route, From, To, Packet}, StateName, StateData) -> {xmlelement, Name, Attrs, Els} = Packet, {Pass, NewAttrs, NewState} = @@ -1121,9 +1123,9 @@ handle_info({route, From, To, Packet}, StateName, StateData) -> LBFrom = jlib:jid_remove_resource(LFrom), %% Note contact availability case xml:get_attr_s("type", Attrs) of - "unavailable" -> + "unavailable" -> mod_caps:clear_caps(From); - _ -> + _ -> Caps = mod_caps:read_caps(Els), mod_caps:note_caps(StateData#state.server, From, Caps) end, @@ -1457,6 +1459,7 @@ process_presence_probe(From, To, StateData) -> end end. +%% User updates his presence (non-directed presence packet) presence_update(From, Packet, StateData) -> {xmlelement, _Name, Attrs, _Els} = Packet, case xml:get_attr_s("type", Attrs) of @@ -1560,6 +1563,7 @@ presence_update(From, Packet, StateData) -> NewState end. +%% User sends a directed presence packet presence_track(From, To, Packet, StateData) -> {xmlelement, _Name, Attrs, _Els} = Packet, LTo = jlib:jid_tolower(To), @@ -1978,7 +1982,7 @@ fsm_reply(Reply, StateName, StateData) -> %% Used by c2s blacklist plugins is_ip_blacklisted({IP,_Port}) -> - ejabberd_hooks:run_fold(check_bl_c2s, false, [IP]). + ejabberd_hooks:run_fold(check_bl_c2s, false, [IP]). %% Check from attributes %% returns invalid-from|NewElement