Mercurial > libervia-backend
comparison sat/core/xmpp.py @ 3316:5369ce5bcecf
core (xmpp): text can now be specified in `sendError`
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 01 Aug 2020 15:59:49 +0200 |
parents | 6cf4bd6972c2 |
children | e09cb08166a3 |
comparison
equal
deleted
inserted
replaced
3315:53b229761c9d | 3316:5369ce5bcecf |
---|---|
530 """ | 530 """ |
531 iq_elt = xmlstream.IQ(self.xmlstream, type_) | 531 iq_elt = xmlstream.IQ(self.xmlstream, type_) |
532 iq_elt.timeout = timeout | 532 iq_elt.timeout = timeout |
533 return iq_elt | 533 return iq_elt |
534 | 534 |
535 def sendError(self, iq_elt, condition): | 535 def sendError(self, iq_elt, condition, text=None): |
536 """Send error stanza build from iq_elt | 536 """Send error stanza build from iq_elt |
537 | 537 |
538 @param iq_elt(domish.Element): initial IQ element | 538 @param iq_elt(domish.Element): initial IQ element |
539 @param condition(unicode): error condition | 539 @param condition(unicode): error condition |
540 """ | 540 """ |
541 iq_error_elt = error.StanzaError(condition).toResponse(iq_elt) | 541 iq_error_elt = error.StanzaError(condition, text=text).toResponse(iq_elt) |
542 self.xmlstream.send(iq_error_elt) | 542 self.xmlstream.send(iq_error_elt) |
543 | 543 |
544 def generateMessageXML(self, data, post_xml_treatments=None): | 544 def generateMessageXML(self, data, post_xml_treatments=None): |
545 """Generate <message/> stanza from message data | 545 """Generate <message/> stanza from message data |
546 | 546 |
1464 jids_set.remove(entity) | 1464 jids_set.remove(entity) |
1465 if not jids_set: | 1465 if not jids_set: |
1466 del self._groups[group] | 1466 del self._groups[group] |
1467 except KeyError: | 1467 except KeyError: |
1468 log.warning( | 1468 log.warning( |
1469 "there is no cache for the group [{group}] of the removed roster " | 1469 f"there is no cache for the group [{group}] of the removed roster " |
1470 "item [{jid_}]".format(group=group, jid=entity) | 1470 f"item [{entity}]" |
1471 ) | 1471 ) |
1472 | 1472 |
1473 # then we send the bridge signal | 1473 # then we send the bridge signal |
1474 self.host.bridge.contactDeleted(entity.full(), self.parent.profile) | 1474 self.host.bridge.contactDeleted(entity.full(), self.parent.profile) |
1475 | 1475 |