Mercurial > libervia-backend
comparison sat/plugins/plugin_xep_0264.py @ 3314:5887fb414758
component file sharing: add/parse affiliation when possible
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 17 Jul 2020 13:00:10 +0200 |
parents | 4230aaeab9a7 |
children | 15612c0fb421 |
comparison
equal
deleted
inserted
replaced
3313:624c60293deb | 3314:5887fb414758 |
---|---|
82 def getHandler(self, client): | 82 def getHandler(self, client): |
83 return XEP_0264_handler() | 83 return XEP_0264_handler() |
84 | 84 |
85 ##Â triggers ## | 85 ##Â triggers ## |
86 | 86 |
87 def _addFileThumbnails(self, file_elt, extra_args): | 87 def _addFileThumbnails(self, client, file_elt, extra_args): |
88 try: | 88 try: |
89 thumbnails = extra_args["extra"][C.KEY_THUMBNAILS] | 89 thumbnails = extra_args["extra"][C.KEY_THUMBNAILS] |
90 except KeyError: | 90 except KeyError: |
91 return | 91 return |
92 for thumbnail in thumbnails: | 92 for thumbnail in thumbnails: |
96 width, height = thumbnail["size"] | 96 width, height = thumbnail["size"] |
97 thumbnail_elt["width"] = str(width) | 97 thumbnail_elt["width"] = str(width) |
98 thumbnail_elt["height"] = str(height) | 98 thumbnail_elt["height"] = str(height) |
99 return True | 99 return True |
100 | 100 |
101 def _getFileThumbnails(self, file_elt, file_data): | 101 def _getFileThumbnails(self, client, file_elt, file_data): |
102 thumbnails = [] | 102 thumbnails = [] |
103 for thumbnail_elt in file_elt.elements(NS_THUMBS, "thumbnail"): | 103 for thumbnail_elt in file_elt.elements(NS_THUMBS, "thumbnail"): |
104 uri = thumbnail_elt["uri"] | 104 uri = thumbnail_elt["uri"] |
105 if uri.startswith("cid:"): | 105 if uri.startswith("cid:"): |
106 thumbnail = {"id": uri[4:]} | 106 thumbnail = {"id": uri[4:]} |