Ejemplo n.º 1
0
class LocationMessage(QuotedMessageMixin, MentionsMixin, BaseMessage):
    """
    Location message.
    """

    __default_data__ = {'type': MessageTypes.LOCATION}

    body = Base64Field()

    is_live = BooleanField(default=False)

    lat = FloatField()
    lng = FloatField()

    loc = StringIdField()
    accuracy = IntegerField()
    speed = IntegerField()
    degrees = FloatField()
    comment = StringIdField()
    sequence = DateTimeField()
    share_duration = TimedeltaField()
    duration = TimedeltaField()

    text = StringIdField()

    final_thumbnail = Base64Field()
    final_lat = FloatField()
    final_lng = FloatField()
    final_accuracy = IntegerField()
    final_speed = IntegerField()
    final_degrees = FloatField()
    final_time_offset = TimedeltaField()
Ejemplo n.º 2
0
class Participant(BaseModel):
    """
    Live location participant model.
    """

    accuracy = IntegerField()
    """
    Location accuracy in meters.
    """

    comment = StringIdField()
    """
    Comment sent with live location message.
    """

    degrees = FloatField()
    """
    User direction in degrees.
    """

    expiration = DateTimeField()
    """
    When live location will expire.
    """

    last_update = DateTimeField()
    """
    Last update timestamp.
    """

    lat = FloatField()
    """
    Latitude.
    """

    lng = FloatField()
    """
    Longitude.
    """

    msg = ModelField(model_class=BaseMessage)
    """
    Message used to start live location.
    """

    contact = ModelField(model_class=Contact)
    """
    Live location owner.
    """

    sequence = IntegerField()
    """
    Sequence number.
    """

    speed = IntegerField()
    """
Ejemplo n.º 3
0
class LocationMessage(QuotedMessageMixin, MentionsMixin, BaseMessage):
    body = Base64Field()

    lat = FloatField()
    lng = FloatField()
    loc = StringIdField()
    is_live = BooleanField(default=False)
    accuracy = IntegerField()
    speed = IntegerField()
    degrees = FloatField()
    comment = StringIdField()
    sequence = IntegerField()
    share_duration = IntegerField()
Ejemplo n.º 4
0
class StatusV3(BaseModel):
    """
    StatusV3 model
    """

    unread_count = IntegerField()
    """
    Unread statuses
    """

    expire_ts = DateTimeField()
    """
    Status expiration date
    """

    contact = ModelField(model_class=Contact)
    """
    Contact object
    """

    last_received_key = StringIdField()
    """
    Last encryption key received (¿?).
    """

    read_keys = HashMapField(field_type=StringIdField())
Ejemplo n.º 5
0
class DocumentMessage(QuotedMessageMixin, MentionsMixin, MediaMixin, BaseMessage):
    """
    Document message.
    """
    __default_data__ = {'type': MessageTypes.DOCUMENT}

    body = Base64Field()
    page_count = IntegerField()
Ejemplo n.º 6
0
class NotificationMessage(BaseMessage):
    # group notifications
    recipients = ArrayField(field_type=StringIdField())
    broadcast = BooleanField(default=False)
    multicast = BooleanField(default=False)

    url_text = StringIdField()
    url_number = IntegerField()
Ejemplo n.º 7
0
class MediaMixin(BaseModel):
    client_url = StringIdField()
    direct_path = StringIdField()
    mimetype = StringIdField()
    caption = StringIdField()
    filehash = StringIdField()
    size = IntegerField()
    media_key = StringIdField()

    is_unsent_media = BooleanField(default=False)
Ejemplo n.º 8
0
class LocationMessage(QuotedMessageMixin, MentionsMixin, BaseMessage):
    """
    Location message.
    """

    __default_data__ = {'type': MessageTypes.LOCATION}

    body = Base64Field()

    lat = FloatField()
    lng = FloatField()
    loc = StringIdField()
    is_live = BooleanField(default=False)
    accuracy = IntegerField()
    speed = IntegerField()
    degrees = FloatField()
    comment = StringIdField()
    sequence = IntegerField()
    share_duration = IntegerField()
Ejemplo n.º 9
0
class Chat(BaseModel):
    name = StringIdField()
    last_message_ts = DateTimeField(name='t')
    pin = IntegerField()
    unread_count = IntegerField()

    archive = BooleanField(default=False)
    change_number_new_jid = StringIdField()
    change_number_old_jid = StringIdField()
    contact = ModelField(model_class=Contact)
    group_metadata = ModelField(model_class=GroupMetadata)
    is_announce_grp_restrict = BooleanField(default=False)
    is_group = BooleanField(default=False)
    is_read_only = BooleanField(default=False)
    kind = StringIdField()

    last_received_key = StringIdField()
    modify_tag = StringIdField()
    mute_expiration = IntegerField()
    not_spam = BooleanField(default=False)
Ejemplo n.º 10
0
class MediaMixin(BaseModel):
    type = EnumField(enum_class=MessageTypes, read_only=True)

    client_url = StringIdField()
    direct_path = StringIdField()
    mimetype = StringIdField()
    caption = StringIdField()
    filehash = StringIdField()
    size = IntegerField()
    media_key = StringIdField()

    is_unsent_media = BooleanField(default=False)
Ejemplo n.º 11
0
class GroupNotificationMessage(BaseMessage):
    """
    Notification message.
    """
    __default_data__ = {'type': MessageTypes.GROUP_NOTIFICATION}

    # group notifications
    recipients = ArrayField(field_type=StringIdField())
    broadcast = BooleanField(default=False)
    multicast = BooleanField(default=False)

    url_text = StringIdField()
    url_number = IntegerField()
Ejemplo n.º 12
0
class MessageInfo(BaseModel):
    """
    Message information.
    """

    delivery = ArrayField(field_type=ModelField(model_class=MessageAck))
    """
    Delivery message acknowledgement list.
    """

    delivery_remaining = IntegerField(default=0)
    """
    Remaining delivery count.
    """

    is_ptt = BooleanField(default=False)
    """
    Whether it was a push to talk message.
    """

    played = ArrayField(field_type=ModelField(model_class=MessageAck))
    """
    Played message acknowledgement list.
    """

    played_remaining = IntegerField(default=0)
    """
    Remaining played count.
    """

    read = ArrayField(field_type=ModelField(model_class=MessageAck))
    """
    Read message acknowledgement list.
    """

    read_remaining = IntegerField(default=0)
    """
Ejemplo n.º 13
0
class DisplayInfo(BaseModel):
    """
    Connection stream model.
    """
    class StreamInfo(Enum):
        """
        Stream information.
        """

        OFFLINE = 'OFFLINE'
        """
        Offline.
        """

        OPENING = 'OPENING'
        """
        Opening connection.
        """

        PAIRING = 'PAIRING'
        """
        Pairing phone.
        """

        SYNCING = 'SYNCING'
        """
        Synchronizing data.
        """

        RESUMING = 'RESUMING'
        """
        Resuming connection.
        """

        CONNECTING = 'CONNECTING'
        """
        Connecting.
        """

        NORMAL = 'NORMAL'
        """
        Normal.
        """

        TIMEOUT = 'TIMEOUT'
        """
        Connection timeout.
        """

    class StreamMode(Enum):
        """
        Stream mode.
        """

        QR = 'QR'
        """
        Wait for QR scan.
        """

        MAIN = 'MAIN'
        """
        Main.
        """

        SYNCING = 'SYNCING'
        """
        Synchronizing data.
        """

        OFFLINE = 'OFFLINE'
        """
        Not connected.
        """

        CONFLICT = 'CONFLICT'
        """
        Other browser has opened session.
        """

        PROXYBLOCK = 'PROXYBLOCK'
        """
        Proxy blocks connection.
        """

        TOS_BLOCK = 'TOS_BLOCK'
        """
        ¿?
        """

        SMB_TOS_BLOCK = 'SMB_TOS_BLOCK'
        """
        ¿?
        """

        DEPRECATED_VERSION = 'DEPRECATED_VERSION'
        """
        Using a deprecated version.
        """

    class DisplayState(Enum):
        """
        Display state.
        """

        SHOW = 'SHOW'
        """
        Display showing.
        """

        OBSCURE = 'OBSCURE'
        """
        Display obscured.
        """

        HIDE = 'HIDE'
        """
        Display hidden.
        """

    available = BooleanField(default=False)
    """
    Whether current user is available.
    """

    client_expired = BooleanField()
    """
    Whether client session has expired.
    """

    could_force = BooleanField()
    """
    ¿?
    """

    display_info = EnumField(enum_class=StreamInfo)
    """
    Stream state.
    """

    hard_expired: BooleanField()
    """
    ¿?
    """

    info = EnumField(enum_class=StreamInfo)
    """
    Same than display info?
    """

    is_state = BooleanField()
    """
    ¿?
    """

    obscurity = EnumField(enum_class=DisplayState)
    """
    Current display state.
    """

    mode = EnumField(enum_class=StreamMode)
    """
    Stream mode.
    """

    phone_authed = BooleanField()
    """
    Whether phone authorized.
    """

    ui_active = BooleanField()
    """
    Whether UI is active.
    """

    resume_count = IntegerField()
    """
Ejemplo n.º 14
0
class DocumentMessage(QuotedMessageMixin, MentionsMixin, MediaMixin, BaseMessage):
    body = Base64Field()
    page_count = IntegerField()
Ejemplo n.º 15
0
class Conn(BaseModel):
    ref = StringIdField()
    """
    Client token reference. Used on QR.
    """

    refTTL = IntegerField()
    """
    Ref time to live
    """

    whatsapp_id = StringIdField(alias=['wid'])
    """
    Whatsapp user identifier.
    """

    connected = BooleanField()
    """
    Whether is connected or not.
    """

    me = StringIdField()
    """
    Whatsapp user identifier.
    """

    proto_version = ArrayField(field_type=IntegerField())
    """
    Protocol version.
    """

    client_token = StringIdField()
    """
    Client token.
    """

    server_token = StringIdField()
    """
    Server token.
    """

    is_response = BooleanField()
    """
    ¿?
    """

    battery = IntegerField()
    """
    Phone battery level, in percentage.
    """

    plugged = BooleanField()
    """
    Whether phone is plugged to charger or not.
    """

    locale = StringIdField(alias=['lc'])
    """
    Phone locale.
    """

    language = StringIdField(alias=['lg'])
    """
    Phone language.
    """

    locales = StringIdField()
    """
    Phone locale-language.
    """

    is_24h = BooleanField(alias=['is24h'])
    """
    Whether time must be in 24h format.
    """

    platform = StringIdField()
    """
    Platform (android, iphone, wp7, etc...)
    """

    phone = ModelField(model_class=PhoneDescription)
    """
    Phone description.
    """

    tos = IntegerField()
    """
    ¿?
    """

    smb_tos = IntegerField()
    """
    ¿?
    """

    pushname = StringIdField()
    """
Ejemplo n.º 16
0
class Chat(BaseModel):
    """
    Chat model.
    """

    name = StringIdField()
    """
    Chat title.
    """

    last_message_ts = DateTimeField(alias=['t'])
    """
    Last message timestamp.
    """

    pin = IntegerField()
    """
    Pin type (¿?)
    """

    unread_count = IntegerField()
    """
    Unread message count.
    """

    archive = BooleanField(default=False)
    """
    Whether chat is archived or not.
    """

    change_number_new_jid = StringIdField()
    """
    Information about peer's new jabber id (user identifier).
    It happens when a peer change its phone number.
    """

    change_number_old_jid = StringIdField()
    """
    Information about peer's old phone numberjabber id (user identifier).
    It happens when a peer change its phone number.
    """

    contact = ModelField(model_class=Contact)
    """
    Contact object.
    """

    group_metadata = ModelField(model_class=GroupMetadata)
    """
    Group metadata object.
    """

    is_announce_grp_restrict = BooleanField(default=False)
    """
    ¿?
    """

    is_group = BooleanField(default=False)
    """
    Whether chat is group or not.
    """

    is_read_only = BooleanField(default=False)
    """
    Whether chat is read only or not.
    """

    kind = StringIdField()
    """
    ¿?
    """

    last_received_key = StringIdField()
    """
    Last encryption key received (¿?).
    """

    modify_tag = StringIdField()
    """
    ¿?
    """

    mute_expiration = IntegerField()
    """
    Seconds to mute expiration.
    """

    not_spam = BooleanField(default=False)
    """
    Whether it was notified as spam chat.
    """

    mute = ModelField(model_class=Mute)
    """
Ejemplo n.º 17
0
class MediaStreamMixin(BaseModel):
    streamable = BooleanField(default=False)
    durantion = IntegerField()

    is_gif = BooleanField(default=False)
    gif_attribution = BooleanField(default=False)
Ejemplo n.º 18
0
class Stream(BaseModel):
    """
    Connection stream model.
    """
    class State(Enum):
        """
        Connection states.
        """

        OPENING = 'OPENING'
        """
        Opening stream.
        """

        PAIRING = 'PAIRING'
        """
        Pairing WhatsappWeb with a phone.
        """

        UNPAIRED = 'UNPAIRED'
        """
        Unpaired WhatsappWeb with a phone. QR is available.
        """

        UNPAIRED_IDLE = 'UNPAIRED_IDLE'
        """
        Unpaired WhatsappWeb with a phone. QR is not available.
        """

        CONNECTED = 'CONNECTED'
        """
        WhatsappWeb is connected to a phone.
        """

        TIMEOUT = 'TIMEOUT'
        """
        WhatsappWeb connection to a phone is timeout.
        """

        CONFLICT = 'CONFLICT'
        """
        Other browser has initiated WhatsappWeb with same phone.
        """

        UNLAUNCHED = 'UNLAUNCHED'
        """
        WhatsappWeb application has not been launched.
        """

        PROXYBLOCK = 'PROXYBLOCK'
        """
        Proxy is blocking connection.
        """

        TOS_BLOCK = 'TOS_BLOCK'
        """
        ¿?
        """

        SMB_TOS_BLOCK = 'SMB_TOS_BLOCK'
        """
        ¿?
        """

    class Stream(Enum):
        DISCONNECTED = 'DISCONNECTED'
        """
        Stream disconnected.
        """

        SYNCING = 'SYNCING'
        """
        Synchronizing data with phone.
        """

        RESUMING = 'RESUMING'
        """
        Resuming connection with phone.
        """

        CONNECTED = 'CONNECTED'
        """
        Connected to phone.
        """

    backoff_generation = IntegerField()
    """
    ¿?
    """

    can_send = BooleanField()
    """
    Whether it is able to send messages to phone.
    """

    has_synced = BooleanField()
    """
    Whether it is synchronized with phone.
    """

    is_incognito = BooleanField()
    """
    Whether it running in a incognito tab.
    """

    launch_generation: IntegerField()
    """
    ¿?
    """

    launched = BooleanField()
    """
    Whether it has been launched.
    """

    retry_timestamp = DateTimeField()
    """
    ¿?
    """

    state = EnumField(enum_class=State)
    """
    Current stream connection state.
    """

    stream = EnumField(enum_class=Stream)
    """
    Current stream state
    """

    sync_tag = StringIdField()
    """
Ejemplo n.º 19
0
class MediaFrameMixin(BaseModel):
    body = Base64Field()
    height = IntegerField()
    width = IntegerField()