25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

* src/ejabberd_c2s.erl: Added comments.

SVN Revision: 1823
This commit is contained in:
Mickaël Rémond 2009-01-17 16:33:35 +00:00
parent 43e12a3702
commit 579e1972d5
2 changed files with 13 additions and 5 deletions

View File

@ -1,3 +1,7 @@
2009-01-17 Mickael Remond <mremond@process-one.net>
* src/ejabberd_c2s.erl: Added comments.
2009-01-16 Badlop <badlop@process-one.net> 2009-01-16 Badlop <badlop@process-one.net>
* src/mod_privacy.erl: Privacy list items must be processed in the * src/mod_privacy.erl: Privacy list items must be processed in the

View File

@ -836,7 +836,7 @@ wait_for_session({xmlstreamelement, El}, StateData) ->
pres_t = ?SETS:from_list(Ts1), pres_t = ?SETS:from_list(Ts1),
privacy_list = PrivList}); privacy_list = PrivList});
_ -> _ ->
ejabberd_hooks:run(forbidden_session_hook, ejabberd_hooks:run(forbidden_session_hook,
StateData#state.server, [JID]), StateData#state.server, [JID]),
?INFO_MSG("(~w) Forbidden session for ~s", ?INFO_MSG("(~w) Forbidden session for ~s",
[StateData#state.socket, [StateData#state.socket,
@ -895,7 +895,8 @@ session_established({xmlstreamerror, _}, StateData) ->
session_established(closed, StateData) -> session_established(closed, StateData) ->
{stop, normal, StateData}. {stop, normal, StateData}.
%% Process packets sent by user (coming from user on c2s XMPP
%% connection)
session_established2(El, StateData) -> session_established2(El, StateData) ->
{xmlelement, Name, Attrs, _Els} = El, {xmlelement, Name, Attrs, _Els} = El,
User = StateData#state.user, User = StateData#state.user,
@ -1053,6 +1054,7 @@ handle_info(replaced, _StateName, StateData) ->
?SERRT_CONFLICT(Lang, "Replaced by new connection")) ?SERRT_CONFLICT(Lang, "Replaced by new connection"))
++ ?STREAM_TRAILER), ++ ?STREAM_TRAILER),
{stop, normal, StateData#state{authenticated = replaced}}; {stop, normal, StateData#state{authenticated = replaced}};
%% Process Packets that are to be send to the user
handle_info({route, From, To, Packet}, StateName, StateData) -> handle_info({route, From, To, Packet}, StateName, StateData) ->
{xmlelement, Name, Attrs, Els} = Packet, {xmlelement, Name, Attrs, Els} = Packet,
{Pass, NewAttrs, NewState} = {Pass, NewAttrs, NewState} =
@ -1121,9 +1123,9 @@ handle_info({route, From, To, Packet}, StateName, StateData) ->
LBFrom = jlib:jid_remove_resource(LFrom), LBFrom = jlib:jid_remove_resource(LFrom),
%% Note contact availability %% Note contact availability
case xml:get_attr_s("type", Attrs) of case xml:get_attr_s("type", Attrs) of
"unavailable" -> "unavailable" ->
mod_caps:clear_caps(From); mod_caps:clear_caps(From);
_ -> _ ->
Caps = mod_caps:read_caps(Els), Caps = mod_caps:read_caps(Els),
mod_caps:note_caps(StateData#state.server, From, Caps) mod_caps:note_caps(StateData#state.server, From, Caps)
end, end,
@ -1457,6 +1459,7 @@ process_presence_probe(From, To, StateData) ->
end end
end. end.
%% User updates his presence (non-directed presence packet)
presence_update(From, Packet, StateData) -> presence_update(From, Packet, StateData) ->
{xmlelement, _Name, Attrs, _Els} = Packet, {xmlelement, _Name, Attrs, _Els} = Packet,
case xml:get_attr_s("type", Attrs) of case xml:get_attr_s("type", Attrs) of
@ -1560,6 +1563,7 @@ presence_update(From, Packet, StateData) ->
NewState NewState
end. end.
%% User sends a directed presence packet
presence_track(From, To, Packet, StateData) -> presence_track(From, To, Packet, StateData) ->
{xmlelement, _Name, Attrs, _Els} = Packet, {xmlelement, _Name, Attrs, _Els} = Packet,
LTo = jlib:jid_tolower(To), LTo = jlib:jid_tolower(To),
@ -1978,7 +1982,7 @@ fsm_reply(Reply, StateName, StateData) ->
%% Used by c2s blacklist plugins %% Used by c2s blacklist plugins
is_ip_blacklisted({IP,_Port}) -> 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 %% Check from attributes
%% returns invalid-from|NewElement %% returns invalid-from|NewElement