1
0
مراية لـ https://github.com/postalserver/postal.git تم المزامنة 2026-01-20 14:49:53 +00:00

initial commit from appmail

هذا الالتزام موجود في:
Adam Cooke
2017-04-19 13:07:25 +01:00
الأصل a3eff53792
التزام 2fdba0ceb5
474 ملفات معدلة مع 51228 إضافات و0 حذوفات

عرض الملف

@@ -0,0 +1,33 @@
module Postal
class ReplySeparator
RULES = [
/^-{2,10} $.*/m,
/^\>*\s*----- ?Original Message ?-----.*/m,
/^\>*\s*From\:[^\r\n]*[\r\n]+Sent\:.*/m,
/^\>*\s*From\:[^\r\n]*[\r\n]+Date\:.*/m,
/^\>*\s*-----Urspr.ngliche Nachricht----- .*/m,
/^\>*\s*Le[^\r\n]{10,200}a .crit ?\:\s*$.*/,
/^\>*\s*__________________.*/m,
/^\>*\s*On.{10,200}wrote:\s*$.*/m,
/^\>*\s*Sent from my.*/m,
/^\>*\s*=== Please reply above this line ===.*/m,
/(^\>.*\n?){10,}/,
]
def self.separate(text)
return '' unless text.is_a?(String)
text = text.gsub("\r", '')
stripped = ""
RULES.each do |rule|
text.gsub!(rule) do
stripped = $&.to_s + "\n" + stripped
''
end
end
stripped = stripped.strip
[text.strip, stripped.blank? ? nil : stripped]
end
end
end