Mercurial > libervia-backend
comparison src/plugins/plugin_xep_0047.py @ 536:a31abb97310d
core, plugins: fixed bad namespace in stanza creation
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 01 Nov 2012 22:41:39 +0100 |
parents | 2a072735e459 |
children | 2c4016921403 |
comparison
equal
deleted
inserted
replaced
535:790be337cc41 | 536:a31abb97310d |
---|---|
161 event_close = IBB_CLOSE % sid | 161 event_close = IBB_CLOSE % sid |
162 #we now set the stream observer to look after data packet | 162 #we now set the stream observer to look after data packet |
163 xmlstream.addObserver(event_data, observer_cb, profile = profile) | 163 xmlstream.addObserver(event_data, observer_cb, profile = profile) |
164 xmlstream.addOnetimeObserver(event_close, self.streamClosing, profile = profile) | 164 xmlstream.addOnetimeObserver(event_close, self.streamClosing, profile = profile) |
165 #finally, we send the accept stanza | 165 #finally, we send the accept stanza |
166 result = domish.Element(('', 'iq')) | 166 result = domish.Element((None, 'iq')) |
167 result['type'] = 'result' | 167 result['type'] = 'result' |
168 result['id'] = IQ['id'] | 168 result['id'] = IQ['id'] |
169 result['to'] = IQ['from'] | 169 result['to'] = IQ['from'] |
170 xmlstream.send(result) | 170 xmlstream.send(result) |
171 | 171 |
172 def streamClosing(self, IQ, profile): | 172 def streamClosing(self, IQ, profile): |
173 IQ.handled=True | 173 IQ.handled=True |
174 debug(_("IBB stream closing")) | 174 debug(_("IBB stream closing")) |
175 data_elt = IQ.firstChildElement() | 175 data_elt = IQ.firstChildElement() |
176 sid = data_elt.getAttribute('sid') | 176 sid = data_elt.getAttribute('sid') |
177 result = domish.Element(('', 'iq')) | 177 result = domish.Element((None, 'iq')) |
178 result['type'] = 'result' | 178 result['type'] = 'result' |
179 result['id'] = IQ['id'] | 179 result['id'] = IQ['id'] |
180 result['to'] = IQ['from'] | 180 result['to'] = IQ['from'] |
181 self.current_stream[sid]["xmlstream"].send(result) | 181 self.current_stream[sid]["xmlstream"].send(result) |
182 self._killId(sid, success=True) | 182 self._killId(sid, success=True) |
185 IQ.handled=True | 185 IQ.handled=True |
186 data_elt = IQ.firstChildElement() | 186 data_elt = IQ.firstChildElement() |
187 | 187 |
188 if self._manageDataElt(data_elt, 'iq', IQ['id'], jid.JID(IQ['from'])): | 188 if self._manageDataElt(data_elt, 'iq', IQ['id'], jid.JID(IQ['from'])): |
189 #and send a success answer | 189 #and send a success answer |
190 result = domish.Element(('', 'iq')) | 190 result = domish.Element((None, 'iq')) |
191 result['type'] = 'result' | 191 result['type'] = 'result' |
192 result['id'] = IQ['id'] | 192 result['id'] = IQ['id'] |
193 result['to'] = IQ['from'] | 193 result['to'] = IQ['from'] |
194 _jid, xmlstream = self.host.getJidNStream(profile) | 194 _jid, xmlstream = self.host.getJidNStream(profile) |
195 xmlstream.send(result) | 195 xmlstream.send(result) |
242 def sendNotAcceptableError(self, iq_id, to_jid, xmlstream): | 242 def sendNotAcceptableError(self, iq_id, to_jid, xmlstream): |
243 """Not acceptable error used when the stream is not expected or something is going wrong | 243 """Not acceptable error used when the stream is not expected or something is going wrong |
244 @param iq_id: IQ id | 244 @param iq_id: IQ id |
245 @param to_jid: addressee | 245 @param to_jid: addressee |
246 @param xmlstream: XML stream to use to send the error""" | 246 @param xmlstream: XML stream to use to send the error""" |
247 result = domish.Element(('', 'iq')) | 247 result = domish.Element((None, 'iq')) |
248 result['type'] = 'result' | 248 result['type'] = 'result' |
249 result['id'] = iq_id | 249 result['id'] = iq_id |
250 result['to'] = to_jid | 250 result['to'] = to_jid |
251 error_el = result.addElement('error') | 251 error_el = result.addElement('error') |
252 error_el['type'] = 'cancel' | 252 error_el['type'] = 'cancel' |