* src/ejabberd_c2s.erl: Support for filtering of incoming messages

and IQs, presence filtering will be after some xmpp-im
clarifications

SVN Revision: 132
This commit is contained in:
Alexey Shchepin 2003-08-18 19:17:28 +00:00
parent 05183f5628
commit 141e99aaa9
4 changed files with 42 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2003-08-18 Alexey Shchepin <alexey@sevcom.net>
* src/ejabberd_c2s.erl: Support for filtering of incoming messages
and IQs, presence filtering will be after some xmpp-im
clarifications
2003-08-15 Alexey Shchepin <alexey@sevcom.net>
* src/mod_muc/mod_muc.erl: Fixed handling of room names with

View File

@ -36,3 +36,6 @@
-define(CONFIG_PATH, "ejabberd.cfg").
-define(LOG_PATH, "ejabberd.log").
-define(PRIVACY_SUPPORT, true).

View File

@ -624,12 +624,42 @@ handle_info({route, From, To, Packet}, StateName, StateData) ->
From,
jlib:iq_to_xml(ResIQ)),
{false, Attrs, StateData};
%{iq, ID, Type, ?NS_VCARD, SubEl} ->
% TODO: don't pass packets until roster loaded
%{true, Attrs, StateData};
%-ifdef(PRIVACY_SUPPORT).
{iq, _ID, Type, _XMLNS, _SubEl} ->
case catch mod_privacy:check_packet(
StateData#state.user,
StateData#state.privacy_list,
{From, To, Packet},
in) of
{'EXIT', _Reason} ->
{true, Attrs, StateData};
allow ->
{true, Attrs, StateData};
deny ->
Err = jlib:make_error_reply(
Packet, ?ERR_FEATURE_NOT_IMPLEMENTED),
ejabberd_router:route(To, From, Err),
{false, Attrs, StateData}
end;
%-endif.
_ ->
{true, Attrs, StateData}
end;
%-ifdef(PRIVACY_SUPPORT).
"message" ->
case catch mod_privacy:check_packet(
StateData#state.user,
StateData#state.privacy_list,
{From, To, Packet},
in) of
{'EXIT', _Reason} ->
{true, Attrs, StateData};
allow ->
{true, Attrs, StateData};
deny ->
{false, Attrs, StateData}
end;
%-endif.
_ ->
{true, Attrs, StateData}
end,

View File

@ -192,7 +192,6 @@ do_route(From, To, Packet) ->
{xmlelement, Name, Attrs, Els} = Packet,
case Resource of
"" ->
% TODO
case Name of
"presence" ->
{FU, FS, FR} = From,