Mercurial > libervia-backend
comparison frontends/src/jp/jp @ 542:3eeb6c865e4d
frontends: incoming files transfer management:
- quick app: getWaitingConf is used on profile connexion
- primitivus: askConfirmation is now managed, use new 'dir' style of FileDialog
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 14 Nov 2012 20:37:15 +0100 |
parents | 2c4016921403 |
children | ca13633d3b6b |
comparison
equal
deleted
inserted
replaced
541:8b116fa42a31 | 542:3eeb6c865e4d |
---|---|
280 if last_resource: | 280 if last_resource: |
281 return "%s/%s" % (_jid.short, last_resource) | 281 return "%s/%s" % (_jid.short, last_resource) |
282 return param_jid | 282 return param_jid |
283 | 283 |
284 | 284 |
285 def askConfirmation(self, type, confirm_id, data, profile): | 285 def askConfirmation(self, confirm_id, confirm_type, data, profile): |
286 """CB used for file transfer, accept files depending on parameters""" | 286 """CB used for file transfer, accept files depending on parameters""" |
287 if profile != self.profile: | 287 if profile != self.profile: |
288 debug("Ask confirmation ignored: not our profile") | 288 debug("Ask confirmation ignored: not our profile") |
289 return | 289 return |
290 answer_data={} | 290 answer_data={} |
291 if type == "FILE_TRANSFER": | 291 if confirm_type == "FILE_TRANSFER": |
292 if not self.options.wait_file: | 292 if not self.options.wait_file: |
293 return | 293 return |
294 if self.dest_jids and not JID(data['from']).short in [JID(_jid).short for _jid in self.dest_jids]: | 294 if self.dest_jids and not JID(data['from']).short in [JID(_jid).short for _jid in self.dest_jids]: |
295 return #file is not sent by a filtered jid | 295 return #file is not sent by a filtered jid |
296 | 296 |
306 | 306 |
307 | 307 |
308 if not self.options.multiple and not self.options.progress: | 308 if not self.options.multiple and not self.options.progress: |
309 #we just accept one file | 309 #we just accept one file |
310 self.loop.quit() | 310 self.loop.quit() |
311 elif type == "PIPE_TRANSFER": | 311 elif confirm_type == "PIPE_TRANSFER": |
312 if not self.options.pipe_in: | 312 if not self.options.pipe_in: |
313 return | 313 return |
314 if self.dest_jids and not JID(data['from']).short in [JID(_jid).short for _jid in self.dest_jids]: | 314 if self.dest_jids and not JID(data['from']).short in [JID(_jid).short for _jid in self.dest_jids]: |
315 return #pipe stream is not sent by a filtered jid | 315 return #pipe stream is not sent by a filtered jid |
316 | 316 |
329 #FIXME | 329 #FIXME |
330 info (_("FIXME: actionResult not implemented")) | 330 info (_("FIXME: actionResult not implemented")) |
331 | 331 |
332 def confirmation_reply(self): | 332 def confirmation_reply(self): |
333 """Auto reply to confirmations requests""" | 333 """Auto reply to confirmations requests""" |
334 #we register incoming confirmation | |
334 self.bridge.register("askConfirmation", self.askConfirmation) | 335 self.bridge.register("askConfirmation", self.askConfirmation) |
336 | |
337 #and we ask those we have missed | |
338 for confirm_id, confirm_type, data in self.bridge.getWaitingConf(self.profile): | |
339 self.askConfirmation(confirm_id, confirm_type, data, self.profile) | |
335 | 340 |
336 def progressCB(self): | 341 def progressCB(self): |
337 if self.transfer_data: | 342 if self.transfer_data: |
338 transfer_id = self.transfer_data | 343 transfer_id = self.transfer_data |
339 data = self.bridge.getProgress(transfer_id, self.profile) | 344 data = self.bridge.getProgress(transfer_id, self.profile) |