25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-20 17:27:00 +01:00

Store only messages with body or subject (EJABS-2034)

This commit is contained in:
Badlop 2013-06-27 11:50:54 +02:00
parent 295ea0633e
commit 91744733c1

View File

@ -943,9 +943,14 @@ process_groupchat_message(From,
Packet)
end,
?DICT:to_list(StateData#state.users)),
NewStateData2 = add_message_to_history(FromNick, From,
NewStateData2 = case has_body_or_subject(Packet) of
true ->
add_message_to_history(FromNick, From,
Packet,
NewStateData1),
NewStateData1);
false ->
NewStateData1
end,
{next_state, normal_state, NewStateData2};
_ ->
Err = case
@ -4462,3 +4467,13 @@ tab_count_user(JID) ->
element_size(El) ->
byte_size(xml:element_to_binary(El)).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Detect messange stanzas that don't have meaninful content
has_body_or_subject(Packet) ->
[] /= lists:dropwhile(fun
(#xmlel{name = <<"body">>}) -> false;
(#xmlel{name = <<"subject">>}) -> false;
(_) -> true
end, Packet#xmlel.children).