summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slixmpp/plugins/xep_0045/stanza.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/slixmpp/plugins/xep_0045/stanza.py b/slixmpp/plugins/xep_0045/stanza.py
index 265be83a..7d52f53a 100644
--- a/slixmpp/plugins/xep_0045/stanza.py
+++ b/slixmpp/plugins/xep_0045/stanza.py
@@ -13,31 +13,36 @@ from slixmpp.xmlstream import ElementBase, ET, JID
log = logging.getLogger(__name__)
+NS = 'http://jabber.org/protocol/muc'
+NS_USER = 'http://jabber.org/protocol/muc#user'
+NS_ADMIN = 'http://jabber.org/protocol/muc#admin'
+NS_OWNER = 'http://jabber.org/protocol/muc#owner'
+
class MUCPresence(ElementBase):
name = 'x'
- namespace = 'http://jabber.org/protocol/muc#user'
+ namespace = NS_USER
plugin_attrib = 'muc'
interfaces = {'affiliation', 'role', 'jid', 'nick', 'room'}
affiliations = {'', }
roles = {'', }
def get_item_attr(self, attr, default):
- item = self.xml.find('{http://jabber.org/protocol/muc#user}item')
+ item = self.xml.find('{{{NS_USER}}}item')
if item is None:
return default
return item.get(attr)
def set_item_attr(self, attr, value):
- item = self.xml.find('{http://jabber.org/protocol/muc#user}item')
+ item = self.xml.find(f'{{{NS_USER}}}item')
if item is None:
- item = ET.Element('{http://jabber.org/protocol/muc#user}item')
+ item = ET.Element(f'{{{NS_USER}}}item')
self.xml.append(item)
item.attrib[attr] = value
return item
def del_item_attr(self, attr):
- item = self.xml.find('{http://jabber.org/protocol/muc#user}item')
+ item = self.xml.find('{{{NS_USER}}}item')
if item is not None and attr in item.attrib:
del item.attrib[attr]