Fix the uses of stanza.reply()

This is relying on the stanzas being copied for each handler. We no
longer do that for performance reasons, so instead of editing the copy
in-place, stanza.reply() now returns a new stanza.
This commit is contained in:
mathieui
2015-02-12 12:17:01 +01:00
parent 8b36e918e8
commit f6b3a0c6cf
19 changed files with 83 additions and 84 deletions

View File

@@ -174,8 +174,9 @@ class Presence(RootStanza):
clear -- Indicates if the stanza contents should be removed
before replying. Defaults to True.
"""
new_presence = StanzaBase.reply(self, clear)
if self['type'] == 'unsubscribe':
self['type'] = 'unsubscribed'
new_presence['type'] = 'unsubscribed'
elif self['type'] == 'subscribe':
self['type'] = 'subscribed'
return StanzaBase.reply(self, clear)
new_presence['type'] = 'subscribed'
return new_presence