Class Redwood::Message
In: lib/sup/message.rb
Parent: Object

a Message is what‘s threaded.

it is also where the parsing for quotes and signatures is done, but that should be moved out to a separate class at some point (because i would like, for example, to be able to add in a ruby-talk specific module that would detect and link to /ruby-talk:\d+/ sequences in the text of an email. (how sweet would that be?)

this class catches all source exceptions. if the underlying source throws an error, it is caught and handled.

Methods

Constants

SNIPPET_LEN = 80
RE_PATTERN = /^((re|re[\[\(]\d[\]\)]):\s*)+/i
QUOTE_PATTERN = /^\s{0,4}[>|\}]/
BLOCK_QUOTE_PATTERN = /^-----\s*Original Message\s*----+$/
SIG_PATTERN = /(^-- ?$)|(^\s*----------+\s*$)|(^\s*_________+\s*$)|(^\s*--~--~-)|(^\s*--\+\+\*\*==)/
MAX_SIG_DISTANCE = 15
DEFAULT_SUBJECT = ""
DEFAULT_SENDER = "(missing sender)"
MAX_HEADER_VALUE_SIZE = 4096

Attributes

attachments  [R] 
bcc  [R] 
cc  [R] 
date  [R] 
from  [R] 
id  [R] 
labels  [R] 
list_address  [R] 
list_subscribe  [R] 
list_unsubscribe  [R] 
recipient_email  [R] 
refs  [R] 
replyto  [R] 
replytos  [R] 
snippet  [R] 
source  [R] 
source_info  [R] 
subj  [R] 
to  [R] 

Public Class methods

if you specify a :header, will use values from that. otherwise, will try and load the header from the source.

Public Instance methods

returns all the content from a message that will be indexed

Expected index entry format: :message_id, :subject => String :date => Time :refs, :replytos => Array of String :from => Person :to, :cc, :bcc => Array of Person

this is called when the message body needs to actually be loaded.

sanitize message ids by removing spaces and non-ascii characters. also, truncate to 255 characters. all these steps are necessary to make ferret happy. of course, we probably fuck up a couple valid message ids as well. as long as we‘re consistent, this should be fine, though.

also, mostly the message ids that are changed by this belong to spam email.

an alternative would be to SHA1 or MD5 all message ids on a regular basis. don‘t tempt me.

wrap any source methods that might throw sourceerrors

[Validate]