From b081d2fa5a6aacc24ae44a19ec39e0eb3f1d3bb3 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Mon, 26 Nov 2012 18:54:21 -0500 Subject: [PATCH] zephyr_mirror: Reorder process_notice to log fewer "Skipping" messages. Previously, we were sending "Skipping message we got from Humbug!" for messages we wouldn't have forwarded anyway. (imported from commit 36df85a61336ac00e3d7913d5a417d6b42764350) --- bots/zephyr_mirror_backend.py | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/bots/zephyr_mirror_backend.py b/bots/zephyr_mirror_backend.py index cff723d..da2370d 100755 --- a/bots/zephyr_mirror_backend.py +++ b/bots/zephyr_mirror_backend.py @@ -237,25 +237,11 @@ def process_notice(notice, log): # skip PING messages return - if notice.format.endswith("@(@color(blue))"): - logger.debug("Skipping message we got from Humbug!") - return - zephyr_class = notice.cls.lower() - if (zephyr_class == "message" and notice.recipient != ""): + if ((zephyr_class == "message" and notice.recipient != "") or + (zephyr_class == "mail" and notice.instance.lower() == "inbox")): is_personal = True - if body.startswith("CC:"): - is_huddle = True - # Map "CC: sipbtest espuser" => "starnine@mit.edu,espuser@mit.edu" - huddle_recipients = [to_humbug_username(x.strip()) for x in - body.split("\n")[0][4:].split()] - if notice.sender not in huddle_recipients: - huddle_recipients.append(to_humbug_username(notice.sender)) - body = body.split("\n", 1)[1] - if (zephyr_class == "mail" and notice.instance.lower() == "inbox"): - is_personal = True - # Drop messages not to the listed subscriptions if is_personal and not options.forward_personals: return @@ -264,6 +250,19 @@ def process_notice(notice, log): logger.debug("Skipping ... %s/%s/%s" % (zephyr_class, notice.instance, is_personal)) return + if notice.format.endswith("@(@color(blue))"): + logger.debug("Skipping message we got from Humbug!") + return + + if is_personal: + if body.startswith("CC:"): + is_huddle = True + # Map "CC: sipbtest espuser" => "starnine@mit.edu,espuser@mit.edu" + huddle_recipients = [to_humbug_username(x.strip()) for x in + body.split("\n")[0][4:].split()] + if notice.sender not in huddle_recipients: + huddle_recipients.append(to_humbug_username(notice.sender)) + body = body.split("\n", 1)[1] zeph = { 'time' : str(notice.time), 'sender' : notice.sender,