From cffe224d4a0a5c95a235efa30264e19f070ae177 Mon Sep 17 00:00:00 2001 From: Christophe Romain Date: Mon, 3 Jan 2011 15:26:44 +0100 Subject: [PATCH] log and drop messages only from autofilter --- src/ejabberd_router.erl | 1 + src/mod_autofilter.erl | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/ejabberd_router.erl b/src/ejabberd_router.erl index ba4072cfa..e6aa7ea51 100644 --- a/src/ejabberd_router.erl +++ b/src/ejabberd_router.erl @@ -415,6 +415,7 @@ do_route(OrigFrom, OrigTo, OrigPacket) -> end end; drop -> + ?DEBUG("packet dropped~n", []), ok end. diff --git a/src/mod_autofilter.erl b/src/mod_autofilter.erl index 97b374b6b..ef18d5bc7 100644 --- a/src/mod_autofilter.erl +++ b/src/mod_autofilter.erl @@ -110,12 +110,14 @@ offline_message(From, To, Packet) -> mnesia:dirty_write(Record), ok. -filter_packet({From, To, Packet}) -> +filter_packet({From, To, {xmlelement, "message", _, _}}) -> {User, Server, _} = jlib:jid_tolower(From), case mnesia:dirty_read({autofilter, {User, Server}}) of - [#autofilter{drop=true}] -> drop; + [#autofilter{drop=true}] -> drop _ -> {From, To, Packet} - end. + end; +filter_packet(OK) -> + OK. close_session(SID, JID) -> close_session(SID, JID, []).