fixes mailgun/talon#19
This commit is contained in:
@@ -137,11 +137,16 @@ RE_FROM_COLON_OR_DATE_COLON = re.compile(u'(_+\r?\n)?[\s]*(:?[*]?{})[\s]?:[*]? .
|
||||
|
||||
SPLITTER_PATTERNS = [
|
||||
RE_ORIGINAL_MESSAGE,
|
||||
# <date> <person>
|
||||
re.compile("(\d+/\d+/\d+|\d+\.\d+\.\d+).*@", re.S),
|
||||
RE_ON_DATE_SMB_WROTE,
|
||||
RE_ON_DATE_WROTE_SMB,
|
||||
RE_FROM_COLON_OR_DATE_COLON,
|
||||
# 02.04.2012 14:20 пользователь "bob@example.com" <
|
||||
# bob@xxx.mailgun.org> написал:
|
||||
re.compile("(\d+/\d+/\d+|\d+\.\d+\.\d+).*@", re.S),
|
||||
# 2014-10-17 11:28 GMT+03:00 Bob <
|
||||
# bob@example.com>:
|
||||
re.compile("\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}\s+GMT.*@", re.S),
|
||||
# Thu, 26 Jun 2014 14:00:51 +0400 Bob <bob@example.com>:
|
||||
re.compile('\S{3,10}, \d\d? \S{3,10} 20\d\d,? \d\d?:\d\d(:\d\d)?'
|
||||
'( \S+){3,6}@\S+:')
|
||||
]
|
||||
|
||||
@@ -54,6 +54,18 @@ On 04/19/2011 07:10 AM, Roman Tkachenko wrote:
|
||||
eq_("Test reply", quotations.extract_from_plain(msg_body))
|
||||
|
||||
|
||||
def test_date_time_email_splitter():
|
||||
msg_body = """Test reply
|
||||
|
||||
2014-10-17 11:28 GMT+03:00 Postmaster <
|
||||
postmaster@sandboxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.mailgun.org>:
|
||||
|
||||
> First from site
|
||||
>
|
||||
"""
|
||||
eq_("Test reply", quotations.extract_from_plain(msg_body))
|
||||
|
||||
|
||||
def test_pattern_on_date_somebody_wrote_allows_space_in_front():
|
||||
msg_body = """Thanks Thanmai
|
||||
On Mar 8, 2012 9:59 AM, "Example.com" <
|
||||
|
||||
Reference in New Issue
Block a user