25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01: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 = [#xmlel{name = <<"delay">>, children = [xml:replace_tag_attr(
attrs = [{<<"xmlns">>, ?NS_DELAY}, <<"xmlns">>, <<"jabber:client">>, Pkt2)]},
{<<"stamp">>, Delay}]}, jlib:add_delay_info(Pkt3, LServer, TS).
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