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
This commit is contained in:
parent
1540936d12
commit
d07083bff6
2 changed files with 33 additions and 13 deletions
|
|
@ -204,7 +204,7 @@ class InviteeInvite(base.CommandBase):
|
|||
|
||||
def add_parser_options(self):
|
||||
self.parser.add_argument("-i", "--item", type=base.unicode_decoder, default=u'', help=_(u"ID of the PubSub Item"))
|
||||
self.parser.add_argument("-e", "--email", type=base.unicode_decoder, default='', help='email to send the invitation to (if --no-email is set, email will just be saved)')
|
||||
self.parser.add_argument("-e", "--email", action="append", type=base.unicode_decoder, default=[], help='email(s) to send the invitation to')
|
||||
self.parser.add_argument("-n", "--name", type=base.unicode_decoder, default='', help='name of the invitee')
|
||||
self.parser.add_argument("-N", "--host-name", type=base.unicode_decoder, default='', help='name of the host')
|
||||
self.parser.add_argument("-l", "--lang", type=base.unicode_decoder, default='', help='main language spoken by the invitee')
|
||||
|
|
@ -214,12 +214,15 @@ class InviteeInvite(base.CommandBase):
|
|||
|
||||
def start(self):
|
||||
common.checkURI(self.args)
|
||||
email = self.args.email[0] if self.args.email else None
|
||||
emails_extra = self.args.email[1:]
|
||||
|
||||
self.host.bridge.eventInvite(
|
||||
self.args.service,
|
||||
self.args.node,
|
||||
self.args.item,
|
||||
self.args.email,
|
||||
email,
|
||||
emails_extra,
|
||||
self.args.name,
|
||||
self.args.host_name,
|
||||
self.args.lang,
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import base
|
|||
from sat.core.i18n import _
|
||||
from sat_frontends.jp.constants import Const as C
|
||||
from sat.tools.common.ansi import ANSI as A
|
||||
from sat.tools.common import data_format
|
||||
from functools import partial
|
||||
|
||||
__commands__ = ["Invitation"]
|
||||
|
|
@ -38,7 +39,7 @@ class Create(base.CommandBase):
|
|||
self.parser.add_argument("-P", "--password", type=base.unicode_decoder, default='', help='password of the invitee profile/XMPP account (default: generate one)')
|
||||
self.parser.add_argument("-n", "--name", type=base.unicode_decoder, default='', help='name of the invitee')
|
||||
self.parser.add_argument("-N", "--host-name", type=base.unicode_decoder, default='', help='name of the host')
|
||||
self.parser.add_argument("-e", "--email", type=base.unicode_decoder, default='', help='email to send the invitation to (if --no-email is set, email will just be saved)')
|
||||
self.parser.add_argument("-e", "--email", action="append", type=base.unicode_decoder, default=[], help='email(s) to send the invitation to (if --no-email is set, email will just be saved)')
|
||||
self.parser.add_argument("--no-email", action="store_true", help='do NOT send invitation email')
|
||||
self.parser.add_argument("-l", "--lang", type=base.unicode_decoder, default='', help='main language spoken by the invitee')
|
||||
self.parser.add_argument("-u", "--url", type=base.unicode_decoder, default='', help='template to construct the URL')
|
||||
|
|
@ -58,20 +59,23 @@ class Create(base.CommandBase):
|
|||
|
||||
def start(self):
|
||||
extra = dict(self.args.extra)
|
||||
email = self.args.email
|
||||
email = self.args.email[0] if self.args.email else None
|
||||
emails_extra = self.args.email[1:]
|
||||
if self.args.no_email:
|
||||
if email:
|
||||
extra['email'] = email
|
||||
data_format.iter2dict(u'emails_extra', emails_extra)
|
||||
else:
|
||||
if not email:
|
||||
self.parser.error(_(u'you need to specify an email address to send email invitation'))
|
||||
|
||||
self.host.bridge.invitationCreate(
|
||||
email,
|
||||
emails_extra,
|
||||
self.args.jid,
|
||||
self.args.password,
|
||||
self.args.name,
|
||||
self.args.host_name,
|
||||
email,
|
||||
self.args.lang,
|
||||
self.args.url,
|
||||
self.args.subject,
|
||||
|
|
|
|||
Loading…
Reference in a new issue