comparison src/plugins/plugin_xep_0264.py @ 2528:65e278997715

component file sharing: comments metadata: new <comments> element is added to file metadata, it contains the URL to the comments virtual node and the count of comments (this way client knows if it make sense to request comments or not). Fixed triggers in plugin XEP-0264 (return value was missing). New trigger in plugin XEP-0329 to allow component to add metadata (used here for comments url).
author Goffi <goffi@goffi.org>
date Fri, 16 Mar 2018 18:43:11 +0100
parents 327bbbe793ce
children
comparison
equal deleted inserted replaced
2527:a201194fc461 2528:65e278997715
89 thumbnail_elt['uri'] = u'cid:' + thumbnail['id'] 89 thumbnail_elt['uri'] = u'cid:' + thumbnail['id']
90 thumbnail_elt['media-type'] = MIME_TYPE 90 thumbnail_elt['media-type'] = MIME_TYPE
91 width, height = thumbnail['size'] 91 width, height = thumbnail['size']
92 thumbnail_elt['width'] = unicode(width) 92 thumbnail_elt['width'] = unicode(width)
93 thumbnail_elt['height'] = unicode(height) 93 thumbnail_elt['height'] = unicode(height)
94 return True
94 95
95 def _getFileThumbnails(self, file_elt, file_data): 96 def _getFileThumbnails(self, file_elt, file_data):
96 thumbnails = [] 97 thumbnails = []
97 for thumbnail_elt in file_elt.elements(NS_THUMBS, u'thumbnail'): 98 for thumbnail_elt in file_elt.elements(NS_THUMBS, u'thumbnail'):
98 uri = thumbnail_elt['uri'] 99 uri = thumbnail_elt['uri']
111 pass 112 pass
112 thumbnails.append(thumbnail) 113 thumbnails.append(thumbnail)
113 114
114 if thumbnails: 115 if thumbnails:
115 file_data.setdefault('extra', {})[C.KEY_THUMBNAILS] = thumbnails 116 file_data.setdefault('extra', {})[C.KEY_THUMBNAILS] = thumbnails
117 return True
116 118
117 ## thumbnails generation ## 119 ## thumbnails generation ##
118 120
119 def getThumbId(self, image_uid, size): 121 def getThumbId(self, image_uid, size):
120 """return an ID unique for image/size combination 122 """return an ID unique for image/size combination