mtproto 0.0.22 → 0.0.23
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/client.rb +5 -0
- data/lib/mtproto/tl/objects/dialogs.rb +2 -1
- data/lib/mtproto/tl/objects/messages.rb +12 -7
- 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: 588068f442e55e82abc279cf1ecef97f1e3f56f0581fc8517406ce81099cfcd2
|
|
4
|
+
data.tar.gz: a466aecbfee4bc2a65c446239efe714415f550b5e5ece284a745c51f02ec8c71
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ab22ca4cc54eb0ee73bcdbb9a44ce0327e5464729def798644436058b1aaf63051c6c78474848c38e09dc9aab06bd7a5b2c91e460bf3a615e980b052d414e62d
|
|
7
|
+
data.tar.gz: 5ad6d73a68a47b04482e5c56731f47a5eadbb265a90065a9720f04370967fcb20187885867108e8f2dc6009a3d9acb83f0942017942f8b73129497a3f5152d6b
|
data/lib/mtproto/client.rb
CHANGED
|
@@ -354,6 +354,11 @@ module MTProto
|
|
|
354
354
|
constructor = response_body[0, 4].unpack1('L<')
|
|
355
355
|
|
|
356
356
|
case constructor
|
|
357
|
+
when TL::Constructors::GZIP_PACKED
|
|
358
|
+
# The server gzips larger payloads (notably busy channels' update
|
|
359
|
+
# containers) at the top level too, not only inside rpc_result. Inflate
|
|
360
|
+
# and re-route the inner message, or these updates are silently dropped.
|
|
361
|
+
process_message(TL::GzipPacked.unpack(response_body), server_msg_id)
|
|
357
362
|
when TL::Constructors::MSG_CONTAINER
|
|
358
363
|
handle_container(response_body)
|
|
359
364
|
when TL::Constructors::RPC_RESULT
|
|
@@ -443,7 +443,8 @@ module MTProto
|
|
|
443
443
|
offset += 8 if flags2.anybits?(1 << 14) # bot_verification_icon
|
|
444
444
|
offset += 8 if flags2.anybits?(1 << 15) # send_paid_messages_stars
|
|
445
445
|
|
|
446
|
-
[{ id: id, first_name: first_name, last_name: last_name, username: username,
|
|
446
|
+
[{ id: id, first_name: first_name, last_name: last_name, username: username,
|
|
447
|
+
is_bot: flags.anybits?(1 << 14), access_hash: access_hash }, offset]
|
|
447
448
|
end
|
|
448
449
|
|
|
449
450
|
# --- TL string ---
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
require_relative '../schema'
|
|
4
4
|
require_relative 'message'
|
|
5
|
+
require_relative 'dialogs'
|
|
5
6
|
|
|
6
7
|
module MTProto
|
|
7
8
|
module TL
|
|
8
9
|
# A messages.messages / messagesSlice / channelMessages container (e.g. the
|
|
9
|
-
# messages.getHistory reply). Its messages are
|
|
10
|
+
# messages.getHistory / messages.getMessages reply). Its messages are
|
|
11
|
+
# TL::Message instances.
|
|
10
12
|
class Messages
|
|
11
13
|
MESSAGES_MESSAGES = 0x1d73e7ea
|
|
12
14
|
MESSAGES_SLICE = 0x5f206716
|
|
@@ -14,11 +16,13 @@ module MTProto
|
|
|
14
16
|
|
|
15
17
|
VALID_CONSTRUCTORS = [MESSAGES_MESSAGES, MESSAGES_SLICE, MESSAGES_CHANNEL].freeze
|
|
16
18
|
|
|
17
|
-
attr_reader :messages, :count
|
|
19
|
+
attr_reader :messages, :count, :users, :chats
|
|
18
20
|
|
|
19
|
-
def initialize(messages:, count: nil)
|
|
21
|
+
def initialize(messages:, count: nil, users: [], chats: [])
|
|
20
22
|
@messages = messages
|
|
21
23
|
@count = count
|
|
24
|
+
@users = users
|
|
25
|
+
@chats = chats
|
|
22
26
|
end
|
|
23
27
|
|
|
24
28
|
def slice?
|
|
@@ -64,12 +68,13 @@ module MTProto
|
|
|
64
68
|
|
|
65
69
|
messages, offset = parse_messages_vector(data, offset)
|
|
66
70
|
|
|
67
|
-
#
|
|
68
|
-
schema.skip_vector(data, offset) { |d, o| schema.skip(d, o) }
|
|
71
|
+
# topics:Vector<ForumTopic> precedes chats/users in all three constructors
|
|
72
|
+
offset = schema.skip_vector(data, offset) { |d, o| schema.skip(d, o) }
|
|
69
73
|
|
|
70
|
-
|
|
74
|
+
chats, offset = Dialogs.chats_at(data, offset)
|
|
75
|
+
users, = Dialogs.users_at(data, offset)
|
|
71
76
|
|
|
72
|
-
new(messages: messages, count: count)
|
|
77
|
+
new(messages: messages, count: count, users: users, chats: chats)
|
|
73
78
|
end
|
|
74
79
|
|
|
75
80
|
class << self
|
data/lib/mtproto/version.rb
CHANGED