Class: MTProto::Type::CodeSettings

Inherits:
Object
  • Object
show all
Defined in:
lib/mtproto/type/code_settings.rb

Constant Summary collapse

CONSTRUCTOR =
0xad253d78

Class Method Summary collapse

Class Method Details

.serialize(settings = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/mtproto/type/code_settings.rb', line 8

def self.serialize(settings = {})
  body = Serializer.serialize_int(CONSTRUCTOR)

  flags = 0
  flags |= (1 << 0) if settings[:allow_flashcall]
  flags |= (1 << 1) if settings[:current_number]
  flags |= (1 << 4) if settings[:allow_app_hash]
  flags |= (1 << 5) if settings[:allow_missed_call]
  flags |= (1 << 7) if settings[:allow_firebase]
  flags |= (1 << 9) if settings[:unknown_number]

  body += Serializer.serialize_int(flags)

  body
end