25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

Always use occupant JID as 'from' for room subject

When sending the room subject to a new participant, always use the
occupant JID that corresponds to the subject author as the 'from'
address.  It was already done this way when the subject was sent as part
of the room history.
This commit is contained in:
Holger Weiss 2015-11-25 00:05:24 +01:00
parent 87fb5132be
commit fee2530b1c

View File

@ -2475,14 +2475,15 @@ send_history(JID, Shift, StateData) ->
lqueue_to_list(StateData#state.history))).
send_subject(_JID, #state{subject_author = <<"">>}) -> ok;
send_subject(JID, StateData) ->
send_subject(JID, #state{subject_author = Nick} = StateData) ->
Subject = StateData#state.subject,
Packet = #xmlel{name = <<"message">>,
attrs = [{<<"type">>, <<"groupchat">>}],
children =
[#xmlel{name = <<"subject">>, attrs = [],
children = [{xmlcdata, Subject}]}]},
ejabberd_router:route(StateData#state.jid, JID, Packet).
ejabberd_router:route(jid:replace_resource(StateData#state.jid, Nick), JID,
Packet).
check_subject(Packet) ->
case xml:get_subtag(Packet, <<"subject">>) of