comparison sat/plugins/plugin_xep_0313.py @ 3023:1f74cd0f22c3

plugin XEP-0313: log issues in addToHistory instead of raising error
author Goffi <goffi@goffi.org>
date Wed, 24 Jul 2019 07:51:48 +0200
parents 93da7c6f8e0c
children ab2696e34d29
comparison
equal deleted inserted replaced
3022:03fe31effa7f 3023:1f74cd0f22c3
133 u'from {from_jid}, ignoring\n{xml}').format( 133 u'from {from_jid}, ignoring\n{xml}').format(
134 from_jid=from_jid.full(), xml=mess_elt.toXml())) 134 from_jid=from_jid.full(), xml=mess_elt.toXml()))
135 continue 135 continue
136 # adding message to history 136 # adding message to history
137 mess_data = client.messageProt.parseMessage(fwd_message_elt) 137 mess_data = client.messageProt.parseMessage(fwd_message_elt)
138 yield client.messageProt.addToHistory(mess_data) 138 try:
139 yield client.messageProt.addToHistory(mess_data)
140 except exceptions.CancelError as e:
141 log.warning(
142 u"message has not been added to history: {e}".format(e=e))
143 except Exception as e:
144 log.error(
145 u"can't add message to history: {e}\n{xml}"
146 .format(e=e, xml=mess_elt.toXml()))
139 147
140 if not count: 148 if not count:
141 log.info(_(u"We have received no message while offline")) 149 log.info(_(u"We have received no message while offline"))
142 else: 150 else:
143 log.info(_(u"We have received {num_mess} message(s) while offline.") 151 log.info(_(u"We have received {num_mess} message(s) while offline.")