Add GroupCallId.
This commit is contained in:
parent
ce4054c5d4
commit
3c9cd41776
@ -1627,11 +1627,11 @@ messageInvoice title:string description:string photo:photo currency:string total
|
||||
//@description A message with information about an ended call @is_video True, if the call was a video call @discard_reason Reason why the call was discarded @duration Call duration, in seconds
|
||||
messageCall is_video:Bool discard_reason:CallDiscardReason duration:int32 = MessageContent;
|
||||
|
||||
//@description A message with information about a group call
|
||||
messageGroupCall = MessageContent;
|
||||
//@description A message with information about a group call @group_call_id Group call identifier
|
||||
messageGroupCall group_call_id:string = MessageContent;
|
||||
|
||||
//@description A message with information about an invite to a group call
|
||||
messageInviteToGroupCall = MessageContent;
|
||||
//@description A message with information about an invite to a group call @group_call_id Group call identifier @user_id Invited user identifier
|
||||
messageInviteToGroupCall group_call_id:string user_id:int32 = MessageContent;
|
||||
|
||||
//@description A newly created basic group @title Title of the basic group @member_user_ids User identifiers of members in the basic group
|
||||
messageBasicGroupChatCreate title:string member_user_ids:vector<int32> = MessageContent;
|
||||
@ -2032,6 +2032,9 @@ callServer id:int64 ip_address:string ipv6_address:string port:int32 type:CallSe
|
||||
//@description Contains the call identifier @id Call identifier
|
||||
callId id:int32 = CallId;
|
||||
|
||||
//@description Contains the group call identifier @id Group call identifier
|
||||
groupCallId id:string = GroupCallId;
|
||||
|
||||
|
||||
//@class CallState @description Describes the current call state
|
||||
|
||||
|
Binary file not shown.
@ -7,6 +7,7 @@
|
||||
#include "td/telegram/InputGroupCallId.h"
|
||||
|
||||
#include "td/utils/logging.h"
|
||||
#include "td/utils/misc.h"
|
||||
|
||||
namespace td {
|
||||
|
||||
@ -14,6 +15,31 @@ InputGroupCallId::InputGroupCallId(const tl_object_ptr<telegram_api::inputGroupC
|
||||
: group_call_id(input_group_call->id_), access_hash(input_group_call->access_hash_) {
|
||||
}
|
||||
|
||||
Result<InputGroupCallId> InputGroupCallId::from_group_call_id(const string &group_call_id) {
|
||||
if (group_call_id.empty()) {
|
||||
return InputGroupCallId();
|
||||
}
|
||||
|
||||
auto splitted = split(group_call_id, '_');
|
||||
auto r_group_call_id = to_integer_safe<int64>(splitted.first);
|
||||
auto r_access_hash = to_integer_safe<int64>(splitted.second);
|
||||
if (r_group_call_id.is_error() || r_access_hash.is_error()) {
|
||||
return Status::Error("Invalid group call identifier specified");
|
||||
}
|
||||
|
||||
InputGroupCallId result;
|
||||
result.group_call_id = r_group_call_id.ok();
|
||||
result.access_hash = r_access_hash.ok();
|
||||
return result;
|
||||
}
|
||||
|
||||
string InputGroupCallId::get_group_call_id() const {
|
||||
if (is_valid()) {
|
||||
return PSTRING() << group_call_id << '_' << access_hash;
|
||||
}
|
||||
return string();
|
||||
}
|
||||
|
||||
tl_object_ptr<telegram_api::inputGroupCall> InputGroupCallId::get_input_group_call() const {
|
||||
return make_tl_object<telegram_api::inputGroupCall>(group_call_id, access_hash);
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "td/telegram/telegram_api.h"
|
||||
|
||||
#include "td/utils/common.h"
|
||||
#include "td/utils/Status.h"
|
||||
#include "td/utils/StringBuilder.h"
|
||||
|
||||
namespace td {
|
||||
@ -22,6 +23,10 @@ class InputGroupCallId {
|
||||
|
||||
explicit InputGroupCallId(const tl_object_ptr<telegram_api::inputGroupCall> &input_group_call);
|
||||
|
||||
static Result<InputGroupCallId> from_group_call_id(const string &group_call_id);
|
||||
|
||||
string get_group_call_id() const;
|
||||
|
||||
bool operator==(const InputGroupCallId &other) const {
|
||||
return group_call_id == other.group_call_id && access_hash == other.access_hash;
|
||||
}
|
||||
|
@ -4024,7 +4024,7 @@ unique_ptr<MessageContent> get_message_content(Td *td, FormattedText message,
|
||||
auto message_contact = move_tl_object_as<telegram_api::messageMediaContact>(media);
|
||||
if (message_contact->user_id_ != 0) {
|
||||
td->contacts_manager_->get_user_id_object(UserId(message_contact->user_id_),
|
||||
"messageMediaContact"); // to ensure updateUser
|
||||
"MessageMediaContact"); // to ensure updateUser
|
||||
}
|
||||
return make_unique<MessageContact>(Contact(
|
||||
std::move(message_contact->phone_number_), std::move(message_contact->first_name_),
|
||||
@ -4677,12 +4677,12 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
|
||||
case MessageContentType::ChatDeleteUser: {
|
||||
const MessageChatDeleteUser *m = static_cast<const MessageChatDeleteUser *>(content);
|
||||
return make_tl_object<td_api::messageChatDeleteMember>(
|
||||
td->contacts_manager_->get_user_id_object(m->user_id, "messageChatDeleteMember"));
|
||||
td->contacts_manager_->get_user_id_object(m->user_id, "MessageChatDeleteMember"));
|
||||
}
|
||||
case MessageContentType::ChatMigrateTo: {
|
||||
const MessageChatMigrateTo *m = static_cast<const MessageChatMigrateTo *>(content);
|
||||
return make_tl_object<td_api::messageChatUpgradeTo>(
|
||||
td->contacts_manager_->get_supergroup_id_object(m->migrated_to_channel_id, "messageChatUpgradeTo"));
|
||||
td->contacts_manager_->get_supergroup_id_object(m->migrated_to_channel_id, "MessageChatUpgradeTo"));
|
||||
}
|
||||
case MessageContentType::ChannelCreate: {
|
||||
const MessageChannelCreate *m = static_cast<const MessageChannelCreate *>(content);
|
||||
@ -4692,7 +4692,7 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
|
||||
const MessageChannelMigrateFrom *m = static_cast<const MessageChannelMigrateFrom *>(content);
|
||||
return make_tl_object<td_api::messageChatUpgradeFrom>(
|
||||
m->title,
|
||||
td->contacts_manager_->get_basic_group_id_object(m->migrated_from_chat_id, "messageChatUpgradeFrom"));
|
||||
td->contacts_manager_->get_basic_group_id_object(m->migrated_from_chat_id, "MessageChatUpgradeFrom"));
|
||||
}
|
||||
case MessageContentType::PinMessage: {
|
||||
const MessagePinMessage *m = static_cast<const MessagePinMessage *>(content);
|
||||
@ -4768,10 +4768,16 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
|
||||
td->messages_manager_->get_message_sender_object(m->traveler_dialog_id),
|
||||
td->messages_manager_->get_message_sender_object(m->watcher_dialog_id), m->distance);
|
||||
}
|
||||
case MessageContentType::GroupCall:
|
||||
return make_tl_object<td_api::messageGroupCall>();
|
||||
case MessageContentType::InviteToGroupCall:
|
||||
return make_tl_object<td_api::messageInviteToGroupCall>();
|
||||
case MessageContentType::GroupCall: {
|
||||
auto *m = static_cast<const MessageGroupCall *>(content);
|
||||
return make_tl_object<td_api::messageGroupCall>(m->group_call_id.get_group_call_id());
|
||||
}
|
||||
case MessageContentType::InviteToGroupCall: {
|
||||
auto *m = static_cast<const MessageInviteToGroupCall *>(content);
|
||||
return make_tl_object<td_api::messageInviteToGroupCall>(
|
||||
m->group_call_id.get_group_call_id(),
|
||||
td->contacts_manager_->get_user_id_object(m->user_id, "MessageInviteToGroupCall"));
|
||||
}
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user