Use xml:lang from stanza when it's missing in <command/> element

Thanks to Philipp Hörist for spotting this
This commit is contained in:
Evgeny Khramtsov 2019-04-06 18:27:28 +03:00
parent 9f3ccd604e
commit 2e007f1607
1 changed files with 7 additions and 2 deletions

View File

@ -215,10 +215,10 @@ process_adhoc_request(#iq{from = From, to = To,
Res = case Type of
local ->
ejabberd_hooks:run_fold(adhoc_local_commands, Host, empty,
[From, To, SubEl]);
[From, To, fix_lang(Lang, SubEl)]);
sm ->
ejabberd_hooks:run_fold(adhoc_sm_commands, Host, empty,
[From, To, SubEl])
[From, To, fix_lang(Lang, SubEl)])
end,
case Res of
ignore ->
@ -266,6 +266,11 @@ ping_command(_Acc, _From, _To,
end;
ping_command(Acc, _From, _To, _Request) -> Acc.
fix_lang(Lang, #adhoc_command{lang = <<>>} = Cmd) ->
Cmd#adhoc_command{lang = Lang};
fix_lang(_, Cmd) ->
Cmd.
depends(_Host, _Opts) ->
[].