# HG changeset patch # User Kim Alvefur # Date 1564269464 -7200 # Node ID 1266a63ba5673be874678ce40702fa7370fdc8c8 # Parent bd547587f48c7c884d27197bdd9dda698b0a54eb util.xmppstream: Inherit xml:lang from stream to stanzas (fixes #1401) diff -r bd547587f48c -r 1266a63ba567 util/xmppstream.lua --- a/util/xmppstream.lua Fri Jul 26 21:23:53 2019 +0200 +++ b/util/xmppstream.lua Sun Jul 28 01:17:44 2019 +0200 @@ -64,6 +64,8 @@ local stream_default_ns = stream_callbacks.default_ns; + local stream_lang = "en"; + local stack = {}; local chardata, stanza = {}; local stanza_size = 0; @@ -101,6 +103,7 @@ if session.notopen then if tagname == stream_tag then non_streamns_depth = 0; + stream_lang = attr["xml:lang"] or stream_lang; if cb_streamopened then if lxp_supports_bytecount then cb_handleprogress(stanza_size); @@ -178,6 +181,9 @@ cb_handleprogress(stanza_size); end stanza_size = 0; + if stanza.attr["xml:lang"] == nil then + stanza.attr["xml:lang"] = stream_lang; + end if tagname ~= stream_error_tag then cb_handlestanza(session, stanza); else