Skip to content
Snippets Groups Projects
Commit e92fec4b authored by zimio's avatar zimio
Browse files

send modification date of file being transfered

parent b8adce54
No related branches found
No related tags found
No related merge requests found
......@@ -174,6 +174,10 @@ class JingleContent(object):
node = xmpp.simplexml.Node(tag='name')
node.addData(self.file_props.name)
file_tag.addChild(node=node)
if self.file_props.date:
node = xmpp.simplexml.Node(tag='date')
node.addData(self.file_props.date)
file_tag.addChild(node=node)
if self.file_props.size:
node = xmpp.simplexml.Node(tag='size')
node.addData(self.file_props.size)
......
......@@ -664,10 +664,19 @@ class FileTransfersWindow:
return iter_
iter_ = self.model.iter_next(iter_)
def __convert_date(self, epoch):
# Converts date-time from seconds from epoch to iso 8601
import time, datetime
ts = time.gmtime(epoch)
dt = datetime.datetime(ts.tm_year, ts.tm_mon, ts.tm_mday, ts.tm_hour,
ts.tm_min, ts.tm_sec)
return dt.isoformat()
def get_send_file_props(self, account, contact, file_path, file_name,
file_desc=''):
"""
Create new file_props dict and set initial file transfer properties in it
Create new file_props object and set initial file transfer
properties in it
"""
if os.path.isfile(file_path):
stat = os.stat(file_path)
......@@ -680,8 +689,10 @@ class FileTransfersWindow:
return None
file_props = FilesProp.getNewFileProp(account,
sid=helpers.get_random_string_16())
mod_date = os.path.getmtime(file_path)
file_props.file_name = file_path
file_props.name = file_name
file_props.date = self.__convert_date(mod_date)
file_props.type_ = 's'
file_props.desc = file_desc
file_props.elapsed_time = 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment