send xml:lang in groupchat presences and configuration request. fixes #3743
This commit is contained in:
parent
cdb31a2b55
commit
95bf9c4f74
|
@ -29,6 +29,7 @@ import random
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
import locale
|
||||||
|
|
||||||
try:
|
try:
|
||||||
randomsource = random.SystemRandom()
|
randomsource = random.SystemRandom()
|
||||||
|
@ -102,6 +103,9 @@ class Connection(ConnectionHandlers):
|
||||||
self.connection = None # xmpppy ClientCommon instance
|
self.connection = None # xmpppy ClientCommon instance
|
||||||
# this property is used to prevent double connections
|
# this property is used to prevent double connections
|
||||||
self.last_connection = None # last ClientCommon instance
|
self.last_connection = None # last ClientCommon instance
|
||||||
|
self.lang = None
|
||||||
|
if locale.getdefaultlocale()[0]:
|
||||||
|
self.lang = locale.getdefaultlocale()[0].split('_')[0]
|
||||||
self.is_zeroconf = False
|
self.is_zeroconf = False
|
||||||
self.gpg = None
|
self.gpg = None
|
||||||
self.USE_GPG = False
|
self.USE_GPG = False
|
||||||
|
@ -701,6 +705,10 @@ class Connection(ConnectionHandlers):
|
||||||
if kill_core and gajim.account_is_connected(self.name):
|
if kill_core and gajim.account_is_connected(self.name):
|
||||||
self.disconnect(on_purpose=True)
|
self.disconnect(on_purpose=True)
|
||||||
|
|
||||||
|
def add_lang(self, stanza):
|
||||||
|
if self.lang:
|
||||||
|
stanza.setAttr('xml:lang', self.lang)
|
||||||
|
|
||||||
def get_privacy_lists(self):
|
def get_privacy_lists(self):
|
||||||
if not self.connection:
|
if not self.connection:
|
||||||
return
|
return
|
||||||
|
@ -1426,6 +1434,7 @@ class Connection(ConnectionHandlers):
|
||||||
show = show, status = self.status)
|
show = show, status = self.status)
|
||||||
if gajim.config.get('send_sha_in_gc_presence'):
|
if gajim.config.get('send_sha_in_gc_presence'):
|
||||||
p = self.add_sha(p)
|
p = self.add_sha(p)
|
||||||
|
self.add_lang(p)
|
||||||
t = p.setTag(common.xmpp.NS_MUC + ' x')
|
t = p.setTag(common.xmpp.NS_MUC + ' x')
|
||||||
if password:
|
if password:
|
||||||
t.setTagData('password', password)
|
t.setTagData('password', password)
|
||||||
|
@ -1465,6 +1474,7 @@ class Connection(ConnectionHandlers):
|
||||||
return
|
return
|
||||||
iq = common.xmpp.Iq(typ = 'get', queryNS = common.xmpp.NS_MUC_OWNER,
|
iq = common.xmpp.Iq(typ = 'get', queryNS = common.xmpp.NS_MUC_OWNER,
|
||||||
to = room_jid)
|
to = room_jid)
|
||||||
|
self.add_lang(iq)
|
||||||
self.connection.send(iq)
|
self.connection.send(iq)
|
||||||
|
|
||||||
def destroy_gc_room(self, room_jid, reason = '', jid = ''):
|
def destroy_gc_room(self, room_jid, reason = '', jid = ''):
|
||||||
|
@ -1492,6 +1502,7 @@ class Connection(ConnectionHandlers):
|
||||||
show = xmpp_show, status = status)
|
show = xmpp_show, status = status)
|
||||||
if gajim.config.get('send_sha_in_gc_presence') and show != 'offline':
|
if gajim.config.get('send_sha_in_gc_presence') and show != 'offline':
|
||||||
p = self.add_sha(p, ptype != 'unavailable')
|
p = self.add_sha(p, ptype != 'unavailable')
|
||||||
|
self.add_lang(p)
|
||||||
# send instantly so when we go offline, status is sent to gc before we
|
# send instantly so when we go offline, status is sent to gc before we
|
||||||
# disconnect from jabber server
|
# disconnect from jabber server
|
||||||
self.connection.send(p)
|
self.connection.send(p)
|
||||||
|
|
Loading…
Reference in New Issue