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:
parent
0a88255ef6
commit
d991b92a49
@ -2442,13 +2442,20 @@ add_message_to_history(FromNick, FromJID, Packet, StateData) ->
|
||||
_ -> true
|
||||
end,
|
||||
TimeStamp = now(),
|
||||
SenderJid = case
|
||||
(StateData#state.config)#config.anonymous
|
||||
of
|
||||
true -> StateData#state.jid;
|
||||
false -> FromJID
|
||||
end,
|
||||
TSPacket = jlib:add_delay_info(Packet, SenderJid, TimeStamp),
|
||||
AddrPacket = case (StateData#state.config)#config.anonymous of
|
||||
true -> Packet;
|
||||
false ->
|
||||
Address = #xmlel{name = <<"address">>,
|
||||
attrs = [{<<"type">>, <<"ofrom">>},
|
||||
{<<"jid">>,
|
||||
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 =
|
||||
jlib:replace_from_to(jlib:jid_replace_resource(StateData#state.jid,
|
||||
FromNick),
|
||||
|
Loading…
Reference in New Issue
Block a user