24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-02 21:17:12 +02:00

mod_mam: Add 'from' attribute to <delay/> tag

This commit is contained in:
Holger Weiss 2016-01-13 23:17:23 +01:00
parent 9cd048c442
commit 89b1700279

View File

@ -884,16 +884,13 @@ select(LServer, #jid{luser = LUser} = JidRequestor,
end. end.
msg_to_el(#archive_msg{timestamp = TS, packet = Pkt1, nick = Nick, peer = Peer}, msg_to_el(#archive_msg{timestamp = TS, packet = Pkt1, nick = Nick, peer = Peer},
MsgType, JidRequestor) -> MsgType, #jid{lserver = LServer} = JidRequestor) ->
Delay = jlib:now_to_utc_string(TS), Pkt2 = maybe_update_from_to(Pkt1, JidRequestor, Peer, MsgType, Nick),
Pkt = maybe_update_from_to(Pkt1, JidRequestor, Peer, MsgType, Nick), Pkt3 = #xmlel{name = <<"forwarded">>,
#xmlel{name = <<"forwarded">>, attrs = [{<<"xmlns">>, ?NS_FORWARD}],
attrs = [{<<"xmlns">>, ?NS_FORWARD}], children = [xml:replace_tag_attr(
children = [#xmlel{name = <<"delay">>, <<"xmlns">>, <<"jabber:client">>, Pkt2)]},
attrs = [{<<"xmlns">>, ?NS_DELAY}, jlib:add_delay_info(Pkt3, LServer, TS).
{<<"stamp">>, Delay}]},
xml:replace_tag_attr(
<<"xmlns">>, <<"jabber:client">>, Pkt)]}.
maybe_update_from_to(Pkt, JidRequestor, Peer, chat, _Nick) -> maybe_update_from_to(Pkt, JidRequestor, Peer, chat, _Nick) ->
case xml:get_attr_s(<<"type">>, Pkt#xmlel.attrs) of case xml:get_attr_s(<<"type">>, Pkt#xmlel.attrs) of