zephyr_mirror: Fix handling of Humbug=>Zephyr personals.

(imported from commit 149f8aaf9076583499392bcb09a0250b05c3dea6)
This commit is contained in:
Tim Abbott 2012-12-08 12:59:57 -05:00
parent 94a553f0f1
commit bb80b86e25

View file

@ -462,9 +462,16 @@ def forward_to_zephyr(message):
zephyr_class = "message" zephyr_class = "message"
zwrite_args.extend(["-c", zephyr_class, "-i", instance]) zwrite_args.extend(["-c", zephyr_class, "-i", instance])
elif message['type'] == "private": elif message['type'] == "private":
if len(message['display_recipient']) <= 2: if len(message['display_recipient']) == 1:
recipient = to_zephyr_username(message["display_recipient"][0]["email"]) recipient = to_zephyr_username(message["display_recipient"][0]["email"])
zwrite_args.extend([recipient]) zwrite_args.extend([recipient])
elif len(message['display_recipient']) == 2:
recipient = ""
for r in message["display_recipient"]:
if r["email"].lower() != humbug_account_email.lower():
recipient = to_zephyr_username(r["email"])
break
zwrite_args.extend([recipient])
else: else:
zwrite_args.extend(["-C"]) zwrite_args.extend(["-C"])
zwrite_args.extend([to_zephyr_username(user["email"]).replace("@ATHENA.MIT.EDU", "") zwrite_args.extend([to_zephyr_username(user["email"]).replace("@ATHENA.MIT.EDU", "")