lib/mapi/msg.rb
def parse_properties obj
				data = obj.read
				# don't really understand this that well...
				
				pad = data.length % 16
				unless (pad == 0 || pad == 8) and data[0...pad] == "\000" * pad
					Log.warn "padding was not as expected #{pad} (#{data.length}) -> #{data[0...pad].inspect}"
				end
				# Scan using an ascii pattern - it's binary data we're looking
				# at, so we don't want to look for unicode characters
				data[pad..-1].scan(/.{16}/mn).each do |data|
					property, encoding = ('%08x' % data.unpack('V')).scan /.{4}/
					key = property.hex
					# doesn't make any sense to me. probably because its a serialization of some internal
					# outlook structure...
					next if property == '0000'
					case encoding
					when '0102', '001e', '001f', '101e', '101f', '000d'
						# ignore on purpose. not sure what its for
						# multivalue versions ignored also
					when '0003' # long
						# don't know what all the other data is for
						add_property key, *data[8, 4].unpack('V')
					when '000b' # boolean
						# again, heaps more data than needed. and its not always 0 or 1.
						# they are in fact quite big numbers. this is wrong.
# 					p [property, data[4..-1].unpack('H*')[0]]
						add_property key, data[8, 4].unpack('V')[0] != 0
					when '0040' # systime
						# seems to work:
						add_property key, Ole::Types.load_time(data[8..-1])
					else
						#Log.warn "ignoring data in __properties section, encoding: #{encoding}"
						#Log << data.unpack('H*').inspect + "\n"
					end
				end
			end
# For parsing the +properties+ file. Smaller properties are serialized in one chunk,
# such as longs, bools, times etc. The parsing has problems.
For parsing the +properties+ file. Smaller properties are serialized in one chunk,
such as longs, bools, times etc. The parsing has problems.
For parsing the + properties + file . Smaller properties are serialized in one chunk such as longs bools times etc . The parsing has problems .
def parse_properties obj
				data = obj.read
				pad = data.length % 16
				unless (pad == 0 || pad == 8) and data[0...pad] == "\000" * pad
					Log.warn "padding was not as expected #{pad} (#{data.length}) -> #{data[0...pad].inspect}"
				end
				data[pad..-1].scan(/.{16}/mn).each do |data|
					property, encoding = ('%08x' % data.unpack('V')).scan /.{4}/
					key = property.hex
					next if property == '0000'
					case encoding
					when '0102', '001e', '001f', '101e', '101f', '000d'
					when '0003' 
						add_property key, *data[8, 4].unpack('V')
					when '000b' 
						add_property key, data[8, 4].unpack('V')[0] != 0
					when '0040' 
						add_property key, Ole::Types.load_time(data[8..-1])
					else
					end
				end
			end
def parse_properties obj data = obj . read pad = data . length % 16 unless ( pad == 0 || pad == 8 ) and data [ 0 ... pad ] == "\000" * pad Log . warn "padding was not as expected #{pad} (#{data.length}) -> #{data[0...pad].inspect}" end data [ pad .. - 1 ] . scan ( / .{16} /mn ) . each do | data | property , encoding = ( '%08x' % data . unpack ( 'V' ) ) . scan / .{4} / key = property . hex next if property == '0000' case encoding when '0102' , '001e' , '001f' , '101e' , '101f' , '000d' when '0003' add_property key , * data [ 8 , 4 ] . unpack ( 'V' ) when '000b' add_property key , data [ 8 , 4 ] . unpack ( 'V' ) [ 0 ] != 0 when '0040' add_property key , Ole :: Types . load_time ( data [ 8 .. - 1 ] ) else end end end
For parsing the +properties+ file.
For parsing the + properties + file .
# don't really understand this that well... # Scan using an ascii pattern - it's binary data we're looking # at, so we don't want to look for unicode characters # doesn't make any sense to me. probably because its a serialization of some internal # outlook structure... # ignore on purpose. not sure what its for # multivalue versions ignored also # long # don't know what all the other data is for # boolean # again, heaps more data than needed. and its not always 0 or 1. # they are in fact quite big numbers. this is wrong. # 					p [property, data[4..-1].unpack('H*')[0]] # systime # seems to work: #Log.warn "ignoring data in __properties section, encoding: #{encoding}" #Log << data.unpack('H*').inspect + "\n"
obj