mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 14:38:15 +00:00
Added ability to set emoji status for certain period of time.
This commit is contained in:
@@ -239,14 +239,18 @@ void EmojiStatuses::updateColored(const MTPDmessages_stickerSet &data) {
|
||||
_coloredUpdated.fire({});
|
||||
}
|
||||
|
||||
void EmojiStatuses::set(DocumentId id) {
|
||||
void EmojiStatuses::set(DocumentId id, TimeId until) {
|
||||
auto &api = _owner->session().api();
|
||||
if (_sentRequestId) {
|
||||
api.request(base::take(_sentRequestId)).cancel();
|
||||
}
|
||||
_owner->session().user()->setEmojiStatus(id);
|
||||
_owner->session().user()->setEmojiStatus(id, until);
|
||||
_sentRequestId = api.request(MTPaccount_UpdateEmojiStatus(
|
||||
id ? MTP_emojiStatus(MTP_long(id)) : MTP_emojiStatusEmpty()
|
||||
!id
|
||||
? MTP_emojiStatusEmpty()
|
||||
: !until
|
||||
? MTP_emojiStatus(MTP_long(id))
|
||||
: MTP_emojiStatusUntil(MTP_long(id), MTP_int(until))
|
||||
)).done([=] {
|
||||
_sentRequestId = 0;
|
||||
}).fail([=] {
|
||||
|
@@ -48,7 +48,7 @@ public:
|
||||
[[nodiscard]] rpl::producer<> defaultUpdates() const;
|
||||
[[nodiscard]] rpl::producer<> coloredUpdates() const;
|
||||
|
||||
void set(DocumentId id);
|
||||
void set(DocumentId id, TimeId until = 0);
|
||||
[[nodiscard]] bool setting() const;
|
||||
|
||||
void registerAutomaticClear(not_null<UserData*> user, TimeId until);
|
||||
|
Reference in New Issue
Block a user