XEP-0004: Remove deprecated getXML() and fromXML() methods.

This commit is contained in:
Emmanuel Gil Peyrot 2016-09-20 16:34:48 +09:00
parent 0edeefd977
commit b8e091233e
3 changed files with 5 additions and 17 deletions

View File

@ -81,18 +81,6 @@ class Form(ElementBase):
self.append(field) self.append(field)
return field return field
def getXML(self, type='submit'):
self['type'] = type
log.warning("Form.getXML() is deprecated API compatibility " + \
"with plugins/old_0004.py")
return self.xml
def fromXML(self, xml):
log.warning("Form.fromXML() is deprecated API compatibility " + \
"with plugins/old_0004.py")
n = Form(xml=xml)
return n
def add_item(self, values): def add_item(self, values):
itemXML = ET.Element('{%s}item' % self.namespace) itemXML = ET.Element('{%s}item' % self.namespace)
self.xml.append(itemXML) self.xml.append(itemXML)

View File

@ -222,7 +222,7 @@ class XEP_0045(BasePlugin):
if ifrom is not None: if ifrom is not None:
iq['from'] = ifrom iq['from'] = ifrom
query = ET.Element('{http://jabber.org/protocol/muc#owner}query') query = ET.Element('{http://jabber.org/protocol/muc#owner}query')
form = form.getXML('submit') form['type'] = 'submit'
query.append(form) query.append(form)
iq.append(query) iq.append(query)
# For now, swallow errors to preserve existing API # For now, swallow errors to preserve existing API
@ -373,8 +373,8 @@ class XEP_0045(BasePlugin):
def setRoomConfig(self, room, config, ifrom=''): def setRoomConfig(self, room, config, ifrom=''):
query = ET.Element('{http://jabber.org/protocol/muc#owner}query') query = ET.Element('{http://jabber.org/protocol/muc#owner}query')
x = config.getXML('submit') config['type'] = 'submit'
query.append(x) query.append(config)
iq = self.xmpp.make_iq_set(query) iq = self.xmpp.make_iq_set(query)
iq['to'] = room iq['to'] = room
iq['from'] = ifrom iq['from'] = ifrom

View File

@ -206,7 +206,7 @@ class Options(ElementBase):
return form return form
def set_options(self, value): def set_options(self, value):
self.xml.append(value.getXML()) self.xml.append(value)
return self return self
def del_options(self): def del_options(self):
@ -238,7 +238,7 @@ class PublishOptions(ElementBase):
if value is None: if value is None:
self.del_publish_options() self.del_publish_options()
else: else:
self.xml.append(value.getXML()) self.xml.append(value)
return self return self
def del_publish_options(self): def del_publish_options(self):