25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Always specify room JID for MUC <delay/> elements

As per version 1.25 of XEP-0045, use the room JID as the 'from' address
for <delay/> elements also when the room is non-anonymous, and specify
the original JID of the sender as an XEP-0033-style tag instead.

Closes #465.
This commit is contained in:
Holger Weiss 2015-03-10 00:02:32 +01:00
parent 0a88255ef6
commit d991b92a49

View File

@ -2442,13 +2442,20 @@ add_message_to_history(FromNick, FromJID, Packet, StateData) ->
_ -> true _ -> true
end, end,
TimeStamp = now(), TimeStamp = now(),
SenderJid = case AddrPacket = case (StateData#state.config)#config.anonymous of
(StateData#state.config)#config.anonymous true -> Packet;
of false ->
true -> StateData#state.jid; Address = #xmlel{name = <<"address">>,
false -> FromJID attrs = [{<<"type">>, <<"ofrom">>},
end, {<<"jid">>,
TSPacket = jlib:add_delay_info(Packet, SenderJid, TimeStamp), jlib:jid_to_string(FromJID)}],
children = []},
Addresses = #xmlel{name = <<"addresses">>,
attrs = [{<<"xmlns">>, ?NS_ADDRESS}],
children = [Address]},
xml:append_subtags(Packet, [Addresses])
end,
TSPacket = jlib:add_delay_info(AddrPacket, StateData#state.jid, TimeStamp),
SPacket = SPacket =
jlib:replace_from_to(jlib:jid_replace_resource(StateData#state.jid, jlib:replace_from_to(jlib:jid_replace_resource(StateData#state.jid,
FromNick), FromNick),