aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2013-06-27 11:50:54 +0200
committerBadlop <badlop@process-one.net>2013-06-27 11:58:31 +0200
commit91744733c10d02e8f7ef9e2fc415466345263795 (patch)
tree0ee80ba45179d3c514a88dcbed0ee3470dd22647 /src
parentRe-create the configure script (diff)
Store only messages with body or subject (EJABS-2034)
Diffstat (limited to 'src')
-rw-r--r--src/mod_muc_room.erl19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/mod_muc_room.erl b/src/mod_muc_room.erl
index ef1931780..152737359 100644
--- a/src/mod_muc_room.erl
+++ b/src/mod_muc_room.erl
@@ -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).