comparison sat/core/xmpp.py @ 2751:286a32a187e7

core (xmpp): don't add to history a message if there is no message and no subject.
author Goffi <goffi@goffi.org>
date Fri, 04 Jan 2019 18:44:43 +0100
parents ec9445c04a36
children 003b8b4b56a7
comparison
equal deleted inserted replaced
2750:ae495f27b316 2751:286a32a187e7
968 def addToHistory(self, data): 968 def addToHistory(self, data):
969 if data.pop(u"history", None) == C.HISTORY_SKIP: 969 if data.pop(u"history", None) == C.HISTORY_SKIP:
970 log.info(u"history is skipped as requested") 970 log.info(u"history is skipped as requested")
971 data[u"extra"][u"history"] = C.HISTORY_SKIP 971 data[u"extra"][u"history"] = C.HISTORY_SKIP
972 else: 972 else:
973 return self.host.memory.addToHistory(self.parent, data) 973 if data[u"message"] or data[u"subject"]: # we need a message to store
974 return self.host.memory.addToHistory(self.parent, data)
975 else:
976 log.debug(u"not storing empty message to history: {data}"
977 .format(data=data))
974 978
975 def bridgeSignal(self, __, data): 979 def bridgeSignal(self, __, data):
976 try: 980 try:
977 data["extra"]["received_timestamp"] = data["received_timestamp"] 981 data["extra"]["received_timestamp"] = data["received_timestamp"]
978 data["extra"]["delay_sender"] = data["delay_sender"] 982 data["extra"]["delay_sender"] = data["delay_sender"]