Merge pull request #135 from esetnik/polymail_support
Polymail Quote Support
This commit is contained in:
@@ -146,6 +146,14 @@ RE_ANDROID_WROTE = re.compile(u'[\s]*[-]+.*({})[ ]*[-]+'.format(
|
|||||||
'wrote'
|
'wrote'
|
||||||
))), re.I)
|
))), re.I)
|
||||||
|
|
||||||
|
# Support polymail.io reply format
|
||||||
|
# On Tue, Apr 11, 2017 at 10:07 PM John Smith
|
||||||
|
#
|
||||||
|
# <
|
||||||
|
# mailto:John Smith <johnsmith@gmail.com>
|
||||||
|
# > wrote:
|
||||||
|
RE_POLYMAIL = re.compile('On.*\s{2}<\smailto:.*\s> wrote:', re.I)
|
||||||
|
|
||||||
SPLITTER_PATTERNS = [
|
SPLITTER_PATTERNS = [
|
||||||
RE_ORIGINAL_MESSAGE,
|
RE_ORIGINAL_MESSAGE,
|
||||||
RE_ON_DATE_SMB_WROTE,
|
RE_ON_DATE_SMB_WROTE,
|
||||||
@@ -162,7 +170,8 @@ SPLITTER_PATTERNS = [
|
|||||||
'( \S+){3,6}@\S+:'),
|
'( \S+){3,6}@\S+:'),
|
||||||
# Sent from Samsung MobileName <address@example.com> wrote:
|
# Sent from Samsung MobileName <address@example.com> wrote:
|
||||||
re.compile('Sent from Samsung .*@.*> wrote'),
|
re.compile('Sent from Samsung .*@.*> wrote'),
|
||||||
RE_ANDROID_WROTE
|
RE_ANDROID_WROTE,
|
||||||
|
RE_POLYMAIL
|
||||||
]
|
]
|
||||||
|
|
||||||
RE_LINK = re.compile('<(http://[^>]*)>')
|
RE_LINK = re.compile('<(http://[^>]*)>')
|
||||||
@@ -170,7 +179,7 @@ RE_NORMALIZED_LINK = re.compile('@@(http://[^>@]*)@@')
|
|||||||
|
|
||||||
RE_PARENTHESIS_LINK = re.compile("\(https?://")
|
RE_PARENTHESIS_LINK = re.compile("\(https?://")
|
||||||
|
|
||||||
SPLITTER_MAX_LINES = 4
|
SPLITTER_MAX_LINES = 6
|
||||||
MAX_LINES_COUNT = 1000
|
MAX_LINES_COUNT = 1000
|
||||||
# an extensive research shows that exceeding this limit
|
# an extensive research shows that exceeding this limit
|
||||||
# leads to excessive processing time
|
# leads to excessive processing time
|
||||||
|
|||||||
@@ -35,6 +35,19 @@ On 11-Apr-2011, at 6:54 PM, Roman Tkachenko <romant@example.com> wrote:
|
|||||||
|
|
||||||
eq_("Test reply", quotations.extract_from_plain(msg_body))
|
eq_("Test reply", quotations.extract_from_plain(msg_body))
|
||||||
|
|
||||||
|
def test_pattern_on_date_polymail():
|
||||||
|
msg_body = """Test reply
|
||||||
|
|
||||||
|
On Tue, Apr 11, 2017 at 10:07 PM John Smith
|
||||||
|
|
||||||
|
<
|
||||||
|
mailto:John Smith <johnsmith@gmail.com>
|
||||||
|
> wrote:
|
||||||
|
Test quoted data
|
||||||
|
"""
|
||||||
|
|
||||||
|
eq_("Test reply", quotations.extract_from_plain(msg_body))
|
||||||
|
|
||||||
|
|
||||||
def test_pattern_sent_from_samsung_smb_wrote():
|
def test_pattern_sent_from_samsung_smb_wrote():
|
||||||
msg_body = """Test reply
|
msg_body = """Test reply
|
||||||
|
|||||||
Reference in New Issue
Block a user