summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Buquet <pep@bouah.net>2020-05-08 15:12:35 +0200
committerMaxime Buquet <pep@bouah.net>2020-05-08 15:12:35 +0200
commitf1473f6d1f1f6d16f31927ddf09b8fdba489d996 (patch)
tree900812327cb6c648bea2b7f0d9a3edc6baf6b83b
parent4fe83c7451a9c18397fa1de790de7e9410f7a124 (diff)
parent773880c79911ab3aafdb11ee8d896e958a2281b0 (diff)
downloadpoezio-f1473f6d1f1f6d16f31927ddf09b8fdba489d996.tar.gz
poezio-f1473f6d1f1f6d16f31927ddf09b8fdba489d996.tar.bz2
poezio-f1473f6d1f1f6d16f31927ddf09b8fdba489d996.tar.xz
poezio-f1473f6d1f1f6d16f31927ddf09b8fdba489d996.zip
Merge branch 'muc-pms-x' into 'master'
Add <x/> to MUC-PM CSNs Closes #3491 See merge request poezio/poezio!90
-rw-r--r--poezio/tabs/basetabs.py7
-rw-r--r--poezio/tabs/privatetab.py5
2 files changed, 12 insertions, 0 deletions
diff --git a/poezio/tabs/basetabs.py b/poezio/tabs/basetabs.py
index 9026e8be..fca54860 100644
--- a/poezio/tabs/basetabs.py
+++ b/poezio/tabs/basetabs.py
@@ -48,6 +48,8 @@ if TYPE_CHECKING:
log = logging.getLogger(__name__)
+NS_MUC_USER = 'http://jabber.org/protocol/muc#user'
+
# getters for tab colors (lambdas, so that they are dynamic)
STATE_COLORS = {
'disconnected': lambda: get_theme().COLOR_TAB_DISCONNECTED,
@@ -688,6 +690,8 @@ class ChatTab(Tab):
"""
Send an empty chatstate message
"""
+ from poezio.tabs import PrivateTab
+
if self.check_send_chat_state():
if state in ('active', 'inactive',
'gone') and self.inactive and not always_send:
@@ -698,6 +702,9 @@ class ChatTab(Tab):
msg['chat_state'] = state
self.chat_state = state
msg['no-store'] = True
+ if isinstance(self, PrivateTab):
+ x = ET.Element('{%s}x' % NS_MUC_USER)
+ msg.append(x)
msg.send()
return True
diff --git a/poezio/tabs/privatetab.py b/poezio/tabs/privatetab.py
index ee4cd84c..7206240f 100644
--- a/poezio/tabs/privatetab.py
+++ b/poezio/tabs/privatetab.py
@@ -13,6 +13,7 @@ the ConversationTab (such as tab-completion on nicks from the room).
import curses
import logging
from typing import Dict, Callable
+from xml.etree import cElementTree as ET
from slixmpp import JID
@@ -29,6 +30,8 @@ from poezio.decorators import command_args_parser
log = logging.getLogger(__name__)
+NS_MUC_USER = 'http://jabber.org/protocol/muc#user'
+
class PrivateTab(OneToOneTab):
"""
@@ -152,6 +155,8 @@ class PrivateTab(OneToOneTab):
)
msg['type'] = 'chat'
msg['body'] = line
+ x = ET.Element('{%s}x' % NS_MUC_USER)
+ msg.append(x)
# trigger the event BEFORE looking for colors.
# This lets a plugin insert \x19xxx} colors, that will
# be converted in xhtml.