comparison sat/plugins/plugin_xep_0045.py @ 2815:27d9d25ec3cd

plugin XEP-0045: fixed issue with deepcopy by using new xml_tools.elementCopy method
author Goffi <goffi@goffi.org>
date Thu, 28 Feb 2019 18:57:04 +0100
parents 33fa70c102de
children 5284be4c601b
comparison
equal deleted inserted replaced
2814:777a582d9641 2815:27d9d25ec3cd
28 from sat.core import exceptions 28 from sat.core import exceptions
29 from sat.memory import memory 29 from sat.memory import memory
30 30
31 import time 31 import time
32 import uuid 32 import uuid
33 import copy
34 33
35 from wokkel import muc, disco, iwokkel 34 from wokkel import muc, disco, iwokkel
36 from sat.tools import xml_tools 35 from sat.tools import xml_tools
37 36
38 from zope.interface import implements 37 from zope.interface import implements
759 758
760 def presenceTrigger(self, presence_elt, client): 759 def presenceTrigger(self, presence_elt, client):
761 # XXX: shouldn't it be done by the server ?!! 760 # XXX: shouldn't it be done by the server ?!!
762 muc_client = client._muc_client 761 muc_client = client._muc_client
763 for room_jid, room in muc_client.joined_rooms.iteritems(): 762 for room_jid, room in muc_client.joined_rooms.iteritems():
764 elt = copy.deepcopy(presence_elt) 763 elt = xml_tools.elementCopy(presence_elt)
765 elt['to'] = room_jid.userhost() + '/' + room.nick 764 elt['to'] = room_jid.userhost() + '/' + room.nick
766 client.presence.send(elt) 765 client.presence.send(elt)
767 return True 766 return True
768 767
769 768