comparison src/plugins/plugin_xep_0277.py @ 745:812dc38c0094

plugins groupblog (xep-0060, xep-0277): added blog item modification/deletion
author souliane <souliane@mailoo.org>
date Tue, 10 Dec 2013 09:02:20 +0100
parents 890fbf2d7fdd
children 64dd7c0f4feb
comparison
equal deleted inserted replaced
744:312a2842b2b8 745:812dc38c0094
171 _entry.title = unicode(content).encode('utf-8') 171 _entry.title = unicode(content).encode('utf-8')
172 172
173 _entry.author = atom.Author() 173 _entry.author = atom.Author()
174 _entry.author.name = data.get('author', self.host.getJidNStream(profile)[0].userhost()).encode('utf-8') 174 _entry.author.name = data.get('author', self.host.getJidNStream(profile)[0].userhost()).encode('utf-8')
175 _entry.updated = float(data.get('timestamp', time())) 175 _entry.updated = float(data.get('timestamp', time()))
176 _entry.id = str(_uuid) 176 entry_id = data.get('id', str(_uuid))
177 _entry.id = entry_id
177 if 'comments' in data: 178 if 'comments' in data:
178 link = atom.Link() 179 link = atom.Link()
179 link.attrs['href'] = data['comments'] 180 link.attrs['href'] = data['comments']
180 link.attrs['rel'] = 'replies' 181 link.attrs['rel'] = 'replies'
181 link.attrs['title'] = 'comments' 182 link.attrs['title'] = 'comments'
182 _entry.links.append(link) 183 _entry.links.append(link)
183 _entry_elt = ElementParser()(str(_entry).decode('utf-8')) 184 _entry_elt = ElementParser()(str(_entry).decode('utf-8'))
184 item = pubsub.Item(payload=_entry_elt) 185 item = pubsub.Item(id=entry_id, payload=_entry_elt)
185 item['id'] = _uuid
186 defer.returnValue(item) 186 defer.returnValue(item)
187 187
188 @defer.inlineCallbacks 188 @defer.inlineCallbacks
189 def sendMicroblog(self, data, profile): 189 def sendMicroblog(self, data, profile):
190 """Send XEP-0277's microblog data 190 """Send XEP-0277's microblog data