Created
June 25, 2014 00:17
-
-
Save yiding/0ac7d4eddb07bd914090 to your computer and use it in GitHub Desktop.
Imapfilter function to move all notifications related to phabricator notifications to a different folder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pruneCommittedDiffs(mailbox, dest_mailbox) | |
diff_set = mailbox:contain_subject('[Differential]') | |
committed_diff_set = diff_set:contain_field('X-Phabricator-Mail-Tags', '<differential-committed>') | |
for _, message in ipairs(committed_diff_set) do | |
mmbox, uid = table.unpack(message) | |
rev_key = string.gsub(mmbox[uid]:fetch_field('In-Reply-To'), 'In%-Reply%-To: ', '') | |
all_diff_msgs = diff_set:contain_field('In-Reply-To', rev_key) + diff_set:contain_field('Message-ID', rev_key) | |
all_diff_msgs:move_messages(dest_mailbox) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment