comparison src/plugins/plugin_xep_0277.py @ 704:3c304929af74

plugin XEP-0277, group blogs: proper asynchronous methods for sending blogs.
author Goffi <goffi@goffi.org>
date Thu, 14 Nov 2013 17:51:35 +0100
parents 69a8bfd266a5
children 80e9d3ecb272
comparison
equal deleted inserted replaced
703:0c2c1dfb79e4 704:3c304929af74
158 """Send XEP-0277's microblog data 158 """Send XEP-0277's microblog data
159 @param data: must include content 159 @param data: must include content
160 @param profile: profile which send the mood""" 160 @param profile: profile which send the mood"""
161 if 'content' not in data: 161 if 'content' not in data:
162 error(_("Microblog data must contain at least 'content' key")) 162 error(_("Microblog data must contain at least 'content' key"))
163 return 3 163 raise exceptions.DataError('no "content" key found')
164 content = data['content'] 164 content = data['content']
165 if not content: 165 if not content:
166 error(_("Microblog data's content value must not be empty")) 166 error(_("Microblog data's content value must not be empty"))
167 return 3 167 raise exceptions.DataError('empty content')
168 item = self.data2entry(data, profile) 168 item = self.data2entry(data, profile)
169 self.host.plugins["XEP-0060"].publish(None, NS_MICROBLOG, [item], profile_key=profile) 169 return self.host.plugins["XEP-0060"].publish(None, NS_MICROBLOG, [item], profile_key=profile)
170 return 0
171 170
172 def getLastMicroblogs(self, pub_jid, max_items=10, profile_key='@DEFAULT@'): 171 def getLastMicroblogs(self, pub_jid, max_items=10, profile_key='@DEFAULT@'):
173 """Get the last published microblogs 172 """Get the last published microblogs
174 @param pub_jid: jid of the publisher 173 @param pub_jid: jid of the publisher
175 @param max_items: how many microblogs we want to get 174 @param max_items: how many microblogs we want to get