]> granicus.if.org Git - ejabberd/commitdiff
Don't log MUC messages with <no-store/> hint
authorHolger Weiss <holger@zedat.fu-berlin.de>
Sun, 11 May 2014 22:27:20 +0000 (00:27 +0200)
committerHolger Weiss <holger@zedat.fu-berlin.de>
Sun, 11 May 2014 22:27:20 +0000 (00:27 +0200)
Honor the <no-store/> and <no-permanent-store/> hints defined in
XEP-0334.

src/mod_muc_log.erl

index e8724483ea1584884ec36f3f0dc0a7e7a2d0571d..fbb08f3aec30d967fe3eba7daf6b8625bbf73fe1 100644 (file)
@@ -233,16 +233,22 @@ code_change(_OldVsn, State, _Extra) -> {ok, State}.
 %%% Internal functions
 %%--------------------------------------------------------------------
 add_to_log2(text, {Nick, Packet}, Room, Opts, State) ->
-    case {xml:get_subtag(Packet, <<"subject">>),
-         xml:get_subtag(Packet, <<"body">>)}
+    case {xml:get_subtag(Packet, <<"no-store">>),
+         xml:get_subtag(Packet, <<"no-permanent-store">>)}
        of
-      {false, false} -> ok;
-      {false, SubEl} ->
-         Message = {body, xml:get_tag_cdata(SubEl)},
-         add_message_to_log(Nick, Message, Room, Opts, State);
-      {SubEl, _} ->
-         Message = {subject, xml:get_tag_cdata(SubEl)},
-         add_message_to_log(Nick, Message, Room, Opts, State)
+      {false, false} ->
+         case {xml:get_subtag(Packet, <<"subject">>),
+               xml:get_subtag(Packet, <<"body">>)}
+             of
+           {false, false} -> ok;
+           {false, SubEl} ->
+               Message = {body, xml:get_tag_cdata(SubEl)},
+               add_message_to_log(Nick, Message, Room, Opts, State);
+           {SubEl, _} ->
+               Message = {subject, xml:get_tag_cdata(SubEl)},
+               add_message_to_log(Nick, Message, Room, Opts, State)
+         end;
+      {_, _} -> ok
     end;
 add_to_log2(roomconfig_change, _Occupants, Room, Opts,
            State) ->