fix zeroconf to handle parameters of send_message (xhtml, forward_from, delayed). Fixes #4514
This commit is contained in:
parent
3b13665574
commit
d155b90c3c
|
@ -362,9 +362,14 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf):
|
|||
|
||||
def send_message(self, jid, msg, keyID, type_='chat', subject='',
|
||||
chatstate=None, msg_id=None, composing_xep=None, resource=None,
|
||||
user_nick = None, session=None, forward_from=None, form_node=None, original_message=None):
|
||||
user_nick=None, xhtml=None, session=None, forward_from=None, form_node=None,
|
||||
original_message=None, delayed=None):
|
||||
fjid = jid
|
||||
|
||||
if msg and not xhtml and gajim.config.get(
|
||||
'rst_formatting_outgoing_messages'):
|
||||
from common.rst_xhtml_generator import create_xhtml
|
||||
xhtml = create_xhtml(msg)
|
||||
if not self.connection:
|
||||
return
|
||||
if not msg and chatstate is None:
|
||||
|
@ -397,15 +402,16 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf):
|
|||
return 3
|
||||
|
||||
if type_ == 'chat':
|
||||
msg_iq = common.xmpp.Message(to = fjid, body = msgtxt, typ = type_)
|
||||
msg_iq = common.xmpp.Message(to=fjid, body=msgtxt, typ=type_i,
|
||||
xhtml=xhtml)
|
||||
|
||||
else:
|
||||
if subject:
|
||||
msg_iq = common.xmpp.Message(to = fjid, body = msgtxt,
|
||||
typ = 'normal', subject = subject)
|
||||
msg_iq = common.xmpp.Message(to=fjid, body=msgtxt, typ='normal',
|
||||
subject=subject, xhtml=xhtml)
|
||||
else:
|
||||
msg_iq = common.xmpp.Message(to = fjid, body = msgtxt,
|
||||
typ = 'normal')
|
||||
msg_iq = common.xmpp.Message(to=fjid, body=msgtxt, typ='normal',
|
||||
xhtml=xhtml)
|
||||
|
||||
if msgenc:
|
||||
msg_iq.setTag(common.xmpp.NS_ENCRYPTED + ' x').setData(msgenc)
|
||||
|
@ -428,6 +434,20 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf):
|
|||
if chatstate is 'composing' or msgtxt:
|
||||
chatstate_node.addChild(name = 'composing')
|
||||
|
||||
if forward_from:
|
||||
addresses = msg_iq.addChild('addresses',
|
||||
namespace=common.xmpp.NS_ADDRESS)
|
||||
addresses.addChild('address', attrs = {'type': 'ofrom',
|
||||
'jid': forward_from})
|
||||
|
||||
# XEP-0203
|
||||
if delayed:
|
||||
our_jid = gajim.get_jid_from_account(self.name) + '/' + \
|
||||
self.server_resource
|
||||
timestamp = time.strftime('%Y-%m-%dT%TZ', time.gmtime(delayed))
|
||||
msg_iq.addChild('delay', namespace=common.xmpp.NS_DELAY2,
|
||||
attrs={'from': our_jid, 'stamp': timestamp})
|
||||
|
||||
if session:
|
||||
session.last_send = time.time()
|
||||
msg_iq.setThread(session.thread_id)
|
||||
|
|
Loading…
Reference in New Issue