Add edit date to information about chat invite links.
This commit is contained in:
parent
65bf9ad604
commit
a2c1a695d2
@ -546,12 +546,14 @@ supergroupMembersFilterBots = SupergroupMembersFilter;
|
||||
|
||||
|
||||
//@description Contains a chat invite link @invite_link Chat invite link @administrator_user_id User identifier of an administrator created the link
|
||||
//@date Point in time (Unix timestamp) when the link was created @expire_date Point in time (Unix timestamp) when the link will expire; 0 if never
|
||||
//@date Point in time (Unix timestamp) when the link was created
|
||||
//@edit_date Point in time (Unix timestamp) when the link was last edited; 0 if never or unknown
|
||||
//@expire_date Point in time (Unix timestamp) when the link will expire; 0 if never
|
||||
//@member_limit Maximum number of members, which can join the chat using the link simultaneously; 0 if not limited
|
||||
//@member_count Number of chat members, which joined the chat using the link
|
||||
//@is_permanent True, if the link is permanent. Permanent invite link can't have expire date or usage limit. There is exactly one permanent invite link for each administrator at any time
|
||||
//@is_expired True, if the link is already expired @is_revoked True, if the link was revoked
|
||||
chatInviteLink invite_link:string administrator_user_id:int32 date:int32 expire_date:int32 member_limit:int32 member_count:int32 is_permanent:Bool is_expired:Bool is_revoked:Bool = ChatInviteLink;
|
||||
chatInviteLink invite_link:string administrator_user_id:int32 date:int32 edit_date:int32 expire_date:int32 member_limit:int32 member_count:int32 is_permanent:Bool is_expired:Bool is_revoked:Bool = ChatInviteLink;
|
||||
|
||||
//@description Contains a list of chat invite links @total_count Approximate total count of chat invite links found @invite_links List of invite links
|
||||
chatInviteLinks total_count:int32 invite_links:vector<chatInviteLink> = ChatInviteLinks;
|
||||
|
Binary file not shown.
@ -30,13 +30,13 @@ DialogInviteLink::DialogInviteLink(tl_object_ptr<telegram_api::chatInviteExporte
|
||||
}
|
||||
date_ = exported_invite->date_;
|
||||
if (date_ < 1000000000) {
|
||||
LOG(ERROR) << "Receive wrong date " << date_ << " as creation date of a link " << invite_link_;
|
||||
LOG(ERROR) << "Receive wrong date " << date_ << " as a creation date of a link " << invite_link_;
|
||||
date_ = 0;
|
||||
}
|
||||
if ((exported_invite->flags_ & telegram_api::chatInviteExported::EXPIRE_DATE_MASK) != 0) {
|
||||
expire_date_ = exported_invite->expire_date_;
|
||||
if (expire_date_ < 0) {
|
||||
LOG(ERROR) << "Receive wrong date " << expire_date_ << " as expire date of a link " << invite_link_;
|
||||
if (expire_date_ < 1000000000) {
|
||||
LOG(ERROR) << "Receive wrong date " << expire_date_ << " as an expire date of a link " << invite_link_;
|
||||
expire_date_ = 0;
|
||||
}
|
||||
}
|
||||
@ -54,13 +54,21 @@ DialogInviteLink::DialogInviteLink(tl_object_ptr<telegram_api::chatInviteExporte
|
||||
usage_count_ = 0;
|
||||
}
|
||||
}
|
||||
if ((exported_invite->flags_ & telegram_api::chatInviteExported::START_DATE_MASK) != 0) {
|
||||
edit_date_ = exported_invite->start_date_;
|
||||
if (edit_date_ < 1000000000) {
|
||||
LOG(ERROR) << "Receive wrong date " << edit_date_ << " as an edit date of a link " << invite_link_;
|
||||
edit_date_ = 0;
|
||||
}
|
||||
}
|
||||
is_revoked_ = exported_invite->revoked_;
|
||||
is_permanent_ = exported_invite->permanent_;
|
||||
|
||||
if (is_permanent_ && (usage_limit_ > 0 || expire_date_ > 0)) {
|
||||
LOG(ERROR) << "Receive wron permanent " << *this;
|
||||
if (is_permanent_ && (usage_limit_ > 0 || expire_date_ > 0 || edit_date_ > 0)) {
|
||||
LOG(ERROR) << "Receive wrong permanent " << *this;
|
||||
expire_date_ = 0;
|
||||
usage_limit_ = 0;
|
||||
edit_date_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -114,14 +122,14 @@ td_api::object_ptr<td_api::chatInviteLink> DialogInviteLink::get_chat_invite_lin
|
||||
|
||||
return td_api::make_object<td_api::chatInviteLink>(
|
||||
invite_link_, contacts_manager->get_user_id_object(administrator_user_id_, "get_chat_invite_link_object"), date_,
|
||||
expire_date_, usage_limit_, usage_count_, is_permanent_, is_expired(), is_revoked_);
|
||||
edit_date_, expire_date_, usage_limit_, usage_count_, is_permanent_, is_expired(), is_revoked_);
|
||||
}
|
||||
|
||||
bool operator==(const DialogInviteLink &lhs, const DialogInviteLink &rhs) {
|
||||
return lhs.invite_link_ == rhs.invite_link_ && lhs.administrator_user_id_ == rhs.administrator_user_id_ &&
|
||||
lhs.date_ == rhs.date_ && lhs.expire_date_ == rhs.expire_date_ && lhs.usage_limit_ == rhs.usage_limit_ &&
|
||||
lhs.usage_count_ == rhs.usage_count_ && lhs.is_permanent_ == rhs.is_permanent_ &&
|
||||
lhs.is_revoked_ == rhs.is_revoked_;
|
||||
lhs.date_ == rhs.date_ && lhs.edit_date_ == rhs.edit_date_ && lhs.expire_date_ == rhs.expire_date_ &&
|
||||
lhs.usage_limit_ == rhs.usage_limit_ && lhs.usage_count_ == rhs.usage_count_ &&
|
||||
lhs.is_permanent_ == rhs.is_permanent_ && lhs.is_revoked_ == rhs.is_revoked_;
|
||||
}
|
||||
|
||||
bool operator!=(const DialogInviteLink &lhs, const DialogInviteLink &rhs) {
|
||||
@ -130,9 +138,9 @@ bool operator!=(const DialogInviteLink &lhs, const DialogInviteLink &rhs) {
|
||||
|
||||
StringBuilder &operator<<(StringBuilder &string_builder, const DialogInviteLink &invite_link) {
|
||||
return string_builder << "ChatInviteLink[" << invite_link.invite_link_ << " by " << invite_link.administrator_user_id_
|
||||
<< " created at " << invite_link.date_ << " expiring at " << invite_link.expire_date_
|
||||
<< " used by " << invite_link.usage_count_ << " with usage limit " << invite_link.usage_limit_
|
||||
<< "]";
|
||||
<< " created at " << invite_link.date_ << " edited at " << invite_link.edit_date_
|
||||
<< " expiring at " << invite_link.expire_date_ << " used by " << invite_link.usage_count_
|
||||
<< " with usage limit " << invite_link.usage_limit_ << "]";
|
||||
}
|
||||
|
||||
} // namespace td
|
||||
|
@ -23,6 +23,7 @@ class DialogInviteLink {
|
||||
string invite_link_;
|
||||
UserId administrator_user_id_;
|
||||
int32 date_ = 0;
|
||||
int32 edit_date_ = 0;
|
||||
int32 expire_date_ = 0;
|
||||
int32 usage_limit_ = 0;
|
||||
int32 usage_count_ = 0;
|
||||
@ -68,12 +69,14 @@ class DialogInviteLink {
|
||||
bool has_expire_date = expire_date_ != 0;
|
||||
bool has_usage_limit = usage_limit_ != 0;
|
||||
bool has_usage_count = usage_count_ != 0;
|
||||
bool has_edit_date = edit_date_ != 0;
|
||||
BEGIN_STORE_FLAGS();
|
||||
STORE_FLAG(is_revoked_);
|
||||
STORE_FLAG(is_permanent_);
|
||||
STORE_FLAG(has_expire_date);
|
||||
STORE_FLAG(has_usage_limit);
|
||||
STORE_FLAG(has_usage_count);
|
||||
STORE_FLAG(has_edit_date);
|
||||
END_STORE_FLAGS();
|
||||
store(invite_link_, storer);
|
||||
store(administrator_user_id_, storer);
|
||||
@ -87,6 +90,9 @@ class DialogInviteLink {
|
||||
if (has_usage_count) {
|
||||
store(usage_count_, storer);
|
||||
}
|
||||
if (has_edit_date) {
|
||||
store(edit_date_, storer);
|
||||
}
|
||||
}
|
||||
|
||||
template <class ParserT>
|
||||
@ -95,12 +101,14 @@ class DialogInviteLink {
|
||||
bool has_expire_date;
|
||||
bool has_usage_limit;
|
||||
bool has_usage_count;
|
||||
bool has_edit_date;
|
||||
BEGIN_PARSE_FLAGS();
|
||||
PARSE_FLAG(is_revoked_);
|
||||
PARSE_FLAG(is_permanent_);
|
||||
PARSE_FLAG(has_expire_date);
|
||||
PARSE_FLAG(has_usage_limit);
|
||||
PARSE_FLAG(has_usage_count);
|
||||
PARSE_FLAG(has_edit_date);
|
||||
END_PARSE_FLAGS();
|
||||
parse(invite_link_, parser);
|
||||
parse(administrator_user_id_, parser);
|
||||
@ -114,6 +122,9 @@ class DialogInviteLink {
|
||||
if (has_usage_count) {
|
||||
parse(usage_count_, parser);
|
||||
}
|
||||
if (has_edit_date) {
|
||||
parse(edit_date_, parser);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user