-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from srdjanmarjanovic/impromevent/parsers-and-c…
…leaners-improved Improve parse and add test email sources
- Loading branch information
Showing
31 changed files
with
7,125 additions
and
127 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
31 changes: 30 additions & 1 deletion
31
src/ActiveCollab/EmailReplyExtractor/Extractor/AndroidMailExtractor.php
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,37 @@ | ||
<?php | ||
namespace ActiveCollab\EmailReplyExtractor\Extractor; | ||
|
||
|
||
/** | ||
* @package ActiveCollab\EmailReplyExtractor\Extractor | ||
*/ | ||
final class AndroidMailExtractor extends Extractor | ||
{ | ||
/** | ||
* Extract Reply from Android mail | ||
*/ | ||
protected function processLines() | ||
{ | ||
parent::processLines(); | ||
|
||
list ($unwanted_text, $cut_line) = self::getLinesFromEnd(1); | ||
$unwanted_text = implode(null, $unwanted_text); | ||
|
||
// strip 'first name last name wrote:' | ||
if (preg_match('/(.*?)wrote:/is', $unwanted_text)) { | ||
$this->body = array_splice($this->body, 0, $cut_line); | ||
} | ||
|
||
// default signature | ||
$match_string = '^sent from(.*?)'; | ||
// strip default signature | ||
if ($match_string) { | ||
list ($default_signature, $cut_line) = self::getLinesFromEnd(1); | ||
$default_signature = implode(null, $default_signature); | ||
if (preg_match('/' . $match_string . '/is', $default_signature)) { | ||
$this->body= array_splice($this->body, 0, $cut_line); | ||
} | ||
} | ||
|
||
$this->stripSignature(); | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
11 changes: 11 additions & 0 deletions
11
src/ActiveCollab/EmailReplyExtractor/Extractor/MailRuMailExtractor.php
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
namespace ActiveCollab\EmailReplyExtractor\Extractor; | ||
|
||
/** | ||
* Class MailRuMail | ||
* | ||
* @package ActiveCollab\EmailReplyExtractor\Extractor | ||
*/ | ||
final class MailRuMailExtractor extends Extractor | ||
{ | ||
} |
22 changes: 22 additions & 0 deletions
22
src/ActiveCollab/EmailReplyExtractor/Extractor/OutlookExpressExtractor.php
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
namespace ActiveCollab\EmailReplyExtractor\Extractor; | ||
|
||
/** | ||
* @package ActiveCollab\EmailReplyExtractor\Extractor | ||
*/ | ||
final class OutlookExpressExtractor extends Extractor | ||
{ | ||
|
||
/** | ||
* Return original message splitters | ||
* | ||
* @return array | ||
*/ | ||
protected function getOriginalMessageSplitters() | ||
{ | ||
return array_merge(parent::getOriginalMessageSplitters(), [ | ||
'/\-------------------------/is', | ||
]); | ||
} | ||
|
||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +0,0 @@ | ||
*.eml | ||
Oops, something went wrong.