Mercurial > libervia-backend
diff src/plugins/plugin_xep_0329.py @ 2512:025afb04c10b
plugin XEP-0234: some cleaning + added triggers to allow plugins to change parsing/generation of <file> element
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 02 Mar 2018 17:53:19 +0100 |
parents | c0bec8bac2b5 |
children | 25e16729413b |
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0329.py Fri Mar 02 17:45:23 2018 +0100 +++ b/src/plugins/plugin_xep_0329.py Fri Mar 02 17:53:19 2018 +0100 @@ -311,11 +311,11 @@ name = os.path.basename(path) if os.path.isfile(path): size = os.path.getsize(path) - media_type = mimetypes.guess_type(path, strict=False)[0] + mime_type = mimetypes.guess_type(path, strict=False)[0] file_elt = self._jf.buildFileElement(name = name, size = size, - media_type = media_type, - date = os.path.getmtime(path)) + mime_type = mime_type, + modified = os.path.getmtime(path)) query_elt.addChild(file_elt) # we don't specify hash as it would be too resource intensive to calculate it for all files @@ -323,7 +323,7 @@ name_data = client._XEP_0329_names_data.setdefault(name, {}) if path not in name_data: name_data[path] = {'size': size, - 'media_type': media_type, + 'mime_type': mime_type, 'parent': parent_node} else: # we have a directory @@ -435,7 +435,7 @@ query_elt[u'node'] = node_path for file_data in files_data: file_elt = self._jf.buildFileElementFromDict(file_data, - date=file_data.get(u'modified', file_data[u'created'])) + modified=file_data.get(u'modified', file_data[u'created'])) query_elt.addChild(file_elt) client.send(iq_result_elt)