Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

detect K-9 signatures #199

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions talon/signature/bruteforce.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
^sent[ ]([\S]*[ ])?from[ ]my[ ]BlackBerry.*$
|
^Enviado[ ]desde[ ]mi[ ]([\S]+[ ]){0,2}BlackBerry.*$
|
^[\S ]*?Android[\S ]*?K-9[\S ]*?\.[\S ]*?\.$
)
.*
)
Expand Down
15 changes: 13 additions & 2 deletions tests/signature/bruteforce_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def test_signature_separated_by_dashes():
eq_(('Wow. Awesome!', '--\nBob Smith'),
bruteforce.extract_signature(msg_body))


def test_signature_words():
msg_body = '''Hey!

Expand Down Expand Up @@ -82,7 +81,6 @@ def test_mailbox_for_iphone_signature():
eq_(("Blah", "Sent from Mailbox for iPhone"),
bruteforce.extract_signature(msg_body))


def test_line_starts_with_signature_word():
msg_body = '''Hey man!
Thanks for your attention.
Expand Down Expand Up @@ -134,6 +132,19 @@ def test_blackberry_signature():
eq_(('Blah', u'Enviado desde mi oficina móvil BlackBerry® de Telcel'),
bruteforce.extract_signature(msg_body))

def test_k9_signature():
msg_body = """Heeyyoooo.
--
Sent from my Android device with K-9 Mail. Please excuse my brevity."""
eq_(('Heeyyoooo.', msg_body[len('Heeyyoooo.\n'):]),
bruteforce.extract_signature(msg_body))

def test_french_k9_signature():
msg_body = """Heeyyoooo.
--
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté."""
eq_(('Heeyyoooo.', msg_body[len('Heeyyoooo.\n'):]),
bruteforce.extract_signature(msg_body))

@patch.object(bruteforce, 'get_delimiter', Mock(side_effect=Exception()))
def test_crash_in_extract_signature():
Expand Down