diff --git a/src/common/jingle_content.py b/src/common/jingle_content.py index cd43866b1236b1cf3b84d5140b3e59bfa9b7e7c2..418a6ec47516a3d9f00ed4e09a90bf98d6fb5d6b 100644 --- a/src/common/jingle_content.py +++ b/src/common/jingle_content.py @@ -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) diff --git a/src/filetransfers_window.py b/src/filetransfers_window.py index c2350de49c8470705bf5c68a313a3e62e64276b3..c453eb06c27a08c472f82fb082ef72fdb0f266b2 100644 --- a/src/filetransfers_window.py +++ b/src/filetransfers_window.py @@ -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