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)
This commit is contained in:
parent
f45a8bebf2
commit
b081d2fa5a
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue