Fix empty namespaces in XEP-0045 plugin.

This commit is contained in:
Lance Stout 2012-10-05 08:58:04 -07:00
parent 098714b3c4
commit 4ea328b9f2

View file

@ -245,11 +245,11 @@ class XEP_0045(BasePlugin):
stanza = self.xmpp.makePresence(pto="%s/%s" % (room, nick), pstatus=pstatus, pshow=pshow, pfrom=pfrom) stanza = self.xmpp.makePresence(pto="%s/%s" % (room, nick), pstatus=pstatus, pshow=pshow, pfrom=pfrom)
x = ET.Element('{http://jabber.org/protocol/muc}x') x = ET.Element('{http://jabber.org/protocol/muc}x')
if password: if password:
passelement = ET.Element('password') passelement = ET.Element('{http://jabber.org/protocol/muc}password')
passelement.text = password passelement.text = password
x.append(passelement) x.append(passelement)
if maxhistory: if maxhistory:
history = ET.Element('history') history = ET.Element('{http://jabber.org/protocol/muc}history')
if maxhistory == "0": if maxhistory == "0":
history.attrib['maxchars'] = maxhistory history.attrib['maxchars'] = maxhistory
else: else:
@ -271,10 +271,10 @@ class XEP_0045(BasePlugin):
iq['from'] = ifrom iq['from'] = ifrom
iq['to'] = room iq['to'] = room
query = ET.Element('{http://jabber.org/protocol/muc#owner}query') query = ET.Element('{http://jabber.org/protocol/muc#owner}query')
destroy = ET.Element('destroy') destroy = ET.Element('{http://jabber.org/protocol/muc#owner}destroy')
if altroom: if altroom:
destroy.attrib['jid'] = altroom destroy.attrib['jid'] = altroom
xreason = ET.Element('reason') xreason = ET.Element('{http://jabber.org/protocol/muc#owner}reason')
xreason.text = reason xreason.text = reason
destroy.append(xreason) destroy.append(xreason)
query.append(destroy) query.append(destroy)
@ -294,9 +294,9 @@ class XEP_0045(BasePlugin):
raise TypeError raise TypeError
query = ET.Element('{http://jabber.org/protocol/muc#admin}query') query = ET.Element('{http://jabber.org/protocol/muc#admin}query')
if nick is not None: if nick is not None:
item = ET.Element('item', {'affiliation':affiliation, 'nick':nick}) item = ET.Element('{http://jabber.org/protocol/muc#admin}item', {'affiliation':affiliation, 'nick':nick})
else: else:
item = ET.Element('item', {'affiliation':affiliation, 'jid':jid}) item = ET.Element('{http://jabber.org/protocol/muc#admin}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
@ -317,7 +317,7 @@ class XEP_0045(BasePlugin):
x = ET.Element('{http://jabber.org/protocol/muc#user}x') x = ET.Element('{http://jabber.org/protocol/muc#user}x')
invite = ET.Element('{http://jabber.org/protocol/muc#user}invite', {'to': jid}) invite = ET.Element('{http://jabber.org/protocol/muc#user}invite', {'to': jid})
if reason: if reason:
rxml = ET.Element('reason') rxml = ET.Element('{http://jabber.org/protocol/muc#user}reason')
rxml.text = reason rxml.text = reason
invite.append(rxml) invite.append(rxml)
x.append(invite) x.append(invite)