zephyr_mirror: Don't try to forward Humbug cross-realm messages to Zephyr.

(imported from commit b14174d79c88dcaec57207cd8467aa14d9cf02ba)
This commit is contained in:
Tim Abbott 2012-11-02 18:13:48 -04:00
parent 54ce5be16d
commit c68fb1f5ae

View file

@ -391,7 +391,16 @@ def forward_to_zephyr(message):
p.communicate(input=wrapped_content) p.communicate(input=wrapped_content)
def maybe_forward_to_zephyr(message): 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") timestamp_now = datetime.datetime.now().strftime("%s")
if float(message["timestamp"]) < float(timestamp_now) - 15: if float(message["timestamp"]) < float(timestamp_now) - 15:
print "%s humbug=>zephyr: Alert! Out of order message: %s < %s" % \ print "%s humbug=>zephyr: Alert! Out of order message: %s < %s" % \