From c68fb1f5ae31fa85b09dcfd40090aaa13a0d0710 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Fri, 2 Nov 2012 18:13:48 -0400 Subject: [PATCH] zephyr_mirror: Don't try to forward Humbug cross-realm messages to Zephyr. (imported from commit b14174d79c88dcaec57207cd8467aa14d9cf02ba) --- bots/zephyr_mirror.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bots/zephyr_mirror.py b/bots/zephyr_mirror.py index ce73e4b..3da5eb9 100755 --- a/bots/zephyr_mirror.py +++ b/bots/zephyr_mirror.py @@ -391,7 +391,16 @@ def forward_to_zephyr(message): p.communicate(input=wrapped_content) def maybe_forward_to_zephyr(message): - if message["sender_email"] == options.user + "@mit.edu": + if (message["sender_email"] == options.user + "@mit.edu"): + if not ((message["type"] == "stream") or + (message["type"] == "personal" and + message["display_recipient"]["email"].lower().endswith("mit.edu")) or + (message["type"] == "huddle" and + False not in [u["email"].lower().endswith("mit.edu") for u in + message["display_recipient"]])): + # Don't try forward personals/huddles with non-MIT users + # to MIT Zephyr. + return timestamp_now = datetime.datetime.now().strftime("%s") if float(message["timestamp"]) < float(timestamp_now) - 15: print "%s humbug=>zephyr: Alert! Out of order message: %s < %s" % \