Update mod_log_chat to work with ejabberd 16.02
This commit is contained in:
parent
c5daf56385
commit
512255d98b
|
@ -89,12 +89,12 @@ log_packet_receive(Packet, _C2SState, _JID, From, To) ->
|
||||||
Packet.
|
Packet.
|
||||||
|
|
||||||
log_packet(From, To, Packet = #xmlel{name = <<"message">>, attrs = Attrs}, Host) ->
|
log_packet(From, To, Packet = #xmlel{name = <<"message">>, attrs = Attrs}, Host) ->
|
||||||
case xml:get_attr_s(<<"type">>, Attrs) of
|
case fxml:get_attr_s(<<"type">>, Attrs) of
|
||||||
<<"groupchat">> -> %% mod_muc_log already does it
|
<<"groupchat">> -> %% mod_muc_log already does it
|
||||||
?DEBUG("dropping groupchat: ~s", [xml:element_to_binary(Packet)]),
|
?DEBUG("dropping groupchat: ~s", [fxml:element_to_binary(Packet)]),
|
||||||
ok;
|
ok;
|
||||||
<<"error">> -> %% we don't log errors
|
<<"error">> -> %% we don't log errors
|
||||||
?DEBUG("dropping error: ~s", [xml:element_to_binary(Packet)]),
|
?DEBUG("dropping error: ~s", [fxml:element_to_binary(Packet)]),
|
||||||
ok;
|
ok;
|
||||||
_ ->
|
_ ->
|
||||||
write_packet(From, To, Packet, Host)
|
write_packet(From, To, Packet, Host)
|
||||||
|
@ -109,13 +109,13 @@ write_packet(From, To, Packet, Host) ->
|
||||||
Result
|
Result
|
||||||
end,
|
end,
|
||||||
Format = Config#config.format,
|
Format = Config#config.format,
|
||||||
{Subject, Body} = {case xml:get_subtag(Packet, <<"subject">>) of
|
{Subject, Body} = {case fxml:get_subtag(Packet, <<"subject">>) of
|
||||||
false ->
|
false ->
|
||||||
"";
|
"";
|
||||||
SubjEl ->
|
SubjEl ->
|
||||||
escape(Format, xml:get_tag_cdata(SubjEl))
|
escape(Format, fxml:get_tag_cdata(SubjEl))
|
||||||
end,
|
end,
|
||||||
escape(Format, xml:get_path_s(Packet, [{elem, <<"body">>}, cdata]))},
|
escape(Format, fxml:get_path_s(Packet, [{elem, <<"body">>}, cdata]))},
|
||||||
case Subject == [] andalso Body == [] of
|
case Subject == [] andalso Body == [] of
|
||||||
true -> %% don't log empty messages
|
true -> %% don't log empty messages
|
||||||
?DEBUG("not logging empty message from ~s",[jlib:jid_to_string(From)]),
|
?DEBUG("not logging empty message from ~s",[jlib:jid_to_string(From)]),
|
||||||
|
|
Loading…
Reference in New Issue