Add related to voice chat service messages.

This commit is contained in:
levlam 2021-02-17 14:45:22 +03:00
parent a01c36ec1f
commit 35aa4d30a4
2 changed files with 61 additions and 9 deletions

View File

@ -1369,6 +1369,49 @@ class Client::JsonProximityAlertTriggered : public Jsonable {
const Client *client_; const Client *client_;
}; };
class Client::JsonVoiceChatStarted : public Jsonable {
public:
explicit JsonVoiceChatStarted(const td_api::messageVoiceChatStarted *voice_chat_started)
: voice_chat_started_(voice_chat_started) {
}
void store(JsonValueScope *scope) const {
auto object = scope->enter_object();
}
private:
const td_api::messageVoiceChatStarted *voice_chat_started_;
};
class Client::JsonVoiceChatEnded : public Jsonable {
public:
explicit JsonVoiceChatEnded(const td_api::messageVoiceChatEnded *voice_chat_ended)
: voice_chat_ended_(voice_chat_ended) {
}
void store(JsonValueScope *scope) const {
auto object = scope->enter_object();
object("duration", voice_chat_ended_->duration_);
}
private:
const td_api::messageVoiceChatEnded *voice_chat_ended_;
};
class Client::JsonInviteVoiceChatParticipants : public Jsonable {
public:
JsonInviteVoiceChatParticipants(const td_api::messageInviteVoiceChatParticipants *invite_voice_chat_participants,
const Client *client)
: invite_voice_chat_participants_(invite_voice_chat_participants), client_(client) {
}
void store(JsonValueScope *scope) const {
auto object = scope->enter_object();
object("users", JsonUsers(invite_voice_chat_participants_->user_ids_, client_));
}
private:
const td_api::messageInviteVoiceChatParticipants *invite_voice_chat_participants_;
const Client *client_;
};
class Client::JsonCallbackGame : public Jsonable { class Client::JsonCallbackGame : public Jsonable {
public: public:
void store(JsonValueScope *scope) const { void store(JsonValueScope *scope) const {
@ -1746,12 +1789,21 @@ void Client::JsonMessage::store(JsonValueScope *scope) const {
object("proximity_alert_triggered", JsonProximityAlertTriggered(content, client_)); object("proximity_alert_triggered", JsonProximityAlertTriggered(content, client_));
break; break;
} }
case td_api::messageVoiceChatStarted::ID: case td_api::messageVoiceChatStarted::ID: {
auto content = static_cast<const td_api::messageVoiceChatStarted *>(message_->content.get());
object("voice_chat_started", JsonVoiceChatStarted(content));
break; break;
case td_api::messageVoiceChatEnded::ID: }
case td_api::messageVoiceChatEnded::ID: {
auto content = static_cast<const td_api::messageVoiceChatEnded *>(message_->content.get());
object("voice_chat_ended", JsonVoiceChatEnded(content));
break; break;
case td_api::messageInviteVoiceChatParticipants::ID: }
case td_api::messageInviteVoiceChatParticipants::ID: {
auto content = static_cast<const td_api::messageInviteVoiceChatParticipants *>(message_->content.get());
object("voice_chat_members_invited", JsonInviteVoiceChatParticipants(content, client_));
break; break;
}
default: default:
UNREACHABLE(); UNREACHABLE();
} }
@ -8335,6 +8387,9 @@ bool Client::need_skip_update_message(int64 chat_id, const object_ptr<td_api::me
case td_api::messageChatDeleteMember::ID: case td_api::messageChatDeleteMember::ID:
case td_api::messagePinMessage::ID: case td_api::messagePinMessage::ID:
case td_api::messageProximityAlertTriggered::ID: case td_api::messageProximityAlertTriggered::ID:
case td_api::messageVoiceChatStarted::ID:
case td_api::messageVoiceChatEnded::ID:
case td_api::messageInviteVoiceChatParticipants::ID:
// don't skip // don't skip
break; break;
default: default:
@ -8439,12 +8494,6 @@ bool Client::need_skip_update_message(int64 chat_id, const object_ptr<td_api::me
return true; return true;
case td_api::messageCustomServiceAction::ID: case td_api::messageCustomServiceAction::ID:
return true; return true;
case td_api::messageVoiceChatStarted::ID:
return true;
case td_api::messageVoiceChatEnded::ID:
return true;
case td_api::messageInviteVoiceChatParticipants::ID:
return true;
default: default:
break; break;
} }

View File

@ -143,6 +143,9 @@ class Client : public WebhookActor::Callback {
class JsonEncryptedCredentials; class JsonEncryptedCredentials;
class JsonPassportData; class JsonPassportData;
class JsonProximityAlertTriggered; class JsonProximityAlertTriggered;
class JsonVoiceChatStarted;
class JsonVoiceChatEnded;
class JsonInviteVoiceChatParticipants;
class JsonUpdateTypes; class JsonUpdateTypes;
class JsonWebhookInfo; class JsonWebhookInfo;
class JsonStickerSet; class JsonStickerSet;