From 2e007f160750f7a22a89f28e3174363618fcfca9 Mon Sep 17 00:00:00 2001 From: Evgeny Khramtsov Date: Sat, 6 Apr 2019 18:27:28 +0300 Subject: [PATCH] Use xml:lang from stanza when it's missing in element MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Thanks to Philipp Hörist for spotting this --- src/mod_adhoc.erl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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) -> []. -- 2.40.0