Chatstates: add <x/> in MUC-PMs

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2020-05-08 15:10:25 +02:00
parent 4edf690e26
commit e2dc69f9e1
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -48,6 +48,8 @@ if TYPE_CHECKING:
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
NS_MUC_USER = 'http://jabber.org/protocol/muc#user'
# getters for tab colors (lambdas, so that they are dynamic) # getters for tab colors (lambdas, so that they are dynamic)
STATE_COLORS = { STATE_COLORS = {
'disconnected': lambda: get_theme().COLOR_TAB_DISCONNECTED, 'disconnected': lambda: get_theme().COLOR_TAB_DISCONNECTED,
@ -688,6 +690,8 @@ class ChatTab(Tab):
""" """
Send an empty chatstate message Send an empty chatstate message
""" """
from poezio.tabs import PrivateTab
if self.check_send_chat_state(): if self.check_send_chat_state():
if state in ('active', 'inactive', if state in ('active', 'inactive',
'gone') and self.inactive and not always_send: 'gone') and self.inactive and not always_send:
@ -698,6 +702,9 @@ class ChatTab(Tab):
msg['chat_state'] = state msg['chat_state'] = state
self.chat_state = state self.chat_state = state
msg['no-store'] = True msg['no-store'] = True
if isinstance(self, PrivateTab):
x = ET.Element('{%s}x' % NS_MUC_USER)
msg.append(x)
msg.send() msg.send()
return True return True