Class: Mapi::Recipient

Inherits:
Item
  • Object
show all
Defined in:
lib/mapi.rb

Direct Known Subclasses

Msg::Recipient, Pst::Recipient

Constant Summary collapse

RECIPIENT_TYPES =
{ 0 => :orig, 1 => :to, 2 => :cc, 3 => :bcc }

Instance Attribute Summary

Attributes inherited from Item

#properties

Instance Method Summary collapse

Methods inherited from Item

#initialize

Constructor Details

This class inherits a constructor from Mapi::Item

Instance Method Details

#emailObject



61
62
63
# File 'lib/mapi.rb', line 61

def email
	props.smtp_address || props.org_email_addr || props.email_address
end

#inspectObject



78
79
80
# File 'lib/mapi.rb', line 78

def inspect
	"#<#{self.class.to_s[/\w+$/]}:#{self.to_s.inspect}>"
end

#nameObject

some kind of best effort guess for converting to standard mime style format. there are some rules for encoding non 7bit stuff in mail headers. should obey that here, as these strings could be unicode email_address will be an EX:/ address (X.400?), unless external recipient. the other two we try first. consider using entry id for this too.



55
56
57
58
59
# File 'lib/mapi.rb', line 55

def name
	name = props.transmittable_display_name || props.display_name
	# dequote
	name[/^'(.*)'/, 1] or name rescue nil
end

#to_sObject



70
71
72
73
74
75
76
# File 'lib/mapi.rb', line 70

def to_s
	if name = self.name and !name.empty? and email && name != email
		%{"#{name}" <#{email}>}
	else
		email || name
	end
end

#typeObject



66
67
68
# File 'lib/mapi.rb', line 66

def type
	RECIPIENT_TYPES[props.recipient_type]
end