comparison src/plugins/plugin_xep_0166.py @ 2487:ed1d71b91b29

plugin XEP-0166: added errback to terminate, which only logs issues
author Goffi <goffi@goffi.org>
date Thu, 01 Feb 2018 07:21:41 +0100
parents 0046283a285d
children e2a7bb875957
comparison
equal deleted inserted replaced
2486:031aa3cc67ac 2487:ed1d71b91b29
138 if error.STANZA_CONDITIONS[error_condition]['type'] == 'cancel' and sid: 138 if error.STANZA_CONDITIONS[error_condition]['type'] == 'cancel' and sid:
139 self._delSession(client, sid) 139 self._delSession(client, sid)
140 log.warning(u"Error while managing jingle session, cancelling: {condition}".format(error_condition)) 140 log.warning(u"Error while managing jingle session, cancelling: {condition}".format(error_condition))
141 client.send(iq_elt) 141 client.send(iq_elt)
142 142
143 def _terminateEb(self, failure_):
144 log.warning(_(u"Error while terminating session: {msg}").format(msg=failure_))
145
143 def terminate(self, reason, session, profile): 146 def terminate(self, reason, session, profile):
144 """Terminate the session 147 """Terminate the session
145 148
146 send the session-terminate action, and delete the session data 149 send the session-terminate action, and delete the session data
147 @param reason(unicode, list[domish.Element]): if unicode, will be transformed to an element 150 @param reason(unicode, list[domish.Element]): if unicode, will be transformed to an element
157 else: 160 else:
158 for elt in reason: 161 for elt in reason:
159 reason_elt.addChild(elt) 162 reason_elt.addChild(elt)
160 self._delSession(client, session['id']) 163 self._delSession(client, session['id'])
161 d = iq_elt.send() 164 d = iq_elt.send()
165 d.addErrback(self._terminateEb)
162 return d 166 return d
163 167
164 ## errors which doesn't imply a stanza sending ## 168 ## errors which doesn't imply a stanza sending ##
165 169
166 def _iqError(self, failure_, sid, client): 170 def _iqError(self, failure_, sid, client):