diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/mod_muc_log.erl | 18 | ||||
| -rw-r--r-- | src/mod_offline.erl | 18 |
2 files changed, 18 insertions, 18 deletions
diff --git a/src/mod_muc_log.erl b/src/mod_muc_log.erl index 14aef01e9..65e604ba4 100644 --- a/src/mod_muc_log.erl +++ b/src/mod_muc_log.erl @@ -241,10 +241,8 @@ code_change(_OldVsn, State, _Extra) -> {ok, State}. %%% Internal functions %%-------------------------------------------------------------------- add_to_log2(text, {Nick, Packet}, Room, Opts, State) -> - case {xml:get_subtag(Packet, <<"no-store">>), - xml:get_subtag(Packet, <<"no-permanent-store">>)} - of - {false, false} -> + case has_no_permanent_store_hint(Packet) of + false -> case {xml:get_subtag(Packet, <<"subject">>), xml:get_subtag(Packet, <<"body">>)} of @@ -256,7 +254,7 @@ add_to_log2(text, {Nick, Packet}, Room, Opts, State) -> Message = {subject, xml:get_tag_cdata(SubEl)}, add_message_to_log(Nick, Message, Room, Opts, State) end; - {_, _} -> ok + true -> ok end; add_to_log2(roomconfig_change, _Occupants, Room, Opts, State) -> @@ -1255,6 +1253,16 @@ calc_hour_offset(TimeHere) -> fjoin(FileList) -> list_to_binary(filename:join([binary_to_list(File) || File <- FileList])). +has_no_permanent_store_hint(Packet) -> + xml:get_subtag_with_xmlns(Packet, <<"no-store">>, ?NS_HINTS) + =/= false orelse + xml:get_subtag_with_xmlns(Packet, <<"no-storage">>, ?NS_HINTS) + =/= false orelse + xml:get_subtag_with_xmlns(Packet, <<"no-permanent-store">>, ?NS_HINTS) + =/= false orelse + xml:get_subtag_with_xmlns(Packet, <<"no-permanent-storage">>, ?NS_HINTS) + =/= false. + mod_opt_type(access_log) -> fun (A) when is_atom(A) -> A end; mod_opt_type(cssfile) -> fun iolist_to_binary/1; diff --git a/src/mod_offline.erl b/src/mod_offline.erl index 280f39f6c..5165c8e68 100644 --- a/src/mod_offline.erl +++ b/src/mod_offline.erl @@ -308,7 +308,7 @@ need_to_store(LServer, Packet) -> store_packet(From, To, Packet) -> case need_to_store(To#jid.lserver, Packet) of true -> - case has_no_storage_hint(Packet) of + case has_no_store_hint(Packet) of false -> case check_event(From, To, Packet) of true -> @@ -328,18 +328,10 @@ store_packet(From, To, Packet) -> false -> ok end. -has_no_storage_hint(Packet) -> - case xml:get_subtag(Packet, <<"no-store">>) of - #xmlel{attrs = Attrs} -> - case xml:get_attr_s(<<"xmlns">>, Attrs) of - ?NS_HINTS -> - true; - _ -> - false - end; - _ -> - false - end. +has_no_store_hint(Packet) -> + xml:get_subtag_with_xmlns(Packet, <<"no-store">>, ?NS_HINTS) =/= false + orelse + xml:get_subtag_with_xmlns(Packet, <<"no-storage">>, ?NS_HINTS) =/= false. %% Check if the packet has any content about XEP-0022 or XEP-0085 check_event(From, To, Packet) -> |
