Class: Java::ComPff::PSTMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/pst/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#folderObject

Returns the value of attribute folder.



102
103
104
# File 'lib/pst/base.rb', line 102

def folder
  @folder
end

Instance Method Details

#calculated_recipients_stringObject



173
174
175
# File 'lib/pst/base.rb', line 173

def calculated_recipients_string
  self.recipients.collect{|r| r.pretty_string}.join(", ")
end

#contentsObject



159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/pst/base.rb', line 159

def contents
  # this is because [Pff::PSTContact, Pff::PSTTask, Pff::PSTActivity, Pff::PSTRss]
  # are all PSTMessages but they throw a npe if you call getBody
  begin
    return self.getBody
  rescue
  end
  begin
    return self.toString
  rescue
  end
  raise "no contents found in #{self}"
end

#hash_stringObject



125
126
127
# File 'lib/pst/base.rb', line 125

def hash_string
  Digest::SHA1.hexdigest(human_id)
end

#human_idObject

things to pay attention to next.getDescriptorNode().descriptorIdentifier+“”; next.getSentRepresentingName() + “ <”+ next.getSentRepresentingEmailAddress() “>”; next.getReceivedByName() “ <”+next.getReceivedByAddress()+“>” + next.displayTo(); next.getClientSubmitTime();



121
122
123
# File 'lib/pst/base.rb', line 121

def human_id
  "%s:%s:%s:%s" % [ folder.human_id, self.getClientSubmitTime.to_s, self.getInternetMessageId, self.subject ]
end

#pretty_stringObject



129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/pst/base.rb', line 129

def pretty_string
  "[%s] %s - %s <%s> %s <%s> %s %s a:%s" % [
        self.getDescriptorNode.descriptorIdentifier,
        self.getSubject,
        self.getSentRepresentingName,
        self.getSentRepresentingEmailAddress,
        self.getReceivedByName,
        self.getReceivedByAddress,
        self.displayTo,
        self.getClientSubmitTime,
        self.hasAttachments]
end

#recipientsObject



142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/pst/base.rb', line 142

def recipients
  recip = []
  #Enumerator.new do |yielder|
    i = 0
    while i < self.getNumberOfRecipients
      recipient = self.getRecipient(i)
      recip << recipient
      i = i + 1
    end
  #end
  recip
end

#recipients_stringObject



177
178
179
180
181
182
183
184
# File 'lib/pst/base.rb', line 177

def recipients_string
  orig = self.getRecipientsString
  if orig == "No recipients table!"
    calculated_recipients_string
  else
    orig
  end
end

#sent_atObject



155
156
157
# File 'lib/pst/base.rb', line 155

def sent_at
  self.getClientSubmitTime.andand.to_time
end