XEP-0045: Add some types in stanza
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
3b3eed544e
commit
9e8ac6b769
@ -27,13 +27,13 @@ class MUCPresence(ElementBase):
|
|||||||
affiliations = {'', }
|
affiliations = {'', }
|
||||||
roles = {'', }
|
roles = {'', }
|
||||||
|
|
||||||
def get_item_attr(self, attr, default):
|
def get_item_attr(self, attr, default: str):
|
||||||
item = self.xml.find('{{{NS_USER}}}item')
|
item = self.xml.find(f'{{{NS_USER}}}item')
|
||||||
if item is None:
|
if item is None:
|
||||||
return default
|
return default
|
||||||
return item.get(attr)
|
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')
|
item = self.xml.find(f'{{{NS_USER}}}item')
|
||||||
if item is None:
|
if item is None:
|
||||||
item = ET.Element(f'{{{NS_USER}}}item')
|
item = ET.Element(f'{{{NS_USER}}}item')
|
||||||
@ -42,7 +42,7 @@ class MUCPresence(ElementBase):
|
|||||||
return item
|
return item
|
||||||
|
|
||||||
def del_item_attr(self, attr):
|
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:
|
if item is not None and attr in item.attrib:
|
||||||
del item.attrib[attr]
|
del item.attrib[attr]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user