Mercurial > libervia-backend
comparison src/plugins/plugin_xep_0054.py @ 538:2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
- added profile argument to askConfirmation, actionResult, actionResultExt, entityDataUpdated, confirmationAnswer, getProgress
- core, frontends: fixed calls/signals according to new bridge API
- user of proper profile namespace for progression indicators and dialogs
- memory: getParam* now return bool when param type is bool
- memory: added getStringParam* to return string instead of typed value
- core, memory, storage, quick_frontend: getHistory now manage properly multi-profiles
- plugins XEP-0047, XEP-0054, XEP-0065, XEP-0077, XEP-0096; multi-profiles proper handling
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 10 Nov 2012 16:38:16 +0100 |
parents | 65ecbb473cbb |
children | dcec4ba8e72c |
comparison
equal
deleted
inserted
replaced
537:28cddc96c4ed | 538:2c4016921403 |
---|---|
155 """Called after the first get IQ""" | 155 """Called after the first get IQ""" |
156 debug (_("VCard found")) | 156 debug (_("VCard found")) |
157 | 157 |
158 if answer.firstChildElement().name == "vCard": | 158 if answer.firstChildElement().name == "vCard": |
159 d = self.vCard2Dict(answer.firstChildElement(), jid.JID(answer["from"]), profile) | 159 d = self.vCard2Dict(answer.firstChildElement(), jid.JID(answer["from"]), profile) |
160 d.addCallback(lambda data: self.host.bridge.actionResult("RESULT", answer['id'], data)) | 160 d.addCallback(lambda data: self.host.bridge.actionResult("RESULT", answer['id'], data, profile)) |
161 else: | 161 else: |
162 error (_("FIXME: vCard not found as first child element")) | 162 error (_("FIXME: vCard not found as first child element")) |
163 self.host.bridge.actionResult("SUPPRESS", answer['id'], {}) #FIXME: maybe an error message would be better | 163 self.host.bridge.actionResult("SUPPRESS", answer['id'], {}, profile) #FIXME: maybe an error message would be better |
164 | 164 |
165 def vcard_err(self, failure): | 165 def vcard_err(self, failure, profile): |
166 """Called when something is wrong with registration""" | 166 """Called when something is wrong with registration""" |
167 error (_("Can't find VCard of %s") % failure.value.stanza['from']) | 167 error (_("Can't find VCard of %s") % failure.value.stanza['from']) |
168 self.host.bridge.actionResult("SUPPRESS", failure.value.stanza['id'], {}) #FIXME: maybe an error message would be better | 168 self.host.bridge.actionResult("SUPPRESS", failure.value.stanza['id'], {}, profile) #FIXME: maybe an error message would be better |
169 | 169 |
170 def getCard(self, target, profile_key='@DEFAULT@'): | 170 def getCard(self, target, profile_key='@DEFAULT@'): |
171 """Ask server for VCard | 171 """Ask server for VCard |
172 @param target: jid from which we want the VCard | 172 @param target: jid from which we want the VCard |
173 @result: id to retrieve the profile""" | 173 @result: id to retrieve the profile""" |
180 debug(_("Asking for %s's VCard") % to_jid.userhost()) | 180 debug(_("Asking for %s's VCard") % to_jid.userhost()) |
181 reg_request=IQ(xmlstream,'get') | 181 reg_request=IQ(xmlstream,'get') |
182 reg_request["from"]=current_jid.full() | 182 reg_request["from"]=current_jid.full() |
183 reg_request["to"] = to_jid.userhost() | 183 reg_request["to"] = to_jid.userhost() |
184 reg_request.addElement('vCard', NS_VCARD) | 184 reg_request.addElement('vCard', NS_VCARD) |
185 reg_request.send(to_jid.userhost()).addCallbacks(self.vcard_ok, self.vcard_err, [profile]) | 185 reg_request.send(to_jid.userhost()).addCallbacks(self.vcard_ok, self.vcard_err, callbackArgs=[profile], errbackArgs=[profile]) |
186 return reg_request["id"] | 186 return reg_request["id"] |
187 | 187 |
188 def getAvatarFile(self, hash): | 188 def getAvatarFile(self, hash): |
189 """Give the full path of avatar from hash | 189 """Give the full path of avatar from hash |
190 @param hash: SHA1 hash | 190 @param hash: SHA1 hash |