comparison src/plugins/plugin_exp_events.py @ 2291:c05000d00dbb

plugin events, invitations + jp (event/create, invitation/invitee/invite): several emails addresses can now be specified for a single invitation: if several addresses are specified, the same invitation (same ID and data) is sent to all the addresses
author Goffi <goffi@goffi.org>
date Fri, 30 Jun 2017 00:04:47 +0200
parents ea869f30f204
children 78048f002a3c
comparison
equal deleted inserted replaced
2290:d5c75be1c8c0 2291:c05000d00dbb
72 async=True) 72 async=True)
73 host.bridge.addMethod("eventInviteeSet", ".plugin", 73 host.bridge.addMethod("eventInviteeSet", ".plugin",
74 in_sign='ssa{ss}s', out_sign='', 74 in_sign='ssa{ss}s', out_sign='',
75 method=self._eventInviteeSet, 75 method=self._eventInviteeSet,
76 async=True) 76 async=True)
77 host.bridge.addMethod("eventInvite", ".plugin", in_sign='sssssssssss', out_sign='', 77 host.bridge.addMethod("eventInvite", ".plugin", in_sign='ssssassssssss', out_sign='',
78 method=self._invite, 78 method=self._invite,
79 async=True) 79 async=True)
80 80
81 def _eventGet(self, service, node, id_=u'', profile_key=C.PROF_KEY_NONE): 81 def _eventGet(self, service, node, id_=u'', profile_key=C.PROF_KEY_NONE):
82 service = jid.JID(service) if service else None 82 service = jid.JID(service) if service else None
318 except KeyError: 318 except KeyError:
319 pass 319 pass
320 item_elt = pubsub.Item(id=client.jid.userhost(), payload=event_elt) 320 item_elt = pubsub.Item(id=client.jid.userhost(), payload=event_elt)
321 return self._p.publish(client, service, node, items=[item_elt]) 321 return self._p.publish(client, service, node, items=[item_elt])
322 322
323 def _invite(self, service, node, id_=NS_EVENT, email=u'', name=u'', host_name=u'', language=u'', url_template=u'', 323 def _invite(self, service, node, id_=NS_EVENT, email=u'', emails_extra=None, name=u'', host_name=u'', language=u'', url_template=u'',
324 message_subject=u'', message_body=u'', profile_key=C.PROF_KEY_NONE): 324 message_subject=u'', message_body=u'', profile_key=C.PROF_KEY_NONE):
325 client = self.host.getClient(profile_key) 325 client = self.host.getClient(profile_key)
326 kwargs = {u'profile': client.profile} 326 kwargs = {u'profile': client.profile,
327 u'emails_extra': [unicode(e) for e in emails_extra]
328 }
327 for key in ("email", "name", "host_name", "language", "url_template", "message_subject", "message_body"): 329 for key in ("email", "name", "host_name", "language", "url_template", "message_subject", "message_body"):
328 value = locals()[key] 330 value = locals()[key]
329 kwargs[key] = unicode(value) 331 kwargs[key] = unicode(value)
330 return self.invite(client, 332 return self.invite(client,
331 jid.JID(service) if service else None, 333 jid.JID(service) if service else None,