mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-27 19:19:54 +00:00
unhandled iq's should only respond to errors when type=get/set
This commit is contained in:
parent
986255eefc
commit
6b130eb947
2 changed files with 10 additions and 6 deletions
|
@ -223,12 +223,15 @@ class xep_0045(base.base_plugin):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def setAffiliation(self, room, jid, affiliation='member'):
|
def setAffiliation(self, room, jid=None, nick=None, affiliation='member'):
|
||||||
""" Change room affiliation."""
|
""" Change room affiliation."""
|
||||||
if affiliation not in ('outcast', 'member', 'admin', 'owner', 'none'):
|
if affiliation not in ('outcast', 'member', 'admin', 'owner', 'none'):
|
||||||
raise TypeError
|
raise TypeError
|
||||||
query = ET.Element('{http://jabber.org/protocol/muc#admin}query')
|
query = ET.Element('{http://jabber.org/protocol/muc#admin}query')
|
||||||
item = ET.Element('item', {'affiliation':affiliation, 'jid':jid})
|
if nick is not None:
|
||||||
|
item = ET.Element('item', {'affiliation':affiliation, 'nick':nick})
|
||||||
|
else:
|
||||||
|
item = ET.Element('item', {'affiliation':affiliation, 'jid':jid})
|
||||||
query.append(item)
|
query.append(item)
|
||||||
iq = self.xmpp.makeIqSet(query)
|
iq = self.xmpp.makeIqSet(query)
|
||||||
iq['to'] = room
|
iq['to'] = room
|
||||||
|
|
|
@ -20,10 +20,11 @@ class Iq(RootStanza):
|
||||||
self['id'] = '0'
|
self['id'] = '0'
|
||||||
|
|
||||||
def unhandled(self):
|
def unhandled(self):
|
||||||
self.reply()
|
if self['type'] in ('get', 'set'):
|
||||||
self['error']['condition'] = 'feature-not-implemented'
|
self.reply()
|
||||||
self['error']['text'] = 'No handlers registered for this request.'
|
self['error']['condition'] = 'feature-not-implemented'
|
||||||
self.send()
|
self['error']['text'] = 'No handlers registered for this request.'
|
||||||
|
self.send()
|
||||||
|
|
||||||
def result(self):
|
def result(self):
|
||||||
self['type'] = 'result'
|
self['type'] = 'result'
|
||||||
|
|
Loading…
Reference in a new issue