comparison sat/core/xmpp.py @ 2748:ec9445c04a36

core (xmpp): added "extra" argument to client.feedback
author Goffi <goffi@goffi.org>
date Fri, 04 Jan 2019 11:13:31 +0100
parents 1f5b02623355
children 286a32a187e7
comparison
equal deleted inserted replaced
2747:6487b8855c9a 2748:ec9445c04a36
698 yield self.host_app.trigger.asyncPoint("sendMessageData", self, mess_data, 698 yield self.host_app.trigger.asyncPoint("sendMessageData", self, mess_data,
699 triggers_no_cancel=True) 699 triggers_no_cancel=True)
700 self.send(mess_data[u"xml"]) 700 self.send(mess_data[u"xml"])
701 defer.returnValue(mess_data) 701 defer.returnValue(mess_data)
702 702
703 def feedback(self, to_jid, message): 703 def feedback(self, to_jid, message, extra=None):
704 """Send message to frontends 704 """Send message to frontends
705 705
706 This message will be an info message, not recorded in history. 706 This message will be an info message, not recorded in history.
707 It can be used to give feedback of a command 707 It can be used to give feedback of a command
708 @param to_jid(jid.JID): destinee jid 708 @param to_jid(jid.JID): destinee jid
709 @param message(unicode): message to send to frontends 709 @param message(unicode): message to send to frontends
710 """ 710 @param extra(None, dict): extra data to use
711 in particular, info subtype can be specified with MESS_EXTRA_INFO
712 """
713 if extra is None:
714 extra = {}
711 self.host_app.bridge.messageNew( 715 self.host_app.bridge.messageNew(
712 uid=unicode(uuid.uuid4()), 716 uid=unicode(uuid.uuid4()),
713 timestamp=time.time(), 717 timestamp=time.time(),
714 from_jid=self.jid.full(), 718 from_jid=self.jid.full(),
715 to_jid=to_jid.full(), 719 to_jid=to_jid.full(),
716 message={u"": message}, 720 message={u"": message},
717 subject={}, 721 subject={},
718 mess_type=C.MESS_TYPE_INFO, 722 mess_type=C.MESS_TYPE_INFO,
719 extra={}, 723 extra=extra,
720 profile=self.profile, 724 profile=self.profile,
721 ) 725 )
722 726
723 def _finish_connection(self, __): 727 def _finish_connection(self, __):
724 self.roster.requestRoster() 728 self.roster.requestRoster()