comparison sat/plugins/plugin_exp_events.py @ 2931:b256e90612d0

plugins invitation*, events: added an extra parameter and use it to keep a thumnail URL
author Goffi <goffi@goffi.org>
date Fri, 03 May 2019 13:05:01 +0200
parents a3faf1c86596
children 4f600b4ae819
comparison
equal deleted inserted replaced
2930:32b6893240e0 2931:b256e90612d0
229 raise exceptions.NotFound(_(u"No event element has been found")) 229 raise exceptions.NotFound(_(u"No event element has been found"))
230 except IndexError: 230 except IndexError:
231 raise exceptions.NotFound(_(u"No event with this id has been found")) 231 raise exceptions.NotFound(_(u"No event with this id has been found"))
232 defer.returnValue(event_elt) 232 defer.returnValue(event_elt)
233 233
234 def register(self, client, service, node, event_id, event_elt, creator=False): 234 def register(self, client, name, extra, service, node, event_id, event_elt,
235 creator=False):
235 """register evenement in personal events list 236 """register evenement in personal events list
236 237
237 @param service(jid.JID): pubsub service of the event 238 @param service(jid.JID): pubsub service of the event
238 @param node(unicode): event node 239 @param node(unicode): event node
239 @param event_id(unicode): event id 240 @param event_id(unicode): event id
240 @param event_elt(domish.Element): event element 241 @param event_elt(domish.Element): event element
241 note that this element will be modified in place 242 note that this element will be modified in place
242 @param creator(bool): True if client's profile is the creator of the node 243 @param creator(bool): True if client's profile is the creator of the node
243 """ 244 """
245 # FIXME: name and extra are unused
244 link_elt = event_elt.addElement("link") 246 link_elt = event_elt.addElement("link")
245 link_elt["service"] = service.full() 247 link_elt["service"] = service.full()
246 link_elt["node"] = node 248 link_elt["node"] = node
247 link_elt["item"] = event_id 249 link_elt["item"] = event_id
248 return self.host.plugins[u'LIST_INTEREST'].registerPubsub( 250 return self.host.plugins[u'LIST_INTEREST'].registerPubsub(
369 log.debug(_(u"requested node already exists")) 371 log.debug(_(u"requested node already exists"))
370 372
371 yield self._p.publish(client, service, node, items=[item_elt]) 373 yield self._p.publish(client, service, node, items=[item_elt])
372 374
373 if register: 375 if register:
374 yield self.register(client, service, node, event_id, event_elt, creator=True) 376 yield self.register(
377 client, service, None, {}, node, event_id, event_elt, creator=True)
375 defer.returnValue(node) 378 defer.returnValue(node)
376 379
377 def _eventModify(self, service, node, id_, timestamp_update, data_update, 380 def _eventModify(self, service, node, id_, timestamp_update, data_update,
378 profile_key=C.PROF_KEY_NONE): 381 profile_key=C.PROF_KEY_NONE):
379 service = jid.JID(service) if service else None 382 service = jid.JID(service) if service else None
544 @param service(jid.JID, None): pubsub service 547 @param service(jid.JID, None): pubsub service
545 None to use client's PEP 548 None to use client's PEP
546 @param node(unicode): event node 549 @param node(unicode): event node
547 @param item_id(unicode): event id 550 @param item_id(unicode): event id
548 """ 551 """
552 # FIXME: handle name and extra
553 name = u''
554 extra = {}
549 if self._b is None: 555 if self._b is None:
550 raise exceptions.FeatureNotFound( 556 raise exceptions.FeatureNotFound(
551 _(u'"XEP-0277" (blog) plugin is needed for this feature') 557 _(u'"XEP-0277" (blog) plugin is needed for this feature')
552 ) 558 )
553 if item_id is None: 559 if item_id is None:
588 log.debug(_(u"affiliation set on blog and comments nodes")) 594 log.debug(_(u"affiliation set on blog and comments nodes"))
589 595
590 # now we send the invitation 596 # now we send the invitation
591 pubsub_invitation = self.host.plugins[u'PUBSUB_INVITATION'] 597 pubsub_invitation = self.host.plugins[u'PUBSUB_INVITATION']
592 pubsub_invitation.sendPubsubInvitation(client, invitee_jid, service, node, 598 pubsub_invitation.sendPubsubInvitation(client, invitee_jid, service, node,
593 item_id) 599 item_id, name, extra)
594 600
595 def _inviteByEmail(self, service, node, id_=NS_EVENT, email=u"", emails_extra=None, 601 def _inviteByEmail(self, service, node, id_=NS_EVENT, email=u"", emails_extra=None,
596 name=u"", host_name=u"", language=u"", url_template=u"", 602 name=u"", host_name=u"", language=u"", url_template=u"",
597 message_subject=u"", message_body=u"", 603 message_subject=u"", message_body=u"",
598 profile_key=C.PROF_KEY_NONE): 604 profile_key=C.PROF_KEY_NONE):