Class: Mapi::Recipient

Inherits:
Item
  • Object
show all
Defined in:
lib/mapi/base.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



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

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

#inspectObject



74
75
76
# File 'lib/mapi/base.rb', line 74

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.



51
52
53
54
55
# File 'lib/mapi/base.rb', line 51

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

#to_sObject



66
67
68
69
70
71
72
# File 'lib/mapi/base.rb', line 66

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

#typeObject



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

def type
  RECIPIENT_TYPES[props.recipient_type]
end