Merge branch 'tdlib:master' into master

This commit is contained in:
omg-xtao 2024-07-17 10:14:50 +08:00 committed by GitHub
commit de7f075e32
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 60 additions and 15 deletions

View File

@ -6,7 +6,7 @@ if (POLICY CMP0065)
cmake_policy(SET CMP0065 NEW)
endif()
project(TelegramBotApi VERSION 7.6 LANGUAGES CXX)
project(TelegramBotApi VERSION 7.7 LANGUAGES CXX)
if (POLICY CMP0069)
option(TELEGRAM_BOT_API_ENABLE_LTO "Use \"ON\" to enable Link Time Optimization.")

View File

@ -201,8 +201,10 @@
<option>Alpine</option>
<option>CentOS 7</option>
<option>CentOS 8</option>
<option>CentOS Stream 9</option>
<option>Debian 8/9</option>
<option>Debian 10+</option>
<option>Fedora 21+</option>
<option>Ubuntu 14</option>
<option>Ubuntu 16</option>
<option>Ubuntu 18</option>
@ -354,7 +356,7 @@ function onOptionsChanged() {
document.getElementById('buildCommandsDiv').style.display = 'block';
var use_clang = os_freebsd || os_openbsd;
if (os_linux && linux_distro !== 'Alpine' && !linux_distro.includes('CentOS')) {
if (os_linux && linux_distro !== 'Alpine' && !linux_distro.includes('CentOS') && !linux_distro.includes('Fedora')) {
document.getElementById('buildCompilerDiv').style.display = 'block';
use_clang = document.getElementById('buildCompilerRadioClang').checked;
} else {
@ -531,19 +533,31 @@ function onOptionsChanged() {
commands.push(sudo + 'apk add ' + packages);
break;
case 'CentOS 7':
case 'CentOS 8':
commands.push(sudo + 'yum update -y');
var packages = 'gcc-c++ make git zlib-devel openssl-devel';
if (linux_distro === 'CentOS 7') {
commands.push(sudo + 'yum install -y centos-release-scl-rh epel-release');
commands.push(sudo + 'yum install -y devtoolset-9-gcc devtoolset-9-gcc-c++');
cmake = 'cmake3';
packages += ' gperf';
} else {
commands.push(sudo + 'yum install -y centos-release-scl-rh epel-release');
commands.push(sudo + 'yum install -y devtoolset-9-gcc devtoolset-9-gcc-c++');
cmake = 'cmake3';
packages += ' gperf ' + cmake;
commands.push(sudo + 'yum install -y ' + packages);
break;
case 'CentOS 8':
case 'CentOS Stream 9':
commands.push(sudo + 'dnf update -y');
var packages = 'gcc-c++ make git zlib-devel openssl-devel';
if (linux_distro === 'CentOS 8') {
commands.push(sudo + 'dnf --enablerepo=powertools install gperf');
} else {
commands.push(sudo + 'dnf --enablerepo=crb install gperf');
}
packages += ' ' + cmake;
commands.push(sudo + 'yum install -y ' + packages);
commands.push(sudo + 'dnf install -y ' + packages);
break;
case 'Fedora 21+':
commands.push(sudo + 'dnf update -y');
var packages = 'gperf gcc-c++ make git zlib-devel openssl-devel';
packages += ' ' + cmake;
commands.push(sudo + 'dnf install -y ' + packages);
break;
case 'Debian 8/9':
case 'Debian 10+':

2
td

@ -1 +1 @@
Subproject commit 35cfcf5d15981b99e8f31a2195641f035dd516c3
Subproject commit cb164927417f22811c74cd8678ed4a5ab7cb80ba

View File

@ -1010,7 +1010,7 @@ class Client::JsonChat final : public td::Jsonable {
permissions->can_send_basic_messages_ && permissions->can_send_audios_ &&
permissions->can_send_documents_ && permissions->can_send_photos_ && permissions->can_send_videos_ &&
permissions->can_send_video_notes_ && permissions->can_send_voice_notes_ && permissions->can_send_polls_ &&
permissions->can_send_other_messages_ && permissions->can_add_web_page_previews_ &&
permissions->can_send_other_messages_ && permissions->can_add_link_previews_ &&
permissions->can_change_info_ && permissions->can_invite_users_ && permissions->can_pin_messages_;
object("all_members_are_administrators", td::JsonBool(everyone_is_administrator));
photo = group_info->photo.get();
@ -2069,7 +2069,6 @@ class Client::JsonSuccessfulPaymentBot final : public td::Jsonable {
if (successful_payment_->order_info_ != nullptr) {
object("order_info", JsonOrderInfo(successful_payment_->order_info_.get()));
}
object("telegram_payment_charge_id", successful_payment_->telegram_payment_charge_id_);
object("provider_payment_charge_id", successful_payment_->provider_payment_charge_id_);
}
@ -2078,6 +2077,31 @@ class Client::JsonSuccessfulPaymentBot final : public td::Jsonable {
const td_api::messagePaymentSuccessfulBot *successful_payment_;
};
class Client::JsonRefundedPayment final : public td::Jsonable {
public:
explicit JsonRefundedPayment(const td_api::messagePaymentRefunded *refunded_payment)
: refunded_payment_(refunded_payment) {
}
void store(td::JsonValueScope *scope) const {
auto object = scope->enter_object();
object("currency", refunded_payment_->currency_);
object("total_amount", refunded_payment_->total_amount_);
if (!td::check_utf8(refunded_payment_->invoice_payload_)) {
LOG(WARNING) << "Receive non-UTF-8 invoice payload";
object("invoice_payload", td::JsonRawString(refunded_payment_->invoice_payload_));
} else {
object("invoice_payload", refunded_payment_->invoice_payload_);
}
object("telegram_payment_charge_id", refunded_payment_->telegram_payment_charge_id_);
if (!refunded_payment_->provider_payment_charge_id_.empty()) {
object("provider_payment_charge_id", refunded_payment_->provider_payment_charge_id_);
}
}
private:
const td_api::messagePaymentRefunded *refunded_payment_;
};
class Client::JsonEncryptedPassportElement final : public td::Jsonable {
public:
JsonEncryptedPassportElement(const td_api::encryptedPassportElement *element, const Client *client)
@ -3257,6 +3281,11 @@ void Client::JsonMessage::store(td::JsonValueScope *scope) const {
object("boost_added", JsonChatBoostAdded(content));
break;
}
case td_api::messagePaymentRefunded::ID: {
auto content = static_cast<const td_api::messagePaymentRefunded *>(message_->content.get());
object("refunded_payment", JsonRefundedPayment(content));
break;
}
default:
UNREACHABLE();
}
@ -13123,7 +13152,7 @@ void Client::json_store_permissions(td::JsonObjectScope &object, const td_api::c
object("can_send_voice_notes", td::JsonBool(permissions->can_send_voice_notes_));
object("can_send_polls", td::JsonBool(permissions->can_send_polls_));
object("can_send_other_messages", td::JsonBool(permissions->can_send_other_messages_));
object("can_add_web_page_previews", td::JsonBool(permissions->can_add_web_page_previews_));
object("can_add_web_page_previews", td::JsonBool(permissions->can_add_link_previews_));
object("can_change_info", td::JsonBool(permissions->can_change_info_));
object("can_invite_users", td::JsonBool(permissions->can_invite_users_));
object("can_pin_messages", td::JsonBool(permissions->can_pin_messages_));
@ -13662,6 +13691,7 @@ bool Client::need_skip_update_message(int64 chat_id, const object_ptr<td_api::me
case td_api::messagePremiumGiveaway::ID:
case td_api::messagePremiumGiveawayWinners::ID:
case td_api::messagePremiumGiveawayCompleted::ID:
case td_api::messagePaymentRefunded::ID:
// don't skip
break;
default:

View File

@ -179,6 +179,7 @@ class Client final : public WebhookActor::Callback {
class JsonBackgroundType;
class JsonChatBackground;
class JsonSuccessfulPaymentBot;
class JsonRefundedPayment;
class JsonEncryptedPassportElement;
class JsonEncryptedCredentials;
class JsonPassportData;

View File

@ -165,7 +165,7 @@ int main(int argc, char *argv[]) {
auto start_time = td::Time::now();
auto shared_data = std::make_shared<SharedData>();
auto parameters = std::make_unique<ClientParameters>();
parameters->version_ = "7.6";
parameters->version_ = "7.7";
parameters->shared_data_ = shared_data;
parameters->start_time_ = start_time;
auto net_query_stats = td::create_net_query_stats();