From bb80b86e255bda602581517b84b5327859624893 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Sat, 8 Dec 2012 12:59:57 -0500 Subject: [PATCH] zephyr_mirror: Fix handling of Humbug=>Zephyr personals. (imported from commit 149f8aaf9076583499392bcb09a0250b05c3dea6) --- bots/zephyr_mirror_backend.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bots/zephyr_mirror_backend.py b/bots/zephyr_mirror_backend.py index ce42116..a478611 100755 --- a/bots/zephyr_mirror_backend.py +++ b/bots/zephyr_mirror_backend.py @@ -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", "")