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.



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

def folder
  @folder
end

Instance Method Details

#calculated_recipients_stringObject



196
197
198
# File 'lib/pst/base.rb', line 196

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

#contentsObject



182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/pst/base.rb', line 182

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



148
149
150
# File 'lib/pst/base.rb', line 148

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

#headersObject



209
210
211
212
213
214
215
216
217
218
# File 'lib/pst/base.rb', line 209

def headers
  @headers ||= begin
    hstr = self.getTransportMessageHeaders
    hstr.split("\n").inject({}){|acc, line|
      key,value = line.split(":", 2)
      acc[key] = value.strip if value
      acc
    }
  end
end

#human_idObject



144
145
146
# File 'lib/pst/base.rb', line 144

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

#human_senderObject

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



140
141
142
# File 'lib/pst/base.rb', line 140

def human_sender
  "%s <%s>" % [sender_name, sender_email]
end

#pretty_stringObject



152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/pst/base.rb', line 152

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



165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/pst/base.rb', line 165

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



200
201
202
203
204
205
206
207
# File 'lib/pst/base.rb', line 200

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

#sent_atObject



178
179
180
# File 'lib/pst/base.rb', line 178

def sent_at
  self.getClientSubmitTime.andand.to_time
end

#thread_indexObject



224
225
226
# File 'lib/pst/base.rb', line 224

def thread_index
  self.headers["Thread-Index"]
end

#thread_topicObject



220
221
222
# File 'lib/pst/base.rb', line 220

def thread_topic
  self.headers["Thread-Topic"]
end