unhandled iq's should only respond to errors when type=get/set

This commit is contained in:
Nathan Fritz 2010-01-20 01:42:53 -08:00
parent 986255eefc
commit 6b130eb947
2 changed files with 10 additions and 6 deletions

View file

@ -223,11 +223,14 @@ class xep_0045(base.base_plugin):
return False
return True
def setAffiliation(self, room, jid, affiliation='member'):
def setAffiliation(self, room, jid=None, nick=None, affiliation='member'):
""" Change room affiliation."""
if affiliation not in ('outcast', 'member', 'admin', 'owner', 'none'):
raise TypeError
query = ET.Element('{http://jabber.org/protocol/muc#admin}query')
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)
iq = self.xmpp.makeIqSet(query)

View file

@ -20,6 +20,7 @@ class Iq(RootStanza):
self['id'] = '0'
def unhandled(self):
if self['type'] in ('get', 'set'):
self.reply()
self['error']['condition'] = 'feature-not-implemented'
self['error']['text'] = 'No handlers registered for this request.'