From: Evgeny Khramtsov Date: Sat, 6 Apr 2019 15:27:28 +0000 (+0300) Subject: Use xml:lang from stanza when it's missing in element X-Git-Tag: 19.05~95 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2e007f160750f7a22a89f28e3174363618fcfca9;p=ejabberd Use xml:lang from stanza when it's missing in element Thanks to Philipp Hörist for spotting this --- diff --git a/src/mod_adhoc.erl b/src/mod_adhoc.erl index c77d6a047..f6a61fe03 100644 --- a/src/mod_adhoc.erl +++ b/src/mod_adhoc.erl @@ -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) -> [].