30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/rcs-common/evidence/chat.rb', line 30
def decode_from_to(common_info, stream)
tm = stream.read 36
info = Hash[common_info]
info[:da] = Time.gm(*(tm.unpack('L*')), 0)
info[:data] = Hash.new if info[:data].nil?
program = stream.read(4).unpack('L').first
info[:data][:program] = CHAT_PROGRAM[program]
flags = stream.read(4).unpack('L').first
info[:data][:incoming] = (flags & CHAT_INCOMING != 0) ? 1 : 0
info[:data][:size] = (flags & CHATMM_NOT_RETRIEVED != 0) ? 0 : 1
from = stream.read_utf16le_string
info[:data][:from] = from.utf16le_to_utf8
from_display = stream.read_utf16le_string
info[:data][:from_display] = from_display.utf16le_to_utf8
rcpt = stream.read_utf16le_string
info[:data][:rcpt] = rcpt.utf16le_to_utf8
recipients = info[:data][:rcpt].split(',')
recipients.delete(info[:data][:from])
info[:data][:rcpt] = recipients.join(',')
rcpt_display = stream.read_utf16le_string
info[:data][:rcpt_display] = rcpt_display.utf16le_to_utf8
if info[:data][:program] == :skype
recipients = info[:data][:rcpt_display].split(',')
recipients.delete(info[:data][:from])
info[:data][:rcpt_display] = recipients.join(',')
end
return info
end
|