Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/metamta/parser/PhabricatorMetaMTAEmailBodyParser.php b/src/applications/metamta/parser/PhabricatorMetaMTAEmailBodyParser.php
index dd07422bcb..4b2b5a398c 100644
--- a/src/applications/metamta/parser/PhabricatorMetaMTAEmailBodyParser.php
+++ b/src/applications/metamta/parser/PhabricatorMetaMTAEmailBodyParser.php
@@ -1,48 +1,54 @@
<?php
/*
- * Copyright 2011 Facebook, Inc.
+ * Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
final class PhabricatorMetaMTAEmailBodyParser {
public function __construct($corpus) {
$this->corpus = $corpus;
}
public function stripQuotedText() {
$body = $this->corpus;
$body = preg_replace(
'/^\s*On\b.*\bwrote:.*?/msU',
'',
$body);
// Outlook english
$body = preg_replace(
'/^\s*-----Original Message-----.*?/msU',
'',
$body);
// Outlook danish
$body = preg_replace(
'/^\s*-----Oprindelig Meddelelse-----.*?/msU',
'',
$body);
+ // HTC Mail application (mobile)
+ $body = preg_replace(
+ '/^\s*Sent from my HTC smartphone.*?/msU',
+ '',
+ $body);
+
return rtrim($body);
}
}
diff --git a/src/applications/metamta/parser/__tests__/PhabricatorMetaMTAEmailBodyParserTestCase.php b/src/applications/metamta/parser/__tests__/PhabricatorMetaMTAEmailBodyParserTestCase.php
index a7f1a87fa3..a85ec1f3e2 100644
--- a/src/applications/metamta/parser/__tests__/PhabricatorMetaMTAEmailBodyParserTestCase.php
+++ b/src/applications/metamta/parser/__tests__/PhabricatorMetaMTAEmailBodyParserTestCase.php
@@ -1,80 +1,92 @@
<?php
/*
- * Copyright 2011 Facebook, Inc.
+ * Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
final class PhabricatorMetaMTAEmailBodyParserTestCase
extends PhabricatorTestCase {
public function testQuotedTextStripping() {
$bodies = $this->getEmailBodies();
foreach ($bodies as $body) {
$parser = new PhabricatorMetaMTAEmailBodyParser($body);
$stripped = $parser->stripQuotedText();
$this->assertEqual("OKAY", $stripped);
}
}
private function getEmailBodies() {
return array(
<<<EOEMAIL
OKAY
On May 30, 2011, at 8:36 PM, Someone wrote:
> ...
EOEMAIL
,
<<<EOEMAIL
OKAY
On Fri, May 27, 2011 at 9:39 AM, Someone <
somebody@somewhere.com> wrote:
> ...
EOEMAIL
,
<<<EOEMAIL
OKAY
On Fri, May 27, 2011 at 9:39 AM, Someone
<somebody@somewhere.com> wrote:
> ...
EOEMAIL
,
<<<EOEMAIL
OKAY
-----Oprindelig Meddelelse-----
> ...
EOEMAIL
,
<<<EOEMAIL
OKAY
-----Original Message-----
+> ...
+EOEMAIL
+,
+<<<EOEMAIL
+OKAY
+
+Sent from my HTC smartphone on the Now Network from Sprint!
+
+-Reply message ----- From: "somebody (someone)" <
+somebody@somewhere.com>
+To: <somebody@somewhere.com>
+Subject: Some Text Date: Mon, Apr 2, 2012 1:42 pm
> ...
EOEMAIL
);
}
}

File Metadata

Mime Type
text/x-diff
Expires
Sat, Sep 20, 3:58 AM (14 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
241408
Default Alt Text
(3 KB)

Event Timeline