core (xmpp): added "extra" argument to client.feedback

This commit is contained in:
Goffi 2019-01-04 11:13:31 +01:00
commit 1307adcd71

View file

@ -700,14 +700,18 @@ class SatXMPPClient(SatXMPPEntity, wokkel_client.XMPPClient):
self.send(mess_data[u"xml"]) self.send(mess_data[u"xml"])
defer.returnValue(mess_data) defer.returnValue(mess_data)
def feedback(self, to_jid, message): def feedback(self, to_jid, message, extra=None):
"""Send message to frontends """Send message to frontends
This message will be an info message, not recorded in history. This message will be an info message, not recorded in history.
It can be used to give feedback of a command It can be used to give feedback of a command
@param to_jid(jid.JID): destinee jid @param to_jid(jid.JID): destinee jid
@param message(unicode): message to send to frontends @param message(unicode): message to send to frontends
@param extra(None, dict): extra data to use
in particular, info subtype can be specified with MESS_EXTRA_INFO
""" """
if extra is None:
extra = {}
self.host_app.bridge.messageNew( self.host_app.bridge.messageNew(
uid=unicode(uuid.uuid4()), uid=unicode(uuid.uuid4()),
timestamp=time.time(), timestamp=time.time(),
@ -716,7 +720,7 @@ class SatXMPPClient(SatXMPPEntity, wokkel_client.XMPPClient):
message={u"": message}, message={u"": message},
subject={}, subject={},
mess_type=C.MESS_TYPE_INFO, mess_type=C.MESS_TYPE_INFO,
extra={}, extra=extra,
profile=self.profile, profile=self.profile,
) )