core, plugin file: fixed progress id + data is now returned by getProgress, instead of being an argument to fill

This commit is contained in:
Goffi 2015-11-14 19:20:33 +01:00
commit 2c8b91ee6c
3 changed files with 10 additions and 11 deletions

View file

@ -66,7 +66,7 @@ class SatFile(object):
self.host = host
self.uid = uid or unicode(uuid.uuid4())
self._file = open(path, mode)
self.size = None
self.size = size
self.profile = profile
self.eof = defer.Deferred()
self.host.registerProgressCb(self.uid, self.getProgress, profile)
@ -96,8 +96,8 @@ class SatFile(object):
def tell(self):
return self._file.tell()
def getProgress(self, progress_id, data, profile):
return {'position': self._file.tell(), 'size': self.size or 0}
def getProgress(self, progress_id, profile):
return {'position': self._file.tell(), 'size': self.size or -1}
class FilePlugin(object):

View file

@ -100,7 +100,7 @@ class XEP_0234(object):
# jingle callbacks
def jingleSessionInit(self, session, content_name, filepath, name, file_desc, progress_id_d, profile=C.PROF_KEY_NONE):
progress_id_d.callback(self.getProgressId(session, content_name))
progress_id_d.callback(self._getProgressId(session, content_name))
content_data = session['contents'][content_name]
application_data = content_data['application_data']
assert 'file_path' not in application_data