comparison src/plugins/plugin_xep_0095.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 ca13633d3b6b
comparison
equal deleted inserted replaced
535:790be337cc41 536:a31abb97310d
122 @param err_code: error err_code (see XEP-0095 #4.2) 122 @param err_code: error err_code (see XEP-0095 #4.2)
123 @param err_type: one of cancel, modify 123 @param err_type: one of cancel, modify
124 @param data: error specific data (dictionary) 124 @param data: error specific data (dictionary)
125 @param profile: %(doc_profile)s 125 @param profile: %(doc_profile)s
126 """ 126 """
127 client = self.host.getClient(profile) 127 _client = self.host.getClient(profile)
128 assert(client) 128 assert(_client)
129 result = domish.Element(('', 'iq')) 129 result = domish.Element((None, 'iq'))
130 result['type'] = 'result' 130 result['type'] = 'result'
131 result['id'] = iq_id 131 result['id'] = iq_id
132 result['to'] = to_jid 132 result['to'] = to_jid
133 error_el = result.addElement('error') 133 error_el = result.addElement('error')
134 error_el['err_code'] = str(err_code) 134 error_el['err_code'] = str(err_code)
146 elif err_code==500 and err_type=='cancel': 146 elif err_code==500 and err_type=='cancel':
147 condition_el = error_el.addElement((NS_SI,'undefined-condition')) 147 condition_el = error_el.addElement((NS_SI,'undefined-condition'))
148 if data.has_key('custom') and data['custom']=='failed': 148 if data.has_key('custom') and data['custom']=='failed':
149 condition_el.addContent('Stream failed') 149 condition_el.addContent('Stream failed')
150 150
151 client.xmlstream.send(result) 151 _client.xmlstream.send(result)
152 152
153 def acceptStream(self, iq_id, to_jid, feature_elt, misc_elts=[], profile='@NONE@'): 153 def acceptStream(self, iq_id, to_jid, feature_elt, misc_elts=[], profile='@NONE@'):
154 """Send the accept stream initiation answer 154 """Send the accept stream initiation answer
155 @param iq_id: IQ id 155 @param iq_id: IQ id
156 @param feature_elt: domish element 'feature' containing stream method to use 156 @param feature_elt: domish element 'feature' containing stream method to use
157 @param misc_elts: list of domish element to add 157 @param misc_elts: list of domish element to add
158 @param profile: %(doc_profile)s""" 158 @param profile: %(doc_profile)s"""
159 client = self.host.getClient(profile) 159 _client = self.host.getClient(profile)
160 assert(client) 160 assert(_client)
161 info (_("sending stream initiation accept answer")) 161 info (_("sending stream initiation accept answer"))
162 result = domish.Element(('', 'iq')) 162 result = domish.Element((None, 'iq'))
163 result['type'] = 'result' 163 result['type'] = 'result'
164 result['id'] = iq_id 164 result['id'] = iq_id
165 result['to'] = to_jid 165 result['to'] = to_jid
166 si = result.addElement('si', NS_SI) 166 si = result.addElement('si', NS_SI)
167 si.addChild(feature_elt) 167 si.addChild(feature_elt)
168 for elt in misc_elts: 168 for elt in misc_elts:
169 si.addChild(elt) 169 si.addChild(elt)
170 client.xmlstream.send(result) 170 _client.xmlstream.send(result)
171 171
172 def proposeStream(self, to_jid, si_profile, feature_elt, misc_elts, mime_type='application/octet-stream', profile_key='@NONE@'): 172 def proposeStream(self, to_jid, si_profile, feature_elt, misc_elts, mime_type='application/octet-stream', profile_key='@NONE@'):
173 """Propose a stream initiation 173 """Propose a stream initiation
174 @param to_jid: recipient (JID) 174 @param to_jid: recipient (JID)
175 @param si_profile: Stream initiation profile (XEP-0095) 175 @param si_profile: Stream initiation profile (XEP-0095)