Mercurial > libervia-backend
comparison sat/plugins/plugin_misc_email_invitation.py @ 3336:e38ddaf477bd
plugin email invitation: guests are now automatically added to host roster in `guests` group
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 13 Aug 2020 23:46:18 +0200 |
parents | 83bc9d46a417 |
children | 932cf08dfdc3 |
comparison
equal
deleted
inserted
replaced
3335:83bc9d46a417 | 3336:e38ddaf477bd |
---|---|
323 (kwargs.pop('message_subject', None) or DEFAULT_SUBJECT).format( | 323 (kwargs.pop('message_subject', None) or DEFAULT_SUBJECT).format( |
324 **format_args), | 324 **format_args), |
325 (kwargs.pop('message_body', None) or DEFAULT_BODY).format(**format_args), | 325 (kwargs.pop('message_body', None) or DEFAULT_BODY).format(**format_args), |
326 ) | 326 ) |
327 | 327 |
328 ## roster | |
329 | |
330 # we automatically add guest to host roster (if host is specified) | |
331 # FIXME: a parameter to disable auto roster adding would be nice | |
332 if profile is not None: | |
333 try: | |
334 client = self.host.getClient(profile) | |
335 except Exception as e: | |
336 log.error(f"Can't get host profile: {profile}: {e}") | |
337 else: | |
338 await self.host.updateContact(client, jid_, name, ['guests']) | |
328 | 339 |
329 if kwargs: | 340 if kwargs: |
330 log.warning(_("Not all arguments have been consumed: {}").format(kwargs)) | 341 log.warning(_("Not all arguments have been consumed: {}").format(kwargs)) |
331 | 342 |
332 extra[KEY_JID] = jid_.full() | 343 extra[KEY_JID] = jid_.full() |