Mercurial > libervia-backend
comparison src/plugins/plugin_xep_0050.py @ 2129:6a66c8c5a567
core: replaced calls to client.xmlstream.send by client.send which is the right method to use. client.xmlstream should not be used directly
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 04 Feb 2017 17:59:13 +0100 |
parents | 2daf7b4c6756 |
children | 1d3f73e065e1 |
comparison
equal
deleted
inserted
replaced
2128:aa94f33fd2ad | 2129:6a66c8c5a567 |
---|---|
160 note_elt['type'] = note_type | 160 note_elt['type'] = note_type |
161 | 161 |
162 if payload is not None: | 162 if payload is not None: |
163 command_elt.addChild(payload) | 163 command_elt.addChild(payload) |
164 | 164 |
165 self.client.xmlstream.send(result) | 165 self.client.send(result) |
166 if status in (XEP_0050.STATUS.COMPLETED, XEP_0050.STATUS.CANCELED): | 166 if status in (XEP_0050.STATUS.COMPLETED, XEP_0050.STATUS.CANCELED): |
167 del self.sessions[session_id] | 167 del self.sessions[session_id] |
168 | 168 |
169 def _sendError(self, error_constant, session_id, request): | 169 def _sendError(self, error_constant, session_id, request): |
170 """ Send error stanza | 170 """ Send error stanza |
174 xmpp_condition, cmd_condition = error_constant | 174 xmpp_condition, cmd_condition = error_constant |
175 iq_elt = jabber.error.StanzaError(xmpp_condition).toResponse(request) | 175 iq_elt = jabber.error.StanzaError(xmpp_condition).toResponse(request) |
176 if cmd_condition: | 176 if cmd_condition: |
177 error_elt = iq_elt.elements(None, "error").next() | 177 error_elt = iq_elt.elements(None, "error").next() |
178 error_elt.addElement(cmd_condition, NS_COMMANDS) | 178 error_elt.addElement(cmd_condition, NS_COMMANDS) |
179 self.client.xmlstream.send(iq_elt) | 179 self.client.send(iq_elt) |
180 del self.sessions[session_id] | 180 del self.sessions[session_id] |
181 | 181 |
182 def onRequest(self, command_elt, requestor, action, session_id): | 182 def onRequest(self, command_elt, requestor, action, session_id): |
183 if not self.isAuthorised(requestor): | 183 if not self.isAuthorised(requestor): |
184 return self._sendError(XEP_0050.ERROR.FORBIDDEN, session_id, command_elt.parent) | 184 return self._sendError(XEP_0050.ERROR.FORBIDDEN, session_id, command_elt.parent) |