Merge pull request #53 from weiss/ignore-empty-carbons

mod_message_log: Ignore "empty" carbon copies
This commit is contained in:
badlop 2014-11-10 16:02:37 +01:00
commit 9eca3305ba
1 changed files with 11 additions and 10 deletions

View File

@ -110,21 +110,22 @@ is_carbon(Packet) ->
{Direction, SubTag} = case {xml:get_subtag(Packet, <<"sent">>), {Direction, SubTag} = case {xml:get_subtag(Packet, <<"sent">>),
xml:get_subtag(Packet, <<"received">>)} of xml:get_subtag(Packet, <<"received">>)} of
{false, false} -> {false, false} ->
{none, none}; {false, false};
{false, Tag} -> {false, Tag} ->
{incoming, Tag}; {incoming, Tag};
{Tag, _} -> {Tag, _} ->
{outgoing, Tag} {outgoing, Tag}
end, end,
if SubTag =:= none -> F = fun(_, false) ->
false; false;
true -> (Name, Tag) ->
case xml:get_subtag(SubTag, <<"forwarded">>) of xml:get_subtag(Tag, Name)
false -> end,
false; case lists:foldl(F, SubTag, [<<"forwarded">>, <<"message">>, <<"body">>]) of
_ -> #xmlel{children = Body} when length(Body) > 0 ->
{true, Direction} {true, Direction};
end _ ->
false
end. end.
loop(Config) -> loop(Config) ->