Mercurial > libervia-backend
comparison sat/core/xmpp.py @ 2736:df2bc2e704bc
core (xmpp): don't send message without message or subject to bridge (and log a warning in frontends if such a message is received)
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 02 Jan 2019 18:28:30 +0100 |
parents | a58e380c1c37 |
children | 1f5b02623355 |
comparison
equal
deleted
inserted
replaced
2735:ba74914277cf | 2736:df2bc2e704bc |
---|---|
969 except KeyError: | 969 except KeyError: |
970 pass | 970 pass |
971 if C.MESS_KEY_ENCRYPTION in data: | 971 if C.MESS_KEY_ENCRYPTION in data: |
972 data[u"extra"][u"encrypted"] = C.BOOL_TRUE | 972 data[u"extra"][u"encrypted"] = C.BOOL_TRUE |
973 if data is not None: | 973 if data is not None: |
974 self.host.bridge.messageNew( | 974 if data["message"] or data["subject"] or data["type"] == C.MESS_TYPE_INFO: |
975 data["uid"], | 975 self.host.bridge.messageNew( |
976 data["timestamp"], | 976 data["uid"], |
977 data["from"].full(), | 977 data["timestamp"], |
978 data["to"].full(), | 978 data["from"].full(), |
979 data["message"], | 979 data["to"].full(), |
980 data["subject"], | 980 data["message"], |
981 data["type"], | 981 data["subject"], |
982 data["extra"], | 982 data["type"], |
983 profile=self.parent.profile, | 983 data["extra"], |
984 ) | 984 profile=self.parent.profile, |
985 ) | |
986 else: | |
987 log.debug(u"Discarding bridge signal for empty message: {data}".format( | |
988 data=data)) | |
985 return data | 989 return data |
986 | 990 |
987 def cancelErrorTrap(self, failure_): | 991 def cancelErrorTrap(self, failure_): |
988 """A message sending can be cancelled by a plugin treatment""" | 992 """A message sending can be cancelled by a plugin treatment""" |
989 failure_.trap(exceptions.CancelError) | 993 failure_.trap(exceptions.CancelError) |