Commit caa63371 authored by Philipp Hörist's avatar Philipp Hörist

Dont deepcopy stanza for smack queue

the Node Object is not deepcopy-able in all cases.
Specifically the ESession negotiation does not work.

Sending the stanza first and adding the delay tag for the
queue afterwards makes it so we dont have to copy the object
parent 23a41027
......@@ -571,21 +571,20 @@ class XMPPDispatcher(PlugIn):
if self._owner._registered_name and not stanza.getAttr('from'):
stanza.setAttr('from', self._owner._registered_name)
self._owner.Connection.send(stanza, now)
# If no ID then it is a whitespace
if self.sm and self.sm.enabled and ID:
stanza_copy = copy.deepcopy(stanza)
# add timestamp to message stanza in queue
if stanza_copy.getName() == 'message' and \
(stanza_copy.getType() == 'chat' or stanza_copy.getType() == 'groupchat'):
our_jid = stanza_copy.getAttr('from')
if stanza.getName() == 'message' and \
(stanza.getType() == 'chat' or stanza.getType() == 'groupchat'):
our_jid = stanza.getAttr('from')
timestamp = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime(None))
stanza_copy.addChild('delay', namespace=NS_DELAY2,
stanza.addChild('delay', namespace=NS_DELAY2,
attrs={'from': our_jid or "Gajim", 'stamp': timestamp})
self.sm.uqueue.append(stanza_copy)
self.sm.uqueue.append(stanza)
self.sm.out_h += 1
self._owner.Connection.send(stanza, now)
if self.sm and self.sm.enabled and ID and len(self.sm.uqueue) > self.sm.max_queue:
self.sm.request_ack()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment