mtproto 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/mtproto/tl/objects/updates_difference.rb +18 -2
- data/lib/mtproto/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ef5c11c5bf0b9bfe4f3b80e905270264b5658bc55a2932e92c945df8ba0dc723
|
|
4
|
+
data.tar.gz: 58fec06d053d66b52c382049e7fb917dbf0c4af2395c7f81f5dcb66d70778228
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b108736ec52172e501b8609b6c8b5596052b7fa80d72bfaa6cadb393baddbe89ec009148da487f3b8c16b9a6000e5bdea4aa5b15c77fd9ddd19ce43ae8db6763
|
|
7
|
+
data.tar.gz: 3268f1b6943ea7c470ee274a56cbc3e4d3c5a2aebff7e8b5b4522805e8a922756932cb396909650f520cb3153d75d8e34a61e5952916602421ed01df2b9e5c7e
|
|
@@ -99,7 +99,7 @@ module MTProto
|
|
|
99
99
|
|
|
100
100
|
offset = schema.skip(data, offset) if flags.anybits?(1 << 8) # from_id (Peer)
|
|
101
101
|
offset += 4 if flags.anybits?(1 << 29) # from_boosts_applied
|
|
102
|
-
offset =
|
|
102
|
+
peer_type, peer_id, offset = parse_peer(data, offset)
|
|
103
103
|
offset = schema.skip(data, offset) if flags.anybits?(1 << 28) # saved_peer_id
|
|
104
104
|
offset = schema.skip(data, offset) if flags.anybits?(1 << 2) # fwd_from
|
|
105
105
|
offset += 8 if flags.anybits?(1 << 11) # via_bot_id
|
|
@@ -110,7 +110,23 @@ module MTProto
|
|
|
110
110
|
offset += 4
|
|
111
111
|
message_text, = read_tl_string(data, offset)
|
|
112
112
|
|
|
113
|
-
{ id: id, date: date, message: message_text }
|
|
113
|
+
{ id: id, date: date, message: message_text, peer_type: peer_type, peer_id: peer_id }
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def parse_peer(data, offset)
|
|
117
|
+
constructor = data[offset, 4].unpack1('L<')
|
|
118
|
+
offset += 4
|
|
119
|
+
|
|
120
|
+
case constructor
|
|
121
|
+
when Constructors::PEER_USER
|
|
122
|
+
[:user, data[offset, 8].unpack1('Q<'), offset + 8]
|
|
123
|
+
when Constructors::PEER_CHAT
|
|
124
|
+
[:chat, data[offset, 8].unpack1('Q<'), offset + 8]
|
|
125
|
+
when Constructors::PEER_CHANNEL
|
|
126
|
+
[:channel, data[offset, 8].unpack1('Q<'), offset + 8]
|
|
127
|
+
else
|
|
128
|
+
raise "Unknown peer constructor: 0x#{constructor.to_s(16)}"
|
|
129
|
+
end
|
|
114
130
|
end
|
|
115
131
|
|
|
116
132
|
def read_tl_string(data, offset)
|
data/lib/mtproto/version.rb
CHANGED