Commit 279ec6b8 authored by Thilo Molitor's avatar Thilo Molitor

Fix smacks delayed tag addition.

Only add delayed tag to stanzas saved into smacks queue, not to the ones
send out directly.
parent 8f1c3b11
......@@ -27,6 +27,7 @@ import time
import locale
import re
import uuid
import copy
from xml.parsers.expat import ExpatError
from .plugin import PlugIn
from .protocol import (NS_DELAY2, NS_STREAMS, NS_XMPP_STREAMS, NS_HTTP_BIND, Iq, Presence,
......@@ -572,14 +573,15 @@ class XMPPDispatcher(PlugIn):
# If no ID then it is a whitespace
if and and ID:
stanza_copy = copy.deepcopy(stanza)
# add timestamp to message stanza in queue
if stanza.getName() == 'message' and \
(stanza.getType() == 'chat' or stanza.getType() == 'groupchat'):
our_jid = stanza.getAttr('from')
if stanza_copy.getName() == 'message' and \
(stanza_copy.getType() == 'chat' or stanza_copy.getType() == 'groupchat'):
our_jid = stanza_copy.getAttr('from')
timestamp = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime(None))
stanza.addChild('delay', namespace=NS_DELAY2,
attrs={'from': our_jid, 'stamp': timestamp})
stanza_copy.addChild('delay', namespace=NS_DELAY2,
attrs={'from': our_jid or "Gajim", 'stamp': timestamp}) += 1
self._owner.Connection.send(stanza, now)
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