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 17a0246b0b
commit 2d1e072896
1 changed files with 8 additions and 1 deletions

View File

@ -462,9 +462,16 @@ def forward_to_zephyr(message):
zephyr_class = "message"
zwrite_args.extend(["-c", zephyr_class, "-i", instance])
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"])
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:
zwrite_args.extend(["-C"])
zwrite_args.extend([to_zephyr_username(user["email"]).replace("@ATHENA.MIT.EDU", "")