Add td_api::failedToAddMember.
This commit is contained in:
parent
ecea209a6b
commit
69257ffa6a
@ -431,6 +431,7 @@ set(TDLIB_SOURCE
|
||||
td/telegram/MessageTtl.cpp
|
||||
td/telegram/MessageViewer.cpp
|
||||
td/telegram/misc.cpp
|
||||
td/telegram/MissingInvitee.cpp
|
||||
td/telegram/net/AuthDataShared.cpp
|
||||
td/telegram/net/ConnectionCreator.cpp
|
||||
td/telegram/net/DcAuthManager.cpp
|
||||
@ -757,6 +758,7 @@ set(TDLIB_SOURCE
|
||||
td/telegram/MessageViewer.h
|
||||
td/telegram/MinChannel.h
|
||||
td/telegram/misc.h
|
||||
td/telegram/MissingInvitee.h
|
||||
td/telegram/net/AuthDataShared.h
|
||||
td/telegram/net/AuthKeyState.h
|
||||
td/telegram/net/ConnectionCreator.h
|
||||
|
@ -1845,6 +1845,16 @@ chat id:int53 type:ChatType title:string photo:chatPhotoInfo accent_color_id:int
|
||||
chats total_count:int32 chat_ids:vector<int53> = Chats;
|
||||
|
||||
|
||||
//@description Contains information about a user that has failed to be added to a chat
|
||||
//@user_id User identifier
|
||||
//@premium_would_allow_invite True, if subscription to Telegram Premium would have allowed to add the user to the chat
|
||||
//@premium_required_to_send_messages True, if subscription to Telegram Premium is required to send the user chat invite link
|
||||
failedToAddMember user_id:int53 premium_would_allow_invite:Bool premium_required_to_send_messages:Bool = FailedToAddMember;
|
||||
|
||||
//@description Represents a list of users that has failed to be added to a chat @failed_to_add_members Information about users that weren't added to the chat
|
||||
failedToAddMembers failed_to_add_members:vector<failedToAddMember> = FailedToAddMembers;
|
||||
|
||||
|
||||
//@description Describes a chat located nearby @chat_id Chat identifier @distance Distance to the chat location, in meters
|
||||
chatNearby chat_id:int53 distance:int32 = ChatNearby;
|
||||
|
||||
|
56
td/telegram/MissingInvitee.cpp
Normal file
56
td/telegram/MissingInvitee.cpp
Normal file
@ -0,0 +1,56 @@
|
||||
//
|
||||
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
#include "td/telegram/MissingInvitee.h"
|
||||
|
||||
#include "td/telegram/UserManager.h"
|
||||
|
||||
#include "td/utils/algorithm.h"
|
||||
#include "td/utils/logging.h"
|
||||
|
||||
namespace td {
|
||||
|
||||
MissingInvitee::MissingInvitee(telegram_api::object_ptr<telegram_api::missingInvitee> &&invitee)
|
||||
: user_id_(invitee->user_id_)
|
||||
, premium_would_allow_invite_(invitee->premium_would_allow_invite_)
|
||||
, premium_required_for_pm_(invitee->premium_required_for_pm_) {
|
||||
}
|
||||
|
||||
td_api::object_ptr<td_api::failedToAddMember> MissingInvitee::get_failed_to_add_member_object(
|
||||
UserManager *user_manager) const {
|
||||
return td_api::make_object<td_api::failedToAddMember>(
|
||||
user_manager->get_user_id_object(user_id_, "get_failed_to_add_member_object"), premium_would_allow_invite_,
|
||||
premium_required_for_pm_);
|
||||
}
|
||||
|
||||
StringBuilder &operator<<(StringBuilder &string_builder, const MissingInvitee &invitee) {
|
||||
return string_builder << '[' << invitee.user_id_ << ' ' << invitee.premium_would_allow_invite_ << ' '
|
||||
<< invitee.premium_required_for_pm_ << ']';
|
||||
}
|
||||
|
||||
MissingInvitees::MissingInvitees(vector<telegram_api::object_ptr<telegram_api::missingInvitee>> &&invitees) {
|
||||
for (auto &invitee : invitees) {
|
||||
missing_invitees_.emplace_back(std::move(invitee));
|
||||
if (!missing_invitees_.back().is_valid()) {
|
||||
LOG(ERROR) << "Receive invalid " << missing_invitees_.back() << " as a missing invitee";
|
||||
missing_invitees_.pop_back();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
td_api::object_ptr<td_api::failedToAddMembers> MissingInvitees::get_failed_to_add_members_object(
|
||||
UserManager *user_manager) const {
|
||||
return td_api::make_object<td_api::failedToAddMembers>(
|
||||
transform(missing_invitees_, [user_manager](const MissingInvitee &message_invitee) {
|
||||
return message_invitee.get_failed_to_add_member_object(user_manager);
|
||||
}));
|
||||
}
|
||||
|
||||
StringBuilder &operator<<(StringBuilder &string_builder, const MissingInvitees &invitees) {
|
||||
return string_builder << invitees.missing_invitees_;
|
||||
}
|
||||
|
||||
} // namespace td
|
52
td/telegram/MissingInvitee.h
Normal file
52
td/telegram/MissingInvitee.h
Normal file
@ -0,0 +1,52 @@
|
||||
//
|
||||
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "td/telegram/td_api.h"
|
||||
#include "td/telegram/telegram_api.h"
|
||||
#include "td/telegram/UserId.h"
|
||||
|
||||
#include "td/utils/common.h"
|
||||
#include "td/utils/StringBuilder.h"
|
||||
|
||||
namespace td {
|
||||
|
||||
class UserManager;
|
||||
|
||||
class MissingInvitee {
|
||||
UserId user_id_;
|
||||
bool premium_would_allow_invite_ = false;
|
||||
bool premium_required_for_pm_ = false;
|
||||
|
||||
friend StringBuilder &operator<<(StringBuilder &string_builder, const MissingInvitee &invitee);
|
||||
|
||||
public:
|
||||
explicit MissingInvitee(telegram_api::object_ptr<telegram_api::missingInvitee> &&invitee);
|
||||
|
||||
bool is_valid() const {
|
||||
return user_id_.is_valid();
|
||||
}
|
||||
|
||||
td_api::object_ptr<td_api::failedToAddMember> get_failed_to_add_member_object(UserManager *user_manager) const;
|
||||
};
|
||||
|
||||
StringBuilder &operator<<(StringBuilder &string_builder, const MissingInvitee &invitee);
|
||||
|
||||
class MissingInvitees {
|
||||
vector<MissingInvitee> missing_invitees_;
|
||||
|
||||
friend StringBuilder &operator<<(StringBuilder &string_builder, const MissingInvitees &invitees);
|
||||
|
||||
public:
|
||||
explicit MissingInvitees(vector<telegram_api::object_ptr<telegram_api::missingInvitee>> &&invitees);
|
||||
|
||||
td_api::object_ptr<td_api::failedToAddMembers> get_failed_to_add_members_object(UserManager *user_manager) const;
|
||||
};
|
||||
|
||||
StringBuilder &operator<<(StringBuilder &string_builder, const MissingInvitees &invitees);
|
||||
|
||||
} // namespace td
|
Loading…
Reference in New Issue
Block a user