XEP-0045: Add some types in stanza

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2020-05-29 17:33:44 +02:00
parent 3b3eed544e
commit 9e8ac6b769

View file

@ -27,13 +27,13 @@ class MUCPresence(ElementBase):
affiliations = {'', }
roles = {'', }
def get_item_attr(self, attr, default):
item = self.xml.find('{{{NS_USER}}}item')
def get_item_attr(self, attr, default: str):
item = self.xml.find(f'{{{NS_USER}}}item')
if item is None:
return default
return item.get(attr)
def set_item_attr(self, attr, value):
def set_item_attr(self, attr, value: str):
item = self.xml.find(f'{{{NS_USER}}}item')
if item is None:
item = ET.Element(f'{{{NS_USER}}}item')
@ -42,7 +42,7 @@ class MUCPresence(ElementBase):
return item
def del_item_attr(self, attr):
item = self.xml.find('{{{NS_USER}}}item')
item = self.xml.find(f'{{{NS_USER}}}item')
if item is not None and attr in item.attrib:
del item.attrib[attr]