mirror of https://github.com/procxx/kepka.git
API scheme downgraded to layer 76.
This commit is contained in:
parent
7f73cc3085
commit
ee182ea684
|
@ -219,7 +219,7 @@ userStatusLastMonth#77ebc742 = UserStatus;
|
||||||
chatEmpty#9ba2d800 id:int = Chat;
|
chatEmpty#9ba2d800 id:int = Chat;
|
||||||
chat#d91cdd54 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true admins_enabled:flags.3?true admin:flags.4?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel = Chat;
|
chat#d91cdd54 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true admins_enabled:flags.3?true admin:flags.4?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel = Chat;
|
||||||
chatForbidden#7328bdb id:int title:string = Chat;
|
chatForbidden#7328bdb id:int title:string = Chat;
|
||||||
channel#c88974ac flags:# creator:flags.0?true left:flags.2?true editor:flags.3?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true democracy:flags.10?true signatures:flags.11?true min:flags.12?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string admin_rights:flags.14?ChannelAdminRights banned_rights:flags.15?ChannelBannedRights participants_count:flags.17?int feed_id:flags.18?int = Chat;
|
channel#450b7115 flags:# creator:flags.0?true left:flags.2?true editor:flags.3?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true democracy:flags.10?true signatures:flags.11?true min:flags.12?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string admin_rights:flags.14?ChannelAdminRights banned_rights:flags.15?ChannelBannedRights participants_count:flags.17?int = Chat;
|
||||||
channelForbidden#289da732 flags:# broadcast:flags.5?true megagroup:flags.8?true id:int access_hash:long title:string until_date:flags.16?int = Chat;
|
channelForbidden#289da732 flags:# broadcast:flags.5?true megagroup:flags.8?true id:int access_hash:long title:string until_date:flags.16?int = Chat;
|
||||||
|
|
||||||
chatFull#2e02a614 id:int participants:ChatParticipants chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector<BotInfo> = ChatFull;
|
chatFull#2e02a614 id:int participants:ChatParticipants chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector<BotInfo> = ChatFull;
|
||||||
|
@ -273,7 +273,6 @@ messageActionCustomAction#fae69f56 message:string = MessageAction;
|
||||||
messageActionBotAllowed#abe9affe domain:string = MessageAction;
|
messageActionBotAllowed#abe9affe domain:string = MessageAction;
|
||||||
|
|
||||||
dialog#e4def5db flags:# pinned:flags.2?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage = Dialog;
|
dialog#e4def5db flags:# pinned:flags.2?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage = Dialog;
|
||||||
dialogFeed#36086d42 flags:# pinned:flags.2?true peer:Peer top_message:int feed_id:int feed_other_channels:Vector<int> read_max_position:flags.3?FeedPosition unread_count:int unread_muted_count:int = Dialog;
|
|
||||||
|
|
||||||
photoEmpty#2331b22d id:long = Photo;
|
photoEmpty#2331b22d id:long = Photo;
|
||||||
photo#9288dd29 flags:# has_stickers:flags.0?true id:long access_hash:long date:int sizes:Vector<PhotoSize> = Photo;
|
photo#9288dd29 flags:# has_stickers:flags.0?true id:long access_hash:long date:int sizes:Vector<PhotoSize> = Photo;
|
||||||
|
@ -437,7 +436,6 @@ updateFavedStickers#e511996d = Update;
|
||||||
updateChannelReadMessagesContents#89893b45 channel_id:int messages:Vector<int> = Update;
|
updateChannelReadMessagesContents#89893b45 channel_id:int messages:Vector<int> = Update;
|
||||||
updateContactsReset#7084a7be = Update;
|
updateContactsReset#7084a7be = Update;
|
||||||
updateChannelAvailableMessages#70db6837 channel_id:int available_min_id:int = Update;
|
updateChannelAvailableMessages#70db6837 channel_id:int available_min_id:int = Update;
|
||||||
updateReadFeed#6fa68e41 flags:# feed_id:int max_position:FeedPosition unread_count:flags.0?int unread_muted_count:flags.0?int = Update;
|
|
||||||
|
|
||||||
updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
|
updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
|
||||||
|
|
||||||
|
@ -948,27 +946,14 @@ inputMessageReplyTo#bad88395 id:int = InputMessage;
|
||||||
inputMessagePinned#86872538 = InputMessage;
|
inputMessagePinned#86872538 = InputMessage;
|
||||||
|
|
||||||
inputDialogPeer#fcaafeb7 peer:InputPeer = InputDialogPeer;
|
inputDialogPeer#fcaafeb7 peer:InputPeer = InputDialogPeer;
|
||||||
inputDialogPeerFeed#2c38b8cf feed_id:int = InputDialogPeer;
|
|
||||||
|
|
||||||
dialogPeer#e56dbf05 peer:Peer = DialogPeer;
|
dialogPeer#e56dbf05 peer:Peer = DialogPeer;
|
||||||
dialogPeerFeed#da429411 feed_id:int = DialogPeer;
|
|
||||||
|
|
||||||
messages.foundStickerSetsNotModified#d54b65d = messages.FoundStickerSets;
|
messages.foundStickerSetsNotModified#d54b65d = messages.FoundStickerSets;
|
||||||
messages.foundStickerSets#5108d648 hash:int sets:Vector<StickerSetCovered> = messages.FoundStickerSets;
|
messages.foundStickerSets#5108d648 hash:int sets:Vector<StickerSetCovered> = messages.FoundStickerSets;
|
||||||
|
|
||||||
fileHash#6242c773 offset:int limit:int hash:bytes = FileHash;
|
fileHash#6242c773 offset:int limit:int hash:bytes = FileHash;
|
||||||
|
|
||||||
feedPosition#5059dc73 date:int peer:Peer id:int = FeedPosition;
|
|
||||||
|
|
||||||
messages.feedMessagesNotModified#4678d0cf = messages.FeedMessages;
|
|
||||||
messages.feedMessages#55c3a1b1 flags:# max_position:flags.0?FeedPosition min_position:flags.1?FeedPosition read_max_position:flags.2?FeedPosition messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.FeedMessages;
|
|
||||||
|
|
||||||
feedBroadcasts#4f4feaf1 feed_id:int channels:Vector<int> = FeedBroadcasts;
|
|
||||||
feedBroadcastsUngrouped#9a687cba channels:Vector<int> = FeedBroadcasts;
|
|
||||||
|
|
||||||
channels.feedSourcesNotModified#88b12a17 = channels.FeedSources;
|
|
||||||
channels.feedSources#8e8bca3d flags:# newly_joined_feed:flags.0?int feeds:Vector<FeedBroadcasts> chats:Vector<Chat> users:Vector<User> = channels.FeedSources;
|
|
||||||
|
|
||||||
---functions---
|
---functions---
|
||||||
|
|
||||||
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
||||||
|
@ -1046,7 +1031,7 @@ contacts.resetTopPeerRating#1ae373ac category:TopPeerCategory peer:InputPeer = B
|
||||||
contacts.resetSaved#879537f1 = Bool;
|
contacts.resetSaved#879537f1 = Bool;
|
||||||
|
|
||||||
messages.getMessages#63c66506 id:Vector<InputMessage> = messages.Messages;
|
messages.getMessages#63c66506 id:Vector<InputMessage> = messages.Messages;
|
||||||
messages.getDialogs#5c0fae2 flags:# exclude_pinned:flags.0?true feed_id:flags.1?int offset_date:int offset_id:int offset_peer:InputPeer limit:int = messages.Dialogs;
|
messages.getDialogs#191ba9c5 flags:# exclude_pinned:flags.0?true offset_date:int offset_id:int offset_peer:InputPeer limit:int = messages.Dialogs;
|
||||||
messages.getHistory#dcbb8260 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages;
|
messages.getHistory#dcbb8260 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages;
|
||||||
messages.search#8614ef68 flags:# peer:InputPeer q:string from_id:flags.0?InputUser filter:MessagesFilter min_date:int max_date:int offset_id:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages;
|
messages.search#8614ef68 flags:# peer:InputPeer q:string from_id:flags.0?InputUser filter:MessagesFilter min_date:int max_date:int offset_id:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages;
|
||||||
messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages;
|
messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages;
|
||||||
|
@ -1204,12 +1189,6 @@ channels.setStickers#ea8ca4f9 channel:InputChannel stickerset:InputStickerSet =
|
||||||
channels.readMessageContents#eab5dc38 channel:InputChannel id:Vector<int> = Bool;
|
channels.readMessageContents#eab5dc38 channel:InputChannel id:Vector<int> = Bool;
|
||||||
channels.deleteHistory#af369d42 channel:InputChannel max_id:int = Bool;
|
channels.deleteHistory#af369d42 channel:InputChannel max_id:int = Bool;
|
||||||
channels.togglePreHistoryHidden#eabbb94c channel:InputChannel enabled:Bool = Updates;
|
channels.togglePreHistoryHidden#eabbb94c channel:InputChannel enabled:Bool = Updates;
|
||||||
channels.getFeed#b90f450 flags:# offset_to_max_read:flags.3?true feed_id:int offset_position:flags.0?FeedPosition add_offset:int limit:int max_position:flags.1?FeedPosition min_position:flags.2?FeedPosition hash:int = messages.FeedMessages;
|
|
||||||
channels.searchFeed#88325369 feed_id:int q:string offset_date:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages;
|
|
||||||
channels.getFeedSources#d8ce236e flags:# feed_id:flags.0?int hash:int = channels.FeedSources;
|
|
||||||
channels.changeFeedBroadcast#ffb37511 flags:# channel:InputChannel feed_id:flags.0?int = Updates;
|
|
||||||
channels.setFeedBroadcasts#ea80bfae flags:# feed_id:int channels:flags.0?Vector<InputChannel> also_newly_joined:flags.1?Bool = Updates;
|
|
||||||
channels.readFeed#9c3011d feed_id:int max_position:FeedPosition = Updates;
|
|
||||||
|
|
||||||
bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON;
|
bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON;
|
||||||
bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool;
|
bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool;
|
||||||
|
@ -1240,4 +1219,4 @@ langpack.getStrings#2e1ee318 lang_code:string keys:Vector<string> = Vector<LangP
|
||||||
langpack.getDifference#b2e4d7d from_version:int = LangPackDifference;
|
langpack.getDifference#b2e4d7d from_version:int = LangPackDifference;
|
||||||
langpack.getLanguages#800fd57d = Vector<LangPackLanguage>;
|
langpack.getLanguages#800fd57d = Vector<LangPackLanguage>;
|
||||||
|
|
||||||
// LAYER 77
|
// LAYER 76
|
||||||
|
|
|
@ -165,7 +165,7 @@ void ApiWrap::savePinnedOrder() {
|
||||||
if (const auto history = pinned.history()) {
|
if (const auto history = pinned.history()) {
|
||||||
peers.push_back(MTP_inputDialogPeer(history->peer->input));
|
peers.push_back(MTP_inputDialogPeer(history->peer->input));
|
||||||
} else if (const auto feed = pinned.feed()) {
|
} else if (const auto feed = pinned.feed()) {
|
||||||
peers.push_back(MTP_inputDialogPeerFeed(MTP_int(feed->id())));
|
// peers.push_back(MTP_inputDialogPeerFeed(MTP_int(feed->id()))); // #feed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto flags = MTPmessages_ReorderPinnedDialogs::Flag::f_force;
|
auto flags = MTPmessages_ReorderPinnedDialogs::Flag::f_force;
|
||||||
|
@ -174,50 +174,50 @@ void ApiWrap::savePinnedOrder() {
|
||||||
MTP_vector(peers)
|
MTP_vector(peers)
|
||||||
)).send();
|
)).send();
|
||||||
}
|
}
|
||||||
|
// #feed
|
||||||
void ApiWrap::toggleChannelGrouping(
|
//void ApiWrap::toggleChannelGrouping(
|
||||||
not_null<ChannelData*> channel,
|
// not_null<ChannelData*> channel,
|
||||||
bool group,
|
// bool group,
|
||||||
base::lambda<void()> callback) {
|
// base::lambda<void()> callback) {
|
||||||
if (const auto already = _channelGroupingRequests.take(channel)) {
|
// if (const auto already = _channelGroupingRequests.take(channel)) {
|
||||||
request(already->first).cancel();
|
// request(already->first).cancel();
|
||||||
}
|
// }
|
||||||
const auto feedId = Data::Feed::kId;
|
// const auto feedId = Data::Feed::kId;
|
||||||
const auto flags = group
|
// const auto flags = group
|
||||||
? MTPchannels_ChangeFeedBroadcast::Flag::f_feed_id
|
// ? MTPchannels_ChangeFeedBroadcast::Flag::f_feed_id
|
||||||
: MTPchannels_ChangeFeedBroadcast::Flag(0);
|
// : MTPchannels_ChangeFeedBroadcast::Flag(0);
|
||||||
const auto requestId = request(MTPchannels_ChangeFeedBroadcast(
|
// const auto requestId = request(MTPchannels_ChangeFeedBroadcast(
|
||||||
MTP_flags(flags),
|
// MTP_flags(flags),
|
||||||
channel->inputChannel,
|
// channel->inputChannel,
|
||||||
MTP_int(feedId)
|
// MTP_int(feedId)
|
||||||
)).done([=](const MTPUpdates &result) {
|
// )).done([=](const MTPUpdates &result) {
|
||||||
applyUpdates(result);
|
// applyUpdates(result);
|
||||||
if (group) {
|
// if (group) {
|
||||||
channel->setFeed(Auth().data().feed(feedId));
|
// channel->setFeed(Auth().data().feed(feedId));
|
||||||
} else {
|
// } else {
|
||||||
channel->clearFeed();
|
// channel->clearFeed();
|
||||||
}
|
// }
|
||||||
if (const auto data = _channelGroupingRequests.take(channel)) {
|
// if (const auto data = _channelGroupingRequests.take(channel)) {
|
||||||
data->second();
|
// data->second();
|
||||||
}
|
// }
|
||||||
}).fail([=](const RPCError &error) {
|
// }).fail([=](const RPCError &error) {
|
||||||
_channelGroupingRequests.remove(channel);
|
// _channelGroupingRequests.remove(channel);
|
||||||
}).send();
|
// }).send();
|
||||||
_channelGroupingRequests.emplace(channel, requestId, callback);
|
// _channelGroupingRequests.emplace(channel, requestId, callback);
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
void ApiWrap::ungroupAllFromFeed(not_null<Data::Feed*> feed) {
|
//void ApiWrap::ungroupAllFromFeed(not_null<Data::Feed*> feed) {
|
||||||
const auto flags = MTPchannels_SetFeedBroadcasts::Flag::f_channels
|
// const auto flags = MTPchannels_SetFeedBroadcasts::Flag::f_channels
|
||||||
| MTPchannels_SetFeedBroadcasts::Flag::f_also_newly_joined;
|
// | MTPchannels_SetFeedBroadcasts::Flag::f_also_newly_joined;
|
||||||
request(MTPchannels_SetFeedBroadcasts(
|
// request(MTPchannels_SetFeedBroadcasts(
|
||||||
MTP_flags(flags),
|
// MTP_flags(flags),
|
||||||
MTP_int(feed->id()),
|
// MTP_int(feed->id()),
|
||||||
MTP_vector<MTPInputChannel>(0),
|
// MTP_vector<MTPInputChannel>(0),
|
||||||
MTP_bool(false)
|
// MTP_bool(false)
|
||||||
)).done([=](const MTPUpdates &result) {
|
// )).done([=](const MTPUpdates &result) {
|
||||||
applyUpdates(result);
|
// applyUpdates(result);
|
||||||
}).send();
|
// }).send();
|
||||||
}
|
//}
|
||||||
|
|
||||||
void ApiWrap::sendMessageFail(const RPCError &error) {
|
void ApiWrap::sendMessageFail(const RPCError &error) {
|
||||||
if (error.type() == qstr("PEER_FLOOD")) {
|
if (error.type() == qstr("PEER_FLOOD")) {
|
||||||
|
@ -391,17 +391,17 @@ void ApiWrap::requestDialogEntry(not_null<Data::Feed*> feed) {
|
||||||
}
|
}
|
||||||
_dialogFeedRequests.emplace(feed);
|
_dialogFeedRequests.emplace(feed);
|
||||||
|
|
||||||
auto peers = QVector<MTPInputDialogPeer>(
|
//auto peers = QVector<MTPInputDialogPeer>( // #feed
|
||||||
1,
|
// 1,
|
||||||
MTP_inputDialogPeerFeed(MTP_int(feed->id())));
|
// MTP_inputDialogPeerFeed(MTP_int(feed->id())));
|
||||||
request(MTPmessages_GetPeerDialogs(
|
//request(MTPmessages_GetPeerDialogs(
|
||||||
MTP_vector(std::move(peers))
|
// MTP_vector(std::move(peers))
|
||||||
)).done([=](const MTPmessages_PeerDialogs &result) {
|
//)).done([=](const MTPmessages_PeerDialogs &result) {
|
||||||
applyPeerDialogs(result);
|
// applyPeerDialogs(result);
|
||||||
_dialogFeedRequests.remove(feed);
|
// _dialogFeedRequests.remove(feed);
|
||||||
}).fail([=](const RPCError &error) {
|
//}).fail([=](const RPCError &error) {
|
||||||
_dialogFeedRequests.remove(feed);
|
// _dialogFeedRequests.remove(feed);
|
||||||
}).send();
|
//}).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
//void ApiWrap::requestFeedDialogsEntries(not_null<Data::Feed*> feed) {
|
//void ApiWrap::requestFeedDialogsEntries(not_null<Data::Feed*> feed) {
|
||||||
|
@ -460,11 +460,11 @@ void ApiWrap::applyPeerDialogs(const MTPmessages_PeerDialogs &dialogs) {
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case mtpc_dialogFeed: {
|
//case mtpc_dialogFeed: { // #feed
|
||||||
const auto &fields = dialog.c_dialogFeed();
|
// const auto &fields = dialog.c_dialogFeed();
|
||||||
const auto feed = Auth().data().feed(fields.vfeed_id.v);
|
// const auto feed = Auth().data().feed(fields.vfeed_id.v);
|
||||||
feed->applyDialog(fields);
|
// feed->applyDialog(fields);
|
||||||
} break;
|
//} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_session->data().sendHistoryChangeNotifications();
|
_session->data().sendHistoryChangeNotifications();
|
||||||
|
@ -548,9 +548,9 @@ void ApiWrap::applyFeedDialogs(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case mtpc_dialogFeed: {
|
//case mtpc_dialogFeed: { // #feed
|
||||||
LOG(("API Error: Unexpected dialogFeed in feed dialogs list."));
|
// LOG(("API Error: Unexpected dialogFeed in feed dialogs list."));
|
||||||
} break;
|
//} break;
|
||||||
default: Unexpected("Type in DialogsInner::dialogsReceived");
|
default: Unexpected("Type in DialogsInner::dialogsReceived");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2714,44 +2714,44 @@ void ApiWrap::requestMessageAfterDate(
|
||||||
const auto addOffset = -2;
|
const auto addOffset = -2;
|
||||||
const auto limit = 1;
|
const auto limit = 1;
|
||||||
const auto hash = 0;
|
const auto hash = 0;
|
||||||
request(MTPchannels_GetFeed(
|
//request(MTPchannels_GetFeed( // #feed
|
||||||
MTP_flags(MTPchannels_GetFeed::Flag::f_offset_position),
|
// MTP_flags(MTPchannels_GetFeed::Flag::f_offset_position),
|
||||||
MTP_int(feed->id()),
|
// MTP_int(feed->id()),
|
||||||
MTP_feedPosition(
|
// MTP_feedPosition(
|
||||||
MTP_int(offsetDate),
|
// MTP_int(offsetDate),
|
||||||
MTP_peerUser(MTP_int(_session->userId())),
|
// MTP_peerUser(MTP_int(_session->userId())),
|
||||||
MTP_int(0)),
|
// MTP_int(0)),
|
||||||
MTP_int(addOffset),
|
// MTP_int(addOffset),
|
||||||
MTP_int(limit),
|
// MTP_int(limit),
|
||||||
MTPfeedPosition(), // max_id
|
// MTPfeedPosition(), // max_id
|
||||||
MTPfeedPosition(), // min_id
|
// MTPfeedPosition(), // min_id
|
||||||
MTP_int(hash)
|
// MTP_int(hash)
|
||||||
)).done([
|
//)).done([
|
||||||
=,
|
// =,
|
||||||
callback = std::forward<Callback>(callback)
|
// callback = std::forward<Callback>(callback)
|
||||||
](const MTPmessages_FeedMessages &result) {
|
//](const MTPmessages_FeedMessages &result) {
|
||||||
if (result.type() == mtpc_messages_feedMessagesNotModified) {
|
// if (result.type() == mtpc_messages_feedMessagesNotModified) {
|
||||||
LOG(("API Error: "
|
// LOG(("API Error: "
|
||||||
"Unexpected messages.feedMessagesNotModified."));
|
// "Unexpected messages.feedMessagesNotModified."));
|
||||||
callback(Data::UnreadMessagePosition);
|
// callback(Data::UnreadMessagePosition);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
Assert(result.type() == mtpc_messages_feedMessages);
|
// Assert(result.type() == mtpc_messages_feedMessages);
|
||||||
const auto &data = result.c_messages_feedMessages();
|
// const auto &data = result.c_messages_feedMessages();
|
||||||
const auto &messages = data.vmessages.v;
|
// const auto &messages = data.vmessages.v;
|
||||||
const auto type = NewMessageExisting;
|
// const auto type = NewMessageExisting;
|
||||||
App::feedUsers(data.vusers);
|
// App::feedUsers(data.vusers);
|
||||||
App::feedChats(data.vchats);
|
// App::feedChats(data.vchats);
|
||||||
for (const auto &msg : messages) {
|
// for (const auto &msg : messages) {
|
||||||
if (const auto item = App::histories().addNewMessage(msg, type)) {
|
// if (const auto item = App::histories().addNewMessage(msg, type)) {
|
||||||
if (item->date() >= offsetDate || true) {
|
// if (item->date() >= offsetDate || true) {
|
||||||
callback(item->position());
|
// callback(item->position());
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
callback(Data::UnreadMessagePosition);
|
// callback(Data::UnreadMessagePosition);
|
||||||
}).send();
|
//}).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApiWrap::jumpToFeedDate(not_null<Data::Feed*> feed, const QDate &date) {
|
void ApiWrap::jumpToFeedDate(not_null<Data::Feed*> feed, const QDate &date) {
|
||||||
|
@ -3032,271 +3032,271 @@ void ApiWrap::userPhotosDone(
|
||||||
fullCount
|
fullCount
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
// #feed
|
||||||
void ApiWrap::requestFeedChannels(not_null<Data::Feed*> feed) {
|
//void ApiWrap::requestFeedChannels(not_null<Data::Feed*> feed) {
|
||||||
if (_feedChannelsGetRequests.contains(feed)) {
|
// if (_feedChannelsGetRequests.contains(feed)) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
const auto hash = feed->channelsHash();
|
// const auto hash = feed->channelsHash();
|
||||||
request(MTPchannels_GetFeedSources(
|
// request(MTPchannels_GetFeedSources(
|
||||||
MTP_flags(MTPchannels_GetFeedSources::Flag::f_feed_id),
|
// MTP_flags(MTPchannels_GetFeedSources::Flag::f_feed_id),
|
||||||
MTP_int(feed->id()),
|
// MTP_int(feed->id()),
|
||||||
MTP_int(hash)
|
// MTP_int(hash)
|
||||||
)).done([=](const MTPchannels_FeedSources &result) {
|
// )).done([=](const MTPchannels_FeedSources &result) {
|
||||||
_feedChannelsGetRequests.remove(feed);
|
// _feedChannelsGetRequests.remove(feed);
|
||||||
|
//
|
||||||
switch (result.type()) {
|
// switch (result.type()) {
|
||||||
case mtpc_channels_feedSourcesNotModified:
|
// case mtpc_channels_feedSourcesNotModified:
|
||||||
if (feed->channelsHash() == hash) {
|
// if (feed->channelsHash() == hash) {
|
||||||
feedChannelsDone(feed);
|
// feedChannelsDone(feed);
|
||||||
} else {
|
// } else {
|
||||||
requestFeedChannels(feed);
|
// requestFeedChannels(feed);
|
||||||
}
|
// }
|
||||||
break;
|
// break;
|
||||||
|
//
|
||||||
case mtpc_channels_feedSources: {
|
// case mtpc_channels_feedSources: {
|
||||||
const auto &data = result.c_channels_feedSources();
|
// const auto &data = result.c_channels_feedSources();
|
||||||
applyFeedSources(data);
|
// applyFeedSources(data);
|
||||||
if (feed->channelsLoaded()) {
|
// if (feed->channelsLoaded()) {
|
||||||
feedChannelsDone(feed);
|
// feedChannelsDone(feed);
|
||||||
} else {
|
// } else {
|
||||||
LOG(("API Error: feed channels not received for "
|
// LOG(("API Error: feed channels not received for "
|
||||||
).arg(feed->id()));
|
// ).arg(feed->id()));
|
||||||
}
|
// }
|
||||||
} break;
|
// } break;
|
||||||
|
//
|
||||||
default: Unexpected("Type in channels.getFeedSources response.");
|
// default: Unexpected("Type in channels.getFeedSources response.");
|
||||||
}
|
// }
|
||||||
}).fail([=](const RPCError &error) {
|
// }).fail([=](const RPCError &error) {
|
||||||
_feedChannelsGetRequests.remove(feed);
|
// _feedChannelsGetRequests.remove(feed);
|
||||||
}).send();
|
// }).send();
|
||||||
_feedChannelsGetRequests.emplace(feed);
|
// _feedChannelsGetRequests.emplace(feed);
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
void ApiWrap::applyFeedSources(const MTPDchannels_feedSources &data) {
|
//void ApiWrap::applyFeedSources(const MTPDchannels_feedSources &data) {
|
||||||
// First we set channels without reading them from data.
|
// // First we set channels without reading them from data.
|
||||||
// This allows us to apply them all at once without registering
|
// // This allows us to apply them all at once without registering
|
||||||
// them one by one.
|
// // them one by one.
|
||||||
for (const auto &broadcasts : data.vfeeds.v) {
|
// for (const auto &broadcasts : data.vfeeds.v) {
|
||||||
if (broadcasts.type() == mtpc_feedBroadcasts) {
|
// if (broadcasts.type() == mtpc_feedBroadcasts) {
|
||||||
const auto &list = broadcasts.c_feedBroadcasts();
|
// const auto &list = broadcasts.c_feedBroadcasts();
|
||||||
const auto feedId = list.vfeed_id.v;
|
// const auto feedId = list.vfeed_id.v;
|
||||||
const auto feed = _session->data().feed(feedId);
|
// const auto feed = _session->data().feed(feedId);
|
||||||
auto channels = std::vector<not_null<ChannelData*>>();
|
// auto channels = std::vector<not_null<ChannelData*>>();
|
||||||
for (const auto &channelId : list.vchannels.v) {
|
// for (const auto &channelId : list.vchannels.v) {
|
||||||
channels.push_back(App::channel(channelId.v));
|
// channels.push_back(App::channel(channelId.v));
|
||||||
}
|
// }
|
||||||
feed->setChannels(std::move(channels));
|
// feed->setChannels(std::move(channels));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
App::feedUsers(data.vusers);
|
// App::feedUsers(data.vusers);
|
||||||
App::feedChats(data.vchats);
|
// App::feedChats(data.vchats);
|
||||||
|
//
|
||||||
if (data.has_newly_joined_feed()) {
|
// if (data.has_newly_joined_feed()) {
|
||||||
_session->data().setDefaultFeedId(
|
// _session->data().setDefaultFeedId(
|
||||||
data.vnewly_joined_feed.v);
|
// data.vnewly_joined_feed.v);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
void ApiWrap::setFeedChannels(
|
//void ApiWrap::setFeedChannels(
|
||||||
not_null<Data::Feed*> feed,
|
// not_null<Data::Feed*> feed,
|
||||||
const std::vector<not_null<ChannelData*>> &channels) {
|
// const std::vector<not_null<ChannelData*>> &channels) {
|
||||||
if (const auto already = _feedChannelsSetRequests.take(feed)) {
|
// if (const auto already = _feedChannelsSetRequests.take(feed)) {
|
||||||
request(*already).cancel();
|
// request(*already).cancel();
|
||||||
}
|
// }
|
||||||
auto inputs = QVector<MTPInputChannel>();
|
// auto inputs = QVector<MTPInputChannel>();
|
||||||
inputs.reserve(channels.size());
|
// inputs.reserve(channels.size());
|
||||||
for (const auto channel : channels) {
|
// for (const auto channel : channels) {
|
||||||
inputs.push_back(channel->inputChannel);
|
// inputs.push_back(channel->inputChannel);
|
||||||
}
|
// }
|
||||||
const auto requestId = request(MTPchannels_SetFeedBroadcasts(
|
// const auto requestId = request(MTPchannels_SetFeedBroadcasts(
|
||||||
MTP_flags(MTPchannels_SetFeedBroadcasts::Flag::f_channels),
|
// MTP_flags(MTPchannels_SetFeedBroadcasts::Flag::f_channels),
|
||||||
MTP_int(feed->id()),
|
// MTP_int(feed->id()),
|
||||||
MTP_vector<MTPInputChannel>(inputs),
|
// MTP_vector<MTPInputChannel>(inputs),
|
||||||
MTPbool()
|
// MTPbool()
|
||||||
)).done([=](const MTPUpdates &result) {
|
// )).done([=](const MTPUpdates &result) {
|
||||||
applyUpdates(result);
|
// applyUpdates(result);
|
||||||
|
//
|
||||||
_feedChannelsSetRequests.remove(feed);
|
// _feedChannelsSetRequests.remove(feed);
|
||||||
}).fail([=](const RPCError &error) {
|
// }).fail([=](const RPCError &error) {
|
||||||
_feedChannelsSetRequests.remove(feed);
|
// _feedChannelsSetRequests.remove(feed);
|
||||||
}).send();
|
// }).send();
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
void ApiWrap::feedChannelsDone(not_null<Data::Feed*> feed) {
|
//void ApiWrap::feedChannelsDone(not_null<Data::Feed*> feed) {
|
||||||
feed->setChannelsLoaded(true);
|
// feed->setChannelsLoaded(true);
|
||||||
for (const auto key : base::take(_feedMessagesRequestsPending)) {
|
// for (const auto key : base::take(_feedMessagesRequestsPending)) {
|
||||||
std::apply(
|
// std::apply(
|
||||||
[=](auto&&...args) { requestFeedMessages(args...); },
|
// [=](auto&&...args) { requestFeedMessages(args...); },
|
||||||
key);
|
// key);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
void ApiWrap::requestFeedMessages(
|
//void ApiWrap::requestFeedMessages(
|
||||||
not_null<Data::Feed*> feed,
|
// not_null<Data::Feed*> feed,
|
||||||
Data::MessagePosition messageId,
|
// Data::MessagePosition messageId,
|
||||||
SliceType slice) {
|
// SliceType slice) {
|
||||||
const auto key = std::make_tuple(feed, messageId, slice);
|
// const auto key = std::make_tuple(feed, messageId, slice);
|
||||||
if (_feedMessagesRequests.contains(key)
|
// if (_feedMessagesRequests.contains(key)
|
||||||
|| _feedMessagesRequestsPending.contains(key)) {
|
// || _feedMessagesRequestsPending.contains(key)) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (!feed->channelsLoaded()) {
|
// if (!feed->channelsLoaded()) {
|
||||||
_feedMessagesRequestsPending.emplace(key);
|
// _feedMessagesRequestsPending.emplace(key);
|
||||||
requestFeedChannels(feed);
|
// requestFeedChannels(feed);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// We request messages with overlapping and skip overlapped in response.
|
// // We request messages with overlapping and skip overlapped in response.
|
||||||
const auto limit = kFeedMessagesLimit;
|
// const auto limit = kFeedMessagesLimit;
|
||||||
const auto addOffset = [&] {
|
// const auto addOffset = [&] {
|
||||||
switch (slice) {
|
// switch (slice) {
|
||||||
case SliceType::Before: return -2;
|
// case SliceType::Before: return -2;
|
||||||
case SliceType::Around: return -limit / 2;
|
// case SliceType::Around: return -limit / 2;
|
||||||
case SliceType::After: return 1 - limit;
|
// case SliceType::After: return 1 - limit;
|
||||||
}
|
// }
|
||||||
Unexpected("Direction in PrepareSearchRequest");
|
// Unexpected("Direction in PrepareSearchRequest");
|
||||||
}();
|
// }();
|
||||||
const auto hash = int32(0);
|
// const auto hash = int32(0);
|
||||||
const auto flags = (messageId && messageId.fullId.channel)
|
// const auto flags = (messageId && messageId.fullId.channel)
|
||||||
? MTPchannels_GetFeed::Flag::f_offset_position
|
// ? MTPchannels_GetFeed::Flag::f_offset_position
|
||||||
: MTPchannels_GetFeed::Flag::f_offset_to_max_read;
|
// : MTPchannels_GetFeed::Flag::f_offset_to_max_read;
|
||||||
const auto requestId = request(MTPchannels_GetFeed(
|
// const auto requestId = request(MTPchannels_GetFeed(
|
||||||
MTP_flags(flags),
|
// MTP_flags(flags),
|
||||||
MTP_int(feed->id()),
|
// MTP_int(feed->id()),
|
||||||
MTP_feedPosition(
|
// MTP_feedPosition(
|
||||||
MTP_int(messageId.date),
|
// MTP_int(messageId.date),
|
||||||
MTP_peerChannel(MTP_int(messageId.fullId.channel)),
|
// MTP_peerChannel(MTP_int(messageId.fullId.channel)),
|
||||||
MTP_int(messageId.fullId.msg)),
|
// MTP_int(messageId.fullId.msg)),
|
||||||
MTP_int(addOffset),
|
// MTP_int(addOffset),
|
||||||
MTP_int(limit),
|
// MTP_int(limit),
|
||||||
MTPFeedPosition(),
|
// MTPFeedPosition(),
|
||||||
MTPFeedPosition(),
|
// MTPFeedPosition(),
|
||||||
MTP_int(hash)
|
// MTP_int(hash)
|
||||||
)).done([=](const MTPmessages_FeedMessages &result) {
|
// )).done([=](const MTPmessages_FeedMessages &result) {
|
||||||
const auto key = std::make_tuple(feed, messageId, slice);
|
// const auto key = std::make_tuple(feed, messageId, slice);
|
||||||
_feedMessagesRequests.remove(key);
|
// _feedMessagesRequests.remove(key);
|
||||||
feedMessagesDone(feed, messageId, slice, result);
|
// feedMessagesDone(feed, messageId, slice, result);
|
||||||
}).fail([=](const RPCError &error) {
|
// }).fail([=](const RPCError &error) {
|
||||||
_feedMessagesRequests.remove(key);
|
// _feedMessagesRequests.remove(key);
|
||||||
if (error.type() == qstr("SOURCES_HASH_INVALID")) {
|
// if (error.type() == qstr("SOURCES_HASH_INVALID")) {
|
||||||
_feedMessagesRequestsPending.emplace(key);
|
// _feedMessagesRequestsPending.emplace(key);
|
||||||
requestFeedChannels(feed);
|
// requestFeedChannels(feed);
|
||||||
}
|
// }
|
||||||
}).send();
|
// }).send();
|
||||||
_feedMessagesRequests.emplace(key);
|
// _feedMessagesRequests.emplace(key);
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
void ApiWrap::feedMessagesDone(
|
//void ApiWrap::feedMessagesDone(
|
||||||
not_null<Data::Feed*> feed,
|
// not_null<Data::Feed*> feed,
|
||||||
Data::MessagePosition messageId,
|
// Data::MessagePosition messageId,
|
||||||
SliceType slice,
|
// SliceType slice,
|
||||||
const MTPmessages_FeedMessages &result) {
|
// const MTPmessages_FeedMessages &result) {
|
||||||
if (result.type() == mtpc_messages_feedMessagesNotModified) {
|
// if (result.type() == mtpc_messages_feedMessagesNotModified) {
|
||||||
LOG(("API Error: Unexpected messages.feedMessagesNotModified."));
|
// LOG(("API Error: Unexpected messages.feedMessagesNotModified."));
|
||||||
_session->storage().add(Storage::FeedMessagesAddSlice(
|
// _session->storage().add(Storage::FeedMessagesAddSlice(
|
||||||
feed->id(),
|
// feed->id(),
|
||||||
std::vector<Data::MessagePosition>(),
|
// std::vector<Data::MessagePosition>(),
|
||||||
Data::FullMessagesRange));
|
// Data::FullMessagesRange));
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
Assert(result.type() == mtpc_messages_feedMessages);
|
// Assert(result.type() == mtpc_messages_feedMessages);
|
||||||
const auto &data = result.c_messages_feedMessages();
|
// const auto &data = result.c_messages_feedMessages();
|
||||||
const auto &messages = data.vmessages.v;
|
// const auto &messages = data.vmessages.v;
|
||||||
const auto type = NewMessageExisting;
|
// const auto type = NewMessageExisting;
|
||||||
|
//
|
||||||
auto ids = std::vector<Data::MessagePosition>();
|
// auto ids = std::vector<Data::MessagePosition>();
|
||||||
auto noSkipRange = Data::MessagesRange(messageId, messageId);
|
// auto noSkipRange = Data::MessagesRange(messageId, messageId);
|
||||||
const auto accumulateFrom = [](auto &from, const auto &candidate) {
|
// const auto accumulateFrom = [](auto &from, const auto &candidate) {
|
||||||
if (!from || from > candidate) {
|
// if (!from || from > candidate) {
|
||||||
from = candidate;
|
// from = candidate;
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
const auto accumulateTill = [](auto &till, const auto &candidate) {
|
// const auto accumulateTill = [](auto &till, const auto &candidate) {
|
||||||
if (!till || till < candidate) {
|
// if (!till || till < candidate) {
|
||||||
till = candidate;
|
// till = candidate;
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
const auto tooLargePosition = [&](const auto &position) {
|
// const auto tooLargePosition = [&](const auto &position) {
|
||||||
return (slice == SliceType::Before) && !(position < messageId);
|
// return (slice == SliceType::Before) && !(position < messageId);
|
||||||
};
|
// };
|
||||||
const auto tooSmallPosition = [&](const auto &position) {
|
// const auto tooSmallPosition = [&](const auto &position) {
|
||||||
return (slice == SliceType::After) && !(messageId < position);
|
// return (slice == SliceType::After) && !(messageId < position);
|
||||||
};
|
// };
|
||||||
App::feedUsers(data.vusers);
|
// App::feedUsers(data.vusers);
|
||||||
App::feedChats(data.vchats);
|
// App::feedChats(data.vchats);
|
||||||
if (!messages.empty()) {
|
// if (!messages.empty()) {
|
||||||
ids.reserve(messages.size());
|
// ids.reserve(messages.size());
|
||||||
for (const auto &msg : messages) {
|
// for (const auto &msg : messages) {
|
||||||
if (const auto item = App::histories().addNewMessage(msg, type)) {
|
// if (const auto item = App::histories().addNewMessage(msg, type)) {
|
||||||
const auto position = item->position();
|
// const auto position = item->position();
|
||||||
if (tooLargePosition(position)) {
|
// if (tooLargePosition(position)) {
|
||||||
accumulateTill(noSkipRange.till, position);
|
// accumulateTill(noSkipRange.till, position);
|
||||||
continue;
|
// continue;
|
||||||
} else if (tooSmallPosition(position)) {
|
// } else if (tooSmallPosition(position)) {
|
||||||
accumulateFrom(noSkipRange.from, position);
|
// accumulateFrom(noSkipRange.from, position);
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
ids.push_back(position);
|
// ids.push_back(position);
|
||||||
accumulateFrom(noSkipRange.from, position);
|
// accumulateFrom(noSkipRange.from, position);
|
||||||
accumulateTill(noSkipRange.till, position);
|
// accumulateTill(noSkipRange.till, position);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
ranges::reverse(ids);
|
// ranges::reverse(ids);
|
||||||
}
|
// }
|
||||||
if (data.has_min_position() && !ids.empty()) {
|
// if (data.has_min_position() && !ids.empty()) {
|
||||||
accumulateFrom(
|
// accumulateFrom(
|
||||||
noSkipRange.from,
|
// noSkipRange.from,
|
||||||
Data::FeedPositionFromMTP(data.vmin_position));
|
// Data::FeedPositionFromMTP(data.vmin_position));
|
||||||
} else if (slice == SliceType::Before) {
|
// } else if (slice == SliceType::Before) {
|
||||||
noSkipRange.from = Data::MinMessagePosition;
|
// noSkipRange.from = Data::MinMessagePosition;
|
||||||
}
|
// }
|
||||||
if (data.has_max_position() && !ids.empty()) {
|
// if (data.has_max_position() && !ids.empty()) {
|
||||||
accumulateTill(
|
// accumulateTill(
|
||||||
noSkipRange.till,
|
// noSkipRange.till,
|
||||||
Data::FeedPositionFromMTP(data.vmax_position));
|
// Data::FeedPositionFromMTP(data.vmax_position));
|
||||||
} else if (slice == SliceType::After) {
|
// } else if (slice == SliceType::After) {
|
||||||
noSkipRange.till = Data::MaxMessagePosition;
|
// noSkipRange.till = Data::MaxMessagePosition;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
const auto unreadPosition = [&] {
|
// const auto unreadPosition = [&] {
|
||||||
if (data.has_read_max_position()) {
|
// if (data.has_read_max_position()) {
|
||||||
return Data::FeedPositionFromMTP(data.vread_max_position);
|
// return Data::FeedPositionFromMTP(data.vread_max_position);
|
||||||
} else if (!messageId) {
|
// } else if (!messageId) {
|
||||||
const auto result = ids.empty()
|
// const auto result = ids.empty()
|
||||||
? noSkipRange.till
|
// ? noSkipRange.till
|
||||||
: ids.back();
|
// : ids.back();
|
||||||
return Data::MessagePosition(
|
// return Data::MessagePosition(
|
||||||
result.date,
|
// result.date,
|
||||||
FullMsgId(result.fullId.channel, result.fullId.msg - 1));
|
// FullMsgId(result.fullId.channel, result.fullId.msg - 1));
|
||||||
}
|
// }
|
||||||
return Data::MessagePosition();
|
// return Data::MessagePosition();
|
||||||
}();
|
// }();
|
||||||
|
//
|
||||||
_session->storage().add(Storage::FeedMessagesAddSlice(
|
// _session->storage().add(Storage::FeedMessagesAddSlice(
|
||||||
feed->id(),
|
// feed->id(),
|
||||||
std::move(ids),
|
// std::move(ids),
|
||||||
noSkipRange));
|
// noSkipRange));
|
||||||
|
//
|
||||||
if (unreadPosition) {
|
// if (unreadPosition) {
|
||||||
feed->setUnreadPosition(unreadPosition);
|
// feed->setUnreadPosition(unreadPosition);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
void ApiWrap::saveDefaultFeedId(FeedId id, bool isDefaultFeedId) {
|
//void ApiWrap::saveDefaultFeedId(FeedId id, bool isDefaultFeedId) {
|
||||||
if (const auto already = base::take(_saveDefaultFeedIdRequest)) {
|
// if (const auto already = base::take(_saveDefaultFeedIdRequest)) {
|
||||||
request(already).cancel();
|
// request(already).cancel();
|
||||||
}
|
// }
|
||||||
_saveDefaultFeedIdRequest = request(MTPchannels_SetFeedBroadcasts(
|
// _saveDefaultFeedIdRequest = request(MTPchannels_SetFeedBroadcasts(
|
||||||
MTP_flags(MTPchannels_SetFeedBroadcasts::Flag::f_also_newly_joined),
|
// MTP_flags(MTPchannels_SetFeedBroadcasts::Flag::f_also_newly_joined),
|
||||||
MTP_int(id),
|
// MTP_int(id),
|
||||||
MTPVector<MTPInputChannel>(),
|
// MTPVector<MTPInputChannel>(),
|
||||||
MTP_bool(isDefaultFeedId)
|
// MTP_bool(isDefaultFeedId)
|
||||||
)).send();
|
// )).send();
|
||||||
}
|
//}
|
||||||
|
|
||||||
void ApiWrap::sendAction(const SendOptions &options) {
|
void ApiWrap::sendAction(const SendOptions &options) {
|
||||||
readServerHistory(options.history);
|
readServerHistory(options.history);
|
||||||
|
@ -3936,38 +3936,38 @@ void ApiWrap::readFeed(
|
||||||
void ApiWrap::readFeeds() {
|
void ApiWrap::readFeeds() {
|
||||||
auto delay = kFeedReadTimeout;
|
auto delay = kFeedReadTimeout;
|
||||||
const auto now = getms(true);
|
const auto now = getms(true);
|
||||||
for (auto i = begin(_feedReadsDelayed); i != end(_feedReadsDelayed);) {
|
//for (auto i = begin(_feedReadsDelayed); i != end(_feedReadsDelayed);) { // #feed
|
||||||
const auto feed = i->first;
|
// const auto feed = i->first;
|
||||||
const auto time = i->second;
|
// const auto time = i->second;
|
||||||
// Clang fails to capture structure-binded feed to lambda :(
|
// // Clang fails to capture structure-binded feed to lambda :(
|
||||||
//const auto [feed, time] = *i;
|
// //const auto [feed, time] = *i;
|
||||||
if (time > now) {
|
// if (time > now) {
|
||||||
accumulate_min(delay, time - now);
|
// accumulate_min(delay, time - now);
|
||||||
++i;
|
// ++i;
|
||||||
} else if (_feedReadRequests.contains(feed)) {
|
// } else if (_feedReadRequests.contains(feed)) {
|
||||||
++i;
|
// ++i;
|
||||||
} else {
|
// } else {
|
||||||
const auto position = feed->unreadPosition();
|
// const auto position = feed->unreadPosition();
|
||||||
const auto requestId = request(MTPchannels_ReadFeed(
|
// const auto requestId = request(MTPchannels_ReadFeed(
|
||||||
MTP_int(feed->id()),
|
// MTP_int(feed->id()),
|
||||||
MTP_feedPosition(
|
// MTP_feedPosition(
|
||||||
MTP_int(position.date),
|
// MTP_int(position.date),
|
||||||
MTP_peerChannel(MTP_int(position.fullId.channel)),
|
// MTP_peerChannel(MTP_int(position.fullId.channel)),
|
||||||
MTP_int(position.fullId.msg))
|
// MTP_int(position.fullId.msg))
|
||||||
)).done([=](const MTPUpdates &result) {
|
// )).done([=](const MTPUpdates &result) {
|
||||||
applyUpdates(result);
|
// applyUpdates(result);
|
||||||
_feedReadRequests.remove(feed);
|
// _feedReadRequests.remove(feed);
|
||||||
}).fail([=](const RPCError &error) {
|
// }).fail([=](const RPCError &error) {
|
||||||
_feedReadRequests.remove(feed);
|
// _feedReadRequests.remove(feed);
|
||||||
}).send();
|
// }).send();
|
||||||
_feedReadRequests.emplace(feed, requestId);
|
// _feedReadRequests.emplace(feed, requestId);
|
||||||
|
|
||||||
i = _feedReadsDelayed.erase(i);
|
// i = _feedReadsDelayed.erase(i);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
if (!_feedReadsDelayed.empty()) {
|
//if (!_feedReadsDelayed.empty()) {
|
||||||
_feedReadTimer.callOnce(delay);
|
// _feedReadTimer.callOnce(delay);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApiWrap::sendReadRequest(not_null<PeerData*> peer, MsgId upTo) {
|
void ApiWrap::sendReadRequest(not_null<PeerData*> peer, MsgId upTo) {
|
||||||
|
|
|
@ -60,11 +60,11 @@ public:
|
||||||
void applyUpdates(const MTPUpdates &updates, uint64 sentMessageRandomId = 0);
|
void applyUpdates(const MTPUpdates &updates, uint64 sentMessageRandomId = 0);
|
||||||
|
|
||||||
void savePinnedOrder();
|
void savePinnedOrder();
|
||||||
void toggleChannelGrouping(
|
//void toggleChannelGrouping( // #feed
|
||||||
not_null<ChannelData*> channel,
|
// not_null<ChannelData*> channel,
|
||||||
bool group,
|
// bool group,
|
||||||
base::lambda<void()> callback);
|
// base::lambda<void()> callback);
|
||||||
void ungroupAllFromFeed(not_null<Data::Feed*> feed);
|
//void ungroupAllFromFeed(not_null<Data::Feed*> feed);
|
||||||
|
|
||||||
using RequestMessageDataCallback = base::lambda<void(ChannelData*, MsgId)>;
|
using RequestMessageDataCallback = base::lambda<void(ChannelData*, MsgId)>;
|
||||||
void requestMessageData(
|
void requestMessageData(
|
||||||
|
@ -76,10 +76,10 @@ public:
|
||||||
void requestDialogEntry(not_null<Data::Feed*> feed);
|
void requestDialogEntry(not_null<Data::Feed*> feed);
|
||||||
//void requestFeedDialogsEntries(not_null<Data::Feed*> feed);
|
//void requestFeedDialogsEntries(not_null<Data::Feed*> feed);
|
||||||
void requestDialogEntry(not_null<History*> history);
|
void requestDialogEntry(not_null<History*> history);
|
||||||
void applyFeedSources(const MTPDchannels_feedSources &data);
|
//void applyFeedSources(const MTPDchannels_feedSources &data); // #feed
|
||||||
void setFeedChannels(
|
//void setFeedChannels(
|
||||||
not_null<Data::Feed*> feed,
|
// not_null<Data::Feed*> feed,
|
||||||
const std::vector<not_null<ChannelData*>> &channels);
|
// const std::vector<not_null<ChannelData*>> &channels);
|
||||||
|
|
||||||
void requestFullPeer(PeerData *peer);
|
void requestFullPeer(PeerData *peer);
|
||||||
void requestPeer(PeerData *peer);
|
void requestPeer(PeerData *peer);
|
||||||
|
@ -180,13 +180,13 @@ public:
|
||||||
not_null<UserData*> user,
|
not_null<UserData*> user,
|
||||||
PhotoId afterId);
|
PhotoId afterId);
|
||||||
|
|
||||||
void requestFeedChannels(
|
//void requestFeedChannels( // #feed
|
||||||
not_null<Data::Feed*> feed);
|
// not_null<Data::Feed*> feed);
|
||||||
void requestFeedMessages(
|
//void requestFeedMessages(
|
||||||
not_null<Data::Feed*> feed,
|
// not_null<Data::Feed*> feed,
|
||||||
Data::MessagePosition messageId,
|
// Data::MessagePosition messageId,
|
||||||
SliceType slice);
|
// SliceType slice);
|
||||||
void saveDefaultFeedId(FeedId id, bool isDefaultFeedId);
|
//void saveDefaultFeedId(FeedId id, bool isDefaultFeedId);
|
||||||
|
|
||||||
void stickerSetInstalled(uint64 setId) {
|
void stickerSetInstalled(uint64 setId) {
|
||||||
_stickerSetInstalled.fire_copy(setId);
|
_stickerSetInstalled.fire_copy(setId);
|
||||||
|
@ -375,12 +375,12 @@ private:
|
||||||
PhotoId photoId,
|
PhotoId photoId,
|
||||||
const MTPphotos_Photos &result);
|
const MTPphotos_Photos &result);
|
||||||
|
|
||||||
void feedChannelsDone(not_null<Data::Feed*> feed);
|
//void feedChannelsDone(not_null<Data::Feed*> feed); // #feed
|
||||||
void feedMessagesDone(
|
//void feedMessagesDone(
|
||||||
not_null<Data::Feed*> feed,
|
// not_null<Data::Feed*> feed,
|
||||||
Data::MessagePosition messageId,
|
// Data::MessagePosition messageId,
|
||||||
SliceType slice,
|
// SliceType slice,
|
||||||
const MTPmessages_FeedMessages &result);
|
// const MTPmessages_FeedMessages &result);
|
||||||
|
|
||||||
void sendSharedContact(
|
void sendSharedContact(
|
||||||
const QString &phone,
|
const QString &phone,
|
||||||
|
|
|
@ -563,11 +563,11 @@ namespace {
|
||||||
cdata->setRestrictionReason(QString());
|
cdata->setRestrictionReason(QString());
|
||||||
}
|
}
|
||||||
cdata->setFlags(d.vflags.v);
|
cdata->setFlags(d.vflags.v);
|
||||||
if (d.has_feed_id()) {
|
//if (d.has_feed_id()) { // #feed
|
||||||
cdata->setFeed(Auth().data().feed(d.vfeed_id.v));
|
// cdata->setFeed(Auth().data().feed(d.vfeed_id.v));
|
||||||
} else {
|
//} else {
|
||||||
cdata->clearFeed();
|
// cdata->clearFeed();
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString uname = d.has_username() ? TextUtilities::SingleLine(qs(d.vusername)) : QString();
|
QString uname = d.has_username() ? TextUtilities::SingleLine(qs(d.vusername)) : QString();
|
||||||
|
|
|
@ -20,14 +20,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
namespace Data {
|
namespace Data {
|
||||||
|
|
||||||
MessagePosition FeedPositionFromMTP(const MTPFeedPosition &position) {
|
// #feed
|
||||||
Expects(position.type() == mtpc_feedPosition);
|
//MessagePosition FeedPositionFromMTP(const MTPFeedPosition &position) {
|
||||||
|
// Expects(position.type() == mtpc_feedPosition);
|
||||||
const auto &data = position.c_feedPosition();
|
//
|
||||||
return MessagePosition(data.vdate.v, FullMsgId(
|
// const auto &data = position.c_feedPosition();
|
||||||
peerToChannel(peerFromMTP(data.vpeer)),
|
// return MessagePosition(data.vdate.v, FullMsgId(
|
||||||
data.vid.v));
|
// peerToChannel(peerFromMTP(data.vpeer)),
|
||||||
}
|
// data.vid.v));
|
||||||
|
//}
|
||||||
|
|
||||||
Feed::Feed(FeedId id, not_null<Data::Session*> parent)
|
Feed::Feed(FeedId id, not_null<Data::Session*> parent)
|
||||||
: Entry(this)
|
: Entry(this)
|
||||||
|
@ -328,36 +329,36 @@ rpl::producer<int> Feed::unreadCountValue() const {
|
||||||
bool Feed::unreadCountKnown() const {
|
bool Feed::unreadCountKnown() const {
|
||||||
return !!_unreadCount;
|
return !!_unreadCount;
|
||||||
}
|
}
|
||||||
|
// #feed
|
||||||
void Feed::applyDialog(const MTPDdialogFeed &data) {
|
//void Feed::applyDialog(const MTPDdialogFeed &data) {
|
||||||
const auto addChannel = [&](ChannelId channelId) {
|
// const auto addChannel = [&](ChannelId channelId) {
|
||||||
if (const auto channel = App::channelLoaded(channelId)) {
|
// if (const auto channel = App::channelLoaded(channelId)) {
|
||||||
channel->setFeed(this);
|
// channel->setFeed(this);
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
for (const auto &channelId : data.vfeed_other_channels.v) {
|
// for (const auto &channelId : data.vfeed_other_channels.v) {
|
||||||
addChannel(channelId.v);
|
// addChannel(channelId.v);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
_lastMessage = nullptr;
|
// _lastMessage = nullptr;
|
||||||
if (const auto peerId = peerFromMTP(data.vpeer)) {
|
// if (const auto peerId = peerFromMTP(data.vpeer)) {
|
||||||
if (const auto channelId = peerToChannel(peerId)) {
|
// if (const auto channelId = peerToChannel(peerId)) {
|
||||||
addChannel(channelId);
|
// addChannel(channelId);
|
||||||
const auto fullId = FullMsgId(channelId, data.vtop_message.v);
|
// const auto fullId = FullMsgId(channelId, data.vtop_message.v);
|
||||||
if (const auto item = App::histItemById(fullId)) {
|
// if (const auto item = App::histItemById(fullId)) {
|
||||||
justUpdateLastMessage(item);
|
// justUpdateLastMessage(item);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
updateChatsListDate();
|
// updateChatsListDate();
|
||||||
|
//
|
||||||
setUnreadCounts(
|
// setUnreadCounts(
|
||||||
data.vunread_count.v,
|
// data.vunread_count.v,
|
||||||
data.vunread_muted_count.v);
|
// data.vunread_muted_count.v);
|
||||||
if (data.has_read_max_position()) {
|
// if (data.has_read_max_position()) {
|
||||||
setUnreadPosition(FeedPositionFromMTP(data.vread_max_position));
|
// setUnreadPosition(FeedPositionFromMTP(data.vread_max_position));
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
void Feed::changedInChatListHook(Dialogs::Mode list, bool added) {
|
void Feed::changedInChatListHook(Dialogs::Mode list, bool added) {
|
||||||
if (list == Dialogs::Mode::All && unreadCount()) {
|
if (list == Dialogs::Mode::All && unreadCount()) {
|
||||||
|
|
|
@ -27,7 +27,7 @@ struct FeedUpdate {
|
||||||
FeedUpdateFlag flag;
|
FeedUpdateFlag flag;
|
||||||
};
|
};
|
||||||
|
|
||||||
MessagePosition FeedPositionFromMTP(const MTPFeedPosition &position);
|
//MessagePosition FeedPositionFromMTP(const MTPFeedPosition &position); // #feed
|
||||||
|
|
||||||
class Feed : public Dialogs::Entry {
|
class Feed : public Dialogs::Entry {
|
||||||
public:
|
public:
|
||||||
|
@ -44,7 +44,7 @@ public:
|
||||||
void messageRemoved(not_null<HistoryItem*> item);
|
void messageRemoved(not_null<HistoryItem*> item);
|
||||||
void historyCleared(not_null<History*> history);
|
void historyCleared(not_null<History*> history);
|
||||||
|
|
||||||
void applyDialog(const MTPDdialogFeed &data);
|
//void applyDialog(const MTPDdialogFeed &data); // #feed
|
||||||
void setUnreadCounts(int unreadNonMutedCount, int unreadMutedCount);
|
void setUnreadCounts(int unreadNonMutedCount, int unreadMutedCount);
|
||||||
void setUnreadPosition(const MessagePosition &position);
|
void setUnreadPosition(const MessagePosition &position);
|
||||||
void unreadCountChanged(
|
void unreadCountChanged(
|
||||||
|
|
|
@ -31,10 +31,10 @@ rpl::producer<MessagesSlice> FeedMessagesViewer(
|
||||||
using AroundData = MessagesSliceBuilder::AroundData;
|
using AroundData = MessagesSliceBuilder::AroundData;
|
||||||
const auto requestMediaAround = [=](const AroundData &data) {
|
const auto requestMediaAround = [=](const AroundData &data) {
|
||||||
if (data.aroundId || !key.position) {
|
if (data.aroundId || !key.position) {
|
||||||
Auth().api().requestFeedMessages(
|
//Auth().api().requestFeedMessages( // #feed
|
||||||
feed,
|
// feed,
|
||||||
data.aroundId,
|
// data.aroundId,
|
||||||
data.direction);
|
// data.direction);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
builder->insufficientAround(
|
builder->insufficientAround(
|
||||||
|
|
|
@ -426,11 +426,11 @@ void Session::applyPinnedDialogs(const QVector<MTPDialog> &list) {
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case mtpc_dialogFeed: {
|
//case mtpc_dialogFeed: { // #feed
|
||||||
const auto &feedData = dialog.c_dialogFeed();
|
// const auto &feedData = dialog.c_dialogFeed();
|
||||||
const auto feedId = feedData.vfeed_id.v;
|
// const auto feedId = feedData.vfeed_id.v;
|
||||||
setPinnedDialog(feed(feedId), true);
|
// setPinnedDialog(feed(feedId), true);
|
||||||
} break;
|
//} break;
|
||||||
|
|
||||||
default: Unexpected("Type in ApiWrap::applyDialogsPinned.");
|
default: Unexpected("Type in ApiWrap::applyDialogsPinned.");
|
||||||
}
|
}
|
||||||
|
@ -448,11 +448,11 @@ void Session::applyPinnedDialogs(const QVector<MTPDialogPeer> &list) {
|
||||||
setPinnedDialog(App::history(peerId), true);
|
setPinnedDialog(App::history(peerId), true);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case mtpc_dialogPeerFeed: {
|
//case mtpc_dialogPeerFeed: { // #feed
|
||||||
const auto &feedData = dialogPeer.c_dialogPeerFeed();
|
// const auto &feedData = dialogPeer.c_dialogPeerFeed();
|
||||||
const auto feedId = feedData.vfeed_id.v;
|
// const auto feedId = feedData.vfeed_id.v;
|
||||||
setPinnedDialog(feed(feedId), true);
|
// setPinnedDialog(feed(feedId), true);
|
||||||
} break;
|
//} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1754,7 +1754,7 @@ void DialogsInner::dialogsReceived(const QVector<MTPDialog> &added) {
|
||||||
for (const auto &dialog : added) {
|
for (const auto &dialog : added) {
|
||||||
switch (dialog.type()) {
|
switch (dialog.type()) {
|
||||||
case mtpc_dialog: applyDialog(dialog.c_dialog()); break;
|
case mtpc_dialog: applyDialog(dialog.c_dialog()); break;
|
||||||
case mtpc_dialogFeed: applyFeedDialog(dialog.c_dialogFeed()); break;
|
//case mtpc_dialogFeed: applyFeedDialog(dialog.c_dialogFeed()); break; // #feed
|
||||||
default: Unexpected("Type in DialogsInner::dialogsReceived");
|
default: Unexpected("Type in DialogsInner::dialogsReceived");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1787,19 +1787,19 @@ void DialogsInner::applyDialog(const MTPDdialog &dialog) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// #feed
|
||||||
void DialogsInner::applyFeedDialog(const MTPDdialogFeed &dialog) {
|
//void DialogsInner::applyFeedDialog(const MTPDdialogFeed &dialog) {
|
||||||
const auto feedId = dialog.vfeed_id.v;
|
// const auto feedId = dialog.vfeed_id.v;
|
||||||
const auto feed = Auth().data().feed(feedId);
|
// const auto feed = Auth().data().feed(feedId);
|
||||||
feed->applyDialog(dialog);
|
// feed->applyDialog(dialog);
|
||||||
|
//
|
||||||
if (!feed->isPinnedDialog()) {
|
// if (!feed->isPinnedDialog()) {
|
||||||
const auto date = feed->chatsListDate();
|
// const auto date = feed->chatsListDate();
|
||||||
if (!date.isNull()) {
|
// if (!date.isNull()) {
|
||||||
addSavedPeersAfter(date);
|
// addSavedPeersAfter(date);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
void DialogsInner::addSavedPeersAfter(const QDateTime &date) {
|
void DialogsInner::addSavedPeersAfter(const QDateTime &date) {
|
||||||
auto &saved = cRefSavedPeersByTime();
|
auto &saved = cRefSavedPeersByTime();
|
||||||
|
|
|
@ -193,7 +193,7 @@ private:
|
||||||
const base::flat_set<QChar> &oldLetters);
|
const base::flat_set<QChar> &oldLetters);
|
||||||
|
|
||||||
void applyDialog(const MTPDdialog &dialog);
|
void applyDialog(const MTPDdialog &dialog);
|
||||||
void applyFeedDialog(const MTPDdialogFeed &dialog);
|
// void applyFeedDialog(const MTPDdialogFeed &dialog); // #feed
|
||||||
|
|
||||||
void itemRemoved(not_null<const HistoryItem*> item);
|
void itemRemoved(not_null<const HistoryItem*> item);
|
||||||
enum class UpdateRowSection {
|
enum class UpdateRowSection {
|
||||||
|
|
|
@ -389,7 +389,7 @@ void DialogsWidget::updateDialogsOffset(
|
||||||
const auto &dialog = dialogs[--i];
|
const auto &dialog = dialogs[--i];
|
||||||
switch (dialog.type()) {
|
switch (dialog.type()) {
|
||||||
case mtpc_dialog: fillFromDialog(dialog.c_dialog()); break;
|
case mtpc_dialog: fillFromDialog(dialog.c_dialog()); break;
|
||||||
case mtpc_dialogFeed: fillFromDialog(dialog.c_dialogFeed()); break;
|
// case mtpc_dialogFeed: fillFromDialog(dialog.c_dialogFeed()); break; // #feed
|
||||||
default: Unexpected("Type in DialogsWidget::updateDialogsOffset");
|
default: Unexpected("Type in DialogsWidget::updateDialogsOffset");
|
||||||
}
|
}
|
||||||
if (lastDate) {
|
if (lastDate) {
|
||||||
|
@ -518,16 +518,16 @@ bool DialogsWidget::onSearchMessages(bool searchCache) {
|
||||||
rpcDone(&DialogsWidget::searchReceived, DialogsSearchPeerFromStart),
|
rpcDone(&DialogsWidget::searchReceived, DialogsSearchPeerFromStart),
|
||||||
rpcFail(&DialogsWidget::searchFailed, DialogsSearchPeerFromStart));
|
rpcFail(&DialogsWidget::searchFailed, DialogsSearchPeerFromStart));
|
||||||
} else if (const auto feed = _searchInChat.feed()) {
|
} else if (const auto feed = _searchInChat.feed()) {
|
||||||
_searchRequest = MTP::send(
|
//_searchRequest = MTP::send( // #feed
|
||||||
MTPchannels_SearchFeed(
|
// MTPchannels_SearchFeed(
|
||||||
MTP_int(feed->id()),
|
// MTP_int(feed->id()),
|
||||||
MTP_string(_searchQuery),
|
// MTP_string(_searchQuery),
|
||||||
MTP_int(0),
|
// MTP_int(0),
|
||||||
MTP_inputPeerEmpty(),
|
// MTP_inputPeerEmpty(),
|
||||||
MTP_int(0),
|
// MTP_int(0),
|
||||||
MTP_int(SearchPerPage)),
|
// MTP_int(SearchPerPage)),
|
||||||
rpcDone(&DialogsWidget::searchReceived, DialogsSearchFromStart),
|
// rpcDone(&DialogsWidget::searchReceived, DialogsSearchFromStart),
|
||||||
rpcFail(&DialogsWidget::searchFailed, DialogsSearchFromStart));
|
// rpcFail(&DialogsWidget::searchFailed, DialogsSearchFromStart));
|
||||||
} else {
|
} else {
|
||||||
_searchRequest = MTP::send(
|
_searchRequest = MTP::send(
|
||||||
MTPmessages_SearchGlobal(
|
MTPmessages_SearchGlobal(
|
||||||
|
@ -637,18 +637,18 @@ void DialogsWidget::onSearchMore() {
|
||||||
rpcDone(&DialogsWidget::searchReceived, offsetId ? DialogsSearchPeerFromOffset : DialogsSearchPeerFromStart),
|
rpcDone(&DialogsWidget::searchReceived, offsetId ? DialogsSearchPeerFromOffset : DialogsSearchPeerFromStart),
|
||||||
rpcFail(&DialogsWidget::searchFailed, offsetId ? DialogsSearchPeerFromOffset : DialogsSearchPeerFromStart));
|
rpcFail(&DialogsWidget::searchFailed, offsetId ? DialogsSearchPeerFromOffset : DialogsSearchPeerFromStart));
|
||||||
} else if (const auto feed = _searchInChat.feed()) {
|
} else if (const auto feed = _searchInChat.feed()) {
|
||||||
_searchRequest = MTP::send(
|
//_searchRequest = MTP::send( // #feed
|
||||||
MTPchannels_SearchFeed(
|
// MTPchannels_SearchFeed(
|
||||||
MTP_int(feed->id()),
|
// MTP_int(feed->id()),
|
||||||
MTP_string(_searchQuery),
|
// MTP_string(_searchQuery),
|
||||||
MTP_int(offsetDate),
|
// MTP_int(offsetDate),
|
||||||
offsetPeer
|
// offsetPeer
|
||||||
? offsetPeer->input
|
// ? offsetPeer->input
|
||||||
: MTP_inputPeerEmpty(),
|
// : MTP_inputPeerEmpty(),
|
||||||
MTP_int(offsetId),
|
// MTP_int(offsetId),
|
||||||
MTP_int(SearchPerPage)),
|
// MTP_int(SearchPerPage)),
|
||||||
rpcDone(&DialogsWidget::searchReceived, offsetId ? DialogsSearchFromOffset : DialogsSearchFromStart),
|
// rpcDone(&DialogsWidget::searchReceived, offsetId ? DialogsSearchFromOffset : DialogsSearchFromStart),
|
||||||
rpcFail(&DialogsWidget::searchFailed, offsetId ? DialogsSearchFromOffset : DialogsSearchFromStart));
|
// rpcFail(&DialogsWidget::searchFailed, offsetId ? DialogsSearchFromOffset : DialogsSearchFromStart));
|
||||||
} else {
|
} else {
|
||||||
_searchRequest = MTP::send(
|
_searchRequest = MTP::send(
|
||||||
MTPmessages_SearchGlobal(
|
MTPmessages_SearchGlobal(
|
||||||
|
@ -707,7 +707,7 @@ void DialogsWidget::loadDialogs() {
|
||||||
_dialogsRequestId = MTP::send(
|
_dialogsRequestId = MTP::send(
|
||||||
MTPmessages_GetDialogs(
|
MTPmessages_GetDialogs(
|
||||||
MTP_flags(flags),
|
MTP_flags(flags),
|
||||||
MTP_int(feedId),
|
//MTP_int(feedId), // #feed
|
||||||
MTP_int(_dialogsOffsetDate),
|
MTP_int(_dialogsOffsetDate),
|
||||||
MTP_int(_dialogsOffsetId),
|
MTP_int(_dialogsOffsetId),
|
||||||
_dialogsOffsetPeer
|
_dialogsOffsetPeer
|
||||||
|
|
|
@ -37,9 +37,9 @@ void AddToggleGroupingAction(
|
||||||
not_null<PeerData*> peer) {
|
not_null<PeerData*> peer) {
|
||||||
if (const auto channel = peer->asChannel()) {
|
if (const auto channel = peer->asChannel()) {
|
||||||
const auto grouped = (channel->feed() != nullptr);
|
const auto grouped = (channel->feed() != nullptr);
|
||||||
menu->addAction(
|
//menu->addAction( // #feed
|
||||||
lang(grouped ? lng_feed_ungroup : lng_feed_group),
|
// lang(grouped ? lng_feed_ungroup : lng_feed_group),
|
||||||
[=] { Window::ToggleChannelGrouping(channel, !grouped); });
|
// [=] { Window::ToggleChannelGrouping(channel, !grouped); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2406,7 +2406,7 @@ void ListWidget::refreshItem(not_null<const Element*> view) {
|
||||||
if (const auto i = _views.find(item); i != end(_views)) {
|
if (const auto i = _views.find(item); i != end(_views)) {
|
||||||
auto result = std::move(i->second);
|
auto result = std::move(i->second);
|
||||||
_views.erase(i);
|
_views.erase(i);
|
||||||
return std::move(result);
|
return result;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}();
|
}();
|
||||||
|
|
|
@ -96,7 +96,7 @@ ChannelsController::ChannelsController(not_null<Controller*> controller)
|
||||||
, _controller(controller)
|
, _controller(controller)
|
||||||
, _feed(_controller->key().feed()) {
|
, _feed(_controller->key().feed()) {
|
||||||
if (!_feed->channelsLoaded()) {
|
if (!_feed->channelsLoaded()) {
|
||||||
Auth().api().requestFeedChannels(_feed);
|
// Auth().api().requestFeedChannels(_feed); // #feed
|
||||||
}
|
}
|
||||||
_controller->setSearchEnabledByContent(false);
|
_controller->setSearchEnabledByContent(false);
|
||||||
}
|
}
|
||||||
|
@ -198,9 +198,9 @@ base::unique_qptr<Ui::PopupMenu> ChannelsController::rowContextMenu(
|
||||||
base::lambda<void()> handler) {
|
base::lambda<void()> handler) {
|
||||||
return result->addAction(text, handler);
|
return result->addAction(text, handler);
|
||||||
});
|
});
|
||||||
result->addAction(
|
//result->addAction( // #feed
|
||||||
lang(lng_feed_ungroup),
|
// lang(lng_feed_ungroup),
|
||||||
[=] { Window::ToggleChannelGrouping(channel, false); });
|
// [=] { Window::ToggleChannelGrouping(channel, false); });
|
||||||
|
|
||||||
result->addAction(
|
result->addAction(
|
||||||
lang(lng_profile_leave_channel),
|
lang(lng_profile_leave_channel),
|
||||||
|
@ -252,19 +252,19 @@ void NotificationsController::loadMoreRows() {
|
||||||
if (_preloadRequestId || _allLoaded) {
|
if (_preloadRequestId || _allLoaded) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_preloadRequestId = request(MTPmessages_GetDialogs(
|
//_preloadRequestId = request(MTPmessages_GetDialogs( // #feed
|
||||||
MTP_flags(MTPmessages_GetDialogs::Flag::f_feed_id),
|
// MTP_flags(MTPmessages_GetDialogs::Flag::f_feed_id),
|
||||||
MTP_int(_feed->id()),
|
// MTP_int(_feed->id()),
|
||||||
MTP_int(_preloadOffsetDate),
|
// MTP_int(_preloadOffsetDate),
|
||||||
MTP_int(_preloadOffsetId),
|
// MTP_int(_preloadOffsetId),
|
||||||
_preloadPeer ? _preloadPeer->input : MTP_inputPeerEmpty(),
|
// _preloadPeer ? _preloadPeer->input : MTP_inputPeerEmpty(),
|
||||||
MTP_int(Data::Feed::kChannelsLimit)
|
// MTP_int(Data::Feed::kChannelsLimit)
|
||||||
)).done([=](const MTPmessages_Dialogs &result) {
|
//)).done([=](const MTPmessages_Dialogs &result) {
|
||||||
applyFeedDialogs(result);
|
// applyFeedDialogs(result);
|
||||||
_preloadRequestId = 0;
|
// _preloadRequestId = 0;
|
||||||
}).fail([=](const RPCError &error) {
|
//}).fail([=](const RPCError &error) {
|
||||||
_preloadRequestId = 0;
|
// _preloadRequestId = 0;
|
||||||
}).send();
|
//}).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationsController::applyFeedDialogs(
|
void NotificationsController::applyFeedDialogs(
|
||||||
|
@ -310,9 +310,9 @@ void NotificationsController::applyFeedDialogs(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case mtpc_dialogFeed: {
|
//case mtpc_dialogFeed: { // #feed
|
||||||
LOG(("API Error: Unexpected dialogFeed in feed dialogs list."));
|
// LOG(("API Error: Unexpected dialogFeed in feed dialogs list."));
|
||||||
} break;
|
//} break;
|
||||||
default: Unexpected("Type in DialogsInner::dialogsReceived");
|
default: Unexpected("Type in DialogsInner::dialogsReceived");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -360,7 +360,7 @@ void EditController::Start(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
box->closeBox();
|
box->closeBox();
|
||||||
Auth().api().setFeedChannels(feed, channels);
|
//Auth().api().setFeedChannels(feed, channels); // #feed
|
||||||
});
|
});
|
||||||
box->addButton(langFactory(lng_cancel), [box] { box->closeBox(); });
|
box->addButton(langFactory(lng_cancel), [box] { box->closeBox(); });
|
||||||
};
|
};
|
||||||
|
@ -372,8 +372,8 @@ void EditController::Start(
|
||||||
EditController::EditController(
|
EditController::EditController(
|
||||||
not_null<Data::Feed*> feed,
|
not_null<Data::Feed*> feed,
|
||||||
ChannelData *channel)
|
ChannelData *channel)
|
||||||
: _feed(feed)
|
: _feed(feed) {
|
||||||
, _startWithChannel(channel) {
|
//, _startWithChannel(channel) { // #feed
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditController::prepare() {
|
void EditController::prepare() {
|
||||||
|
@ -391,62 +391,62 @@ void EditController::loadMoreRows() {
|
||||||
if (_preloadRequestId || _allLoaded) {
|
if (_preloadRequestId || _allLoaded) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto hash = 0;
|
//const auto hash = 0; // #feed
|
||||||
_preloadRequestId = request(MTPchannels_GetFeedSources(
|
//_preloadRequestId = request(MTPchannels_GetFeedSources(
|
||||||
MTP_flags(0),
|
// MTP_flags(0),
|
||||||
MTP_int(0),
|
// MTP_int(0),
|
||||||
MTP_int(hash)
|
// MTP_int(hash)
|
||||||
)).done([=](const MTPchannels_FeedSources &result) {
|
//)).done([=](const MTPchannels_FeedSources &result) {
|
||||||
applyFeedSources(result);
|
// applyFeedSources(result);
|
||||||
_preloadRequestId = 0;
|
// _preloadRequestId = 0;
|
||||||
}).fail([=](const RPCError &error) {
|
//}).fail([=](const RPCError &error) {
|
||||||
_preloadRequestId = 0;
|
// _preloadRequestId = 0;
|
||||||
}).send();
|
//}).send();
|
||||||
}
|
|
||||||
|
|
||||||
void EditController::applyFeedSources(
|
|
||||||
const MTPchannels_FeedSources &result) {
|
|
||||||
auto channels = std::vector<not_null<ChannelData*>>();
|
|
||||||
|
|
||||||
switch (result.type()) {
|
|
||||||
case mtpc_channels_feedSourcesNotModified:
|
|
||||||
LOG(("API Error: Unexpected channels.feedSourcesNotModified."));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case mtpc_channels_feedSources: {
|
|
||||||
const auto &data = result.c_channels_feedSources();
|
|
||||||
Auth().api().applyFeedSources(data);
|
|
||||||
|
|
||||||
for (const auto &chat : data.vchats.v) {
|
|
||||||
if (chat.type() == mtpc_channel) {
|
|
||||||
channels.push_back(App::channel(chat.c_channel().vid.v));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} break;
|
|
||||||
|
|
||||||
default: Unexpected("Type in channels.getFeedSources response.");
|
|
||||||
}
|
|
||||||
|
|
||||||
_allLoaded = true;
|
|
||||||
if (channels.size() < kChannelsInFeedMin) {
|
|
||||||
setDescriptionText(lng_feed_too_few_channels(
|
|
||||||
lt_count,
|
|
||||||
kChannelsInFeedMin));
|
|
||||||
delegate()->peerListSetSearchMode(PeerListSearchMode::Disabled);
|
|
||||||
} else {
|
|
||||||
auto alreadyInFeed = ranges::view::all(
|
|
||||||
channels
|
|
||||||
) | ranges::view::filter([&](not_null<ChannelData*> channel) {
|
|
||||||
return (channel->feed() == _feed)
|
|
||||||
|| (channel == _startWithChannel);
|
|
||||||
});
|
|
||||||
delegate()->peerListAddSelectedRows(alreadyInFeed);
|
|
||||||
for (const auto channel : channels) {
|
|
||||||
delegate()->peerListAppendRow(createRow(channel));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
delegate()->peerListRefreshRows();
|
|
||||||
}
|
}
|
||||||
|
// #feed
|
||||||
|
//void EditController::applyFeedSources(
|
||||||
|
// const MTPchannels_FeedSources &result) {
|
||||||
|
// auto channels = std::vector<not_null<ChannelData*>>();
|
||||||
|
//
|
||||||
|
// switch (result.type()) {
|
||||||
|
// case mtpc_channels_feedSourcesNotModified:
|
||||||
|
// LOG(("API Error: Unexpected channels.feedSourcesNotModified."));
|
||||||
|
// break;
|
||||||
|
//
|
||||||
|
// case mtpc_channels_feedSources: {
|
||||||
|
// const auto &data = result.c_channels_feedSources();
|
||||||
|
// Auth().api().applyFeedSources(data);
|
||||||
|
//
|
||||||
|
// for (const auto &chat : data.vchats.v) {
|
||||||
|
// if (chat.type() == mtpc_channel) {
|
||||||
|
// channels.push_back(App::channel(chat.c_channel().vid.v));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } break;
|
||||||
|
//
|
||||||
|
// default: Unexpected("Type in channels.getFeedSources response.");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// _allLoaded = true;
|
||||||
|
// if (channels.size() < kChannelsInFeedMin) {
|
||||||
|
// setDescriptionText(lng_feed_too_few_channels(
|
||||||
|
// lt_count,
|
||||||
|
// kChannelsInFeedMin));
|
||||||
|
// delegate()->peerListSetSearchMode(PeerListSearchMode::Disabled);
|
||||||
|
// } else {
|
||||||
|
// auto alreadyInFeed = ranges::view::all(
|
||||||
|
// channels
|
||||||
|
// ) | ranges::view::filter([&](not_null<ChannelData*> channel) {
|
||||||
|
// return (channel->feed() == _feed)
|
||||||
|
// || (channel == _startWithChannel);
|
||||||
|
// });
|
||||||
|
// delegate()->peerListAddSelectedRows(alreadyInFeed);
|
||||||
|
// for (const auto channel : channels) {
|
||||||
|
// delegate()->peerListAppendRow(createRow(channel));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// delegate()->peerListRefreshRows();
|
||||||
|
//}
|
||||||
|
|
||||||
void EditController::rowClicked(not_null<PeerListRow*> row) {
|
void EditController::rowClicked(not_null<PeerListRow*> row) {
|
||||||
delegate()->peerListSetRowChecked(row, !row->checked());
|
delegate()->peerListSetRowChecked(row, !row->checked());
|
||||||
|
|
|
@ -71,9 +71,9 @@ private:
|
||||||
|
|
||||||
not_null<Data::Feed*> _feed;
|
not_null<Data::Feed*> _feed;
|
||||||
mtpRequestId _preloadRequestId = 0;
|
mtpRequestId _preloadRequestId = 0;
|
||||||
TimeId _preloadOffsetDate = TimeId(0);
|
//TimeId _preloadOffsetDate = TimeId(0); // #feed
|
||||||
MsgId _preloadOffsetId = MsgId(0);
|
//MsgId _preloadOffsetId = MsgId(0);
|
||||||
PeerData *_preloadPeer = nullptr;
|
//PeerData *_preloadPeer = nullptr;
|
||||||
bool _allLoaded = false;
|
bool _allLoaded = false;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -97,10 +97,10 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<PeerListRow> createRow(not_null<ChannelData*> channel);
|
std::unique_ptr<PeerListRow> createRow(not_null<ChannelData*> channel);
|
||||||
void applyFeedSources(const MTPchannels_FeedSources &result);
|
// void applyFeedSources(const MTPchannels_FeedSources &result); // #feed
|
||||||
|
|
||||||
not_null<Data::Feed*> _feed;
|
not_null<Data::Feed*> _feed;
|
||||||
ChannelData *_startWithChannel = nullptr;
|
// ChannelData *_startWithChannel = nullptr; // #feed
|
||||||
mtpRequestId _preloadRequestId = 0;
|
mtpRequestId _preloadRequestId = 0;
|
||||||
bool _allLoaded = false;
|
bool _allLoaded = false;
|
||||||
|
|
||||||
|
|
|
@ -715,7 +715,7 @@ object_ptr<Ui::RpWidget> FeedDetailsFiller::setupDefaultToggle() {
|
||||||
const auto makeDefault = (Auth().data().defaultFeedId() != feedId);
|
const auto makeDefault = (Auth().data().defaultFeedId() != feedId);
|
||||||
const auto defaultFeedId = makeDefault ? feedId : 0;
|
const auto defaultFeedId = makeDefault ? feedId : 0;
|
||||||
Auth().data().setDefaultFeedId(defaultFeedId);
|
Auth().data().setDefaultFeedId(defaultFeedId);
|
||||||
Auth().api().saveDefaultFeedId(feedId, makeDefault);
|
// Auth().api().saveDefaultFeedId(feedId, makeDefault); // #feed
|
||||||
});
|
});
|
||||||
object_ptr<FloatingIcon>(
|
object_ptr<FloatingIcon>(
|
||||||
result,
|
result,
|
||||||
|
|
|
@ -4686,21 +4686,21 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case mtpc_updateReadFeed: {
|
//case mtpc_updateReadFeed: { // #feed
|
||||||
const auto &d = update.c_updateReadFeed();
|
// const auto &d = update.c_updateReadFeed();
|
||||||
const auto feedId = d.vfeed_id.v;
|
// const auto feedId = d.vfeed_id.v;
|
||||||
if (const auto feed = Auth().data().feedLoaded(feedId)) {
|
// if (const auto feed = Auth().data().feedLoaded(feedId)) {
|
||||||
feed->setUnreadPosition(
|
// feed->setUnreadPosition(
|
||||||
Data::FeedPositionFromMTP(d.vmax_position));
|
// Data::FeedPositionFromMTP(d.vmax_position));
|
||||||
if (d.has_unread_count() && d.has_unread_muted_count()) {
|
// if (d.has_unread_count() && d.has_unread_muted_count()) {
|
||||||
feed->setUnreadCounts(
|
// feed->setUnreadCounts(
|
||||||
d.vunread_count.v,
|
// d.vunread_count.v,
|
||||||
d.vunread_muted_count.v);
|
// d.vunread_muted_count.v);
|
||||||
} else {
|
// } else {
|
||||||
Auth().api().requestDialogEntry(feed);
|
// Auth().api().requestDialogEntry(feed);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
} break;
|
//} break;
|
||||||
|
|
||||||
// Deleted messages.
|
// Deleted messages.
|
||||||
case mtpc_updateDeleteMessages: {
|
case mtpc_updateDeleteMessages: {
|
||||||
|
@ -4987,17 +4987,17 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case mtpc_dialogPeerFeed: {
|
//case mtpc_dialogPeerFeed: { // #feed
|
||||||
const auto &feed = dialogPeer.c_dialogPeerFeed();
|
// const auto &feed = dialogPeer.c_dialogPeerFeed();
|
||||||
const auto feedId = feed.vfeed_id.v;
|
// const auto feedId = feed.vfeed_id.v;
|
||||||
if (!Auth().data().feedLoaded(feedId)) {
|
// if (!Auth().data().feedLoaded(feedId)) {
|
||||||
DEBUG_LOG(("API Error: "
|
// DEBUG_LOG(("API Error: "
|
||||||
"pinned feed not loaded for feedId %1"
|
// "pinned feed not loaded for feedId %1"
|
||||||
).arg(feedId
|
// ).arg(feedId
|
||||||
));
|
// ));
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
} break;
|
//} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -5027,18 +5027,18 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
|
||||||
_dialogs->loadPinnedDialogs();
|
_dialogs->loadPinnedDialogs();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case mtpc_dialogPeerFeed: {
|
//case mtpc_dialogPeerFeed: { // #feed
|
||||||
const auto feedId = d.vpeer.c_dialogPeerFeed().vfeed_id.v;
|
// const auto feedId = d.vpeer.c_dialogPeerFeed().vfeed_id.v;
|
||||||
if (const auto feed = Auth().data().feedLoaded(feedId)) {
|
// if (const auto feed = Auth().data().feedLoaded(feedId)) {
|
||||||
Auth().data().setPinnedDialog(feed, d.is_pinned());
|
// Auth().data().setPinnedDialog(feed, d.is_pinned());
|
||||||
} else {
|
// } else {
|
||||||
DEBUG_LOG(("API Error: "
|
// DEBUG_LOG(("API Error: "
|
||||||
"pinned feed not loaded for feedId %1"
|
// "pinned feed not loaded for feedId %1"
|
||||||
).arg(feedId
|
// ).arg(feedId
|
||||||
));
|
// ));
|
||||||
_dialogs->loadPinnedDialogs();
|
// _dialogs->loadPinnedDialogs();
|
||||||
}
|
// }
|
||||||
} break;
|
//} break;
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
|
|
@ -138,11 +138,16 @@ void TogglePinnedDialog(Dialogs::Key key) {
|
||||||
if (isPinned) {
|
if (isPinned) {
|
||||||
flags |= MTPmessages_ToggleDialogPin::Flag::f_pinned;
|
flags |= MTPmessages_ToggleDialogPin::Flag::f_pinned;
|
||||||
}
|
}
|
||||||
MTP::send(MTPmessages_ToggleDialogPin(
|
//MTP::send(MTPmessages_ToggleDialogPin( // #feed
|
||||||
MTP_flags(flags),
|
// MTP_flags(flags),
|
||||||
key.history()
|
// key.history()
|
||||||
? MTP_inputDialogPeer(key.history()->peer->input)
|
// ? MTP_inputDialogPeer(key.history()->peer->input)
|
||||||
: MTP_inputDialogPeerFeed(MTP_int(key.feed()->id()))));
|
// : MTP_inputDialogPeerFeed(MTP_int(key.feed()->id()))));
|
||||||
|
if (key.history()) {
|
||||||
|
MTP::send(MTPmessages_ToggleDialogPin(
|
||||||
|
MTP_flags(flags),
|
||||||
|
MTP_inputDialogPeer(key.history()->peer->input)));
|
||||||
|
}
|
||||||
if (isPinned) {
|
if (isPinned) {
|
||||||
if (const auto main = App::main()) {
|
if (const auto main = App::main()) {
|
||||||
main->dialogsToUp();
|
main->dialogsToUp();
|
||||||
|
@ -330,9 +335,9 @@ void Filler::addChannelActions(not_null<ChannelData*> channel) {
|
||||||
const auto feed = channel->feed();
|
const auto feed = channel->feed();
|
||||||
const auto grouped = (feed != nullptr);
|
const auto grouped = (feed != nullptr);
|
||||||
if (!grouped || feed->channels().size() > 1) {
|
if (!grouped || feed->channels().size() > 1) {
|
||||||
_addAction(
|
//_addAction( // #feed
|
||||||
lang(grouped ? lng_feed_ungroup : lng_feed_group),
|
// lang(grouped ? lng_feed_ungroup : lng_feed_group),
|
||||||
[=] { ToggleChannelGrouping(channel, !grouped); });
|
// [=] { ToggleChannelGrouping(channel, !grouped); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_source != PeerMenuSource::ChatsList) {
|
if (_source != PeerMenuSource::ChatsList) {
|
||||||
|
@ -481,9 +486,9 @@ void FeedFiller::addSearch() {
|
||||||
|
|
||||||
void FeedFiller::addUngroup() {
|
void FeedFiller::addUngroup() {
|
||||||
const auto feed = _feed;
|
const auto feed = _feed;
|
||||||
_addAction(lang(lng_feed_ungroup_all), [=] {
|
//_addAction(lang(lng_feed_ungroup_all), [=] { // #feed
|
||||||
PeerMenuUngroupFeed(feed);
|
// PeerMenuUngroupFeed(feed);
|
||||||
});
|
//});
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -655,32 +660,32 @@ void PeerMenuAddMuteAction(
|
||||||
|
|
||||||
Ui::AttachAsChild(muteAction, std::move(lifetime));
|
Ui::AttachAsChild(muteAction, std::move(lifetime));
|
||||||
}
|
}
|
||||||
|
// #feed
|
||||||
void PeerMenuUngroupFeed(not_null<Data::Feed*> feed) {
|
//void PeerMenuUngroupFeed(not_null<Data::Feed*> feed) {
|
||||||
Ui::show(Box<ConfirmBox>(
|
// Ui::show(Box<ConfirmBox>(
|
||||||
lang(lng_feed_sure_ungroup_all),
|
// lang(lng_feed_sure_ungroup_all),
|
||||||
lang(lng_feed_ungroup_sure),
|
// lang(lng_feed_ungroup_sure),
|
||||||
[=] { Ui::hideLayer(); Auth().api().ungroupAllFromFeed(feed); }));
|
// [=] { Ui::hideLayer(); Auth().api().ungroupAllFromFeed(feed); }));
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
void ToggleChannelGrouping(not_null<ChannelData*> channel, bool group) {
|
//void ToggleChannelGrouping(not_null<ChannelData*> channel, bool group) {
|
||||||
const auto callback = [=] {
|
// const auto callback = [=] {
|
||||||
Ui::Toast::Show(lang(group
|
// Ui::Toast::Show(lang(group
|
||||||
? lng_feed_channel_added
|
// ? lng_feed_channel_added
|
||||||
: lng_feed_channel_removed));
|
// : lng_feed_channel_removed));
|
||||||
};
|
// };
|
||||||
if (group) {
|
// if (group) {
|
||||||
const auto feed = Auth().data().feed(Data::Feed::kId);
|
// const auto feed = Auth().data().feed(Data::Feed::kId);
|
||||||
if (feed->channels().size() < 2) {
|
// if (feed->channels().size() < 2) {
|
||||||
Info::FeedProfile::EditController::Start(feed, channel);
|
// Info::FeedProfile::EditController::Start(feed, channel);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
Auth().api().toggleChannelGrouping(
|
// Auth().api().toggleChannelGrouping(
|
||||||
channel,
|
// channel,
|
||||||
group,
|
// group,
|
||||||
callback);
|
// callback);
|
||||||
}
|
//}
|
||||||
|
|
||||||
base::lambda<void()> ClearHistoryHandler(not_null<PeerData*> peer) {
|
base::lambda<void()> ClearHistoryHandler(not_null<PeerData*> peer) {
|
||||||
return [peer] {
|
return [peer] {
|
||||||
|
|
|
@ -48,9 +48,9 @@ void PeerMenuDeleteContact(not_null<UserData*> user);
|
||||||
void PeerMenuShareContactBox(not_null<UserData*> user);
|
void PeerMenuShareContactBox(not_null<UserData*> user);
|
||||||
void PeerMenuAddContact(not_null<UserData*> user);
|
void PeerMenuAddContact(not_null<UserData*> user);
|
||||||
void PeerMenuAddChannelMembers(not_null<ChannelData*> channel);
|
void PeerMenuAddChannelMembers(not_null<ChannelData*> channel);
|
||||||
void PeerMenuUngroupFeed(not_null<Data::Feed*> feed);
|
//void PeerMenuUngroupFeed(not_null<Data::Feed*> feed); // #feed
|
||||||
|
|
||||||
void ToggleChannelGrouping(not_null<ChannelData*> channel, bool group);
|
//void ToggleChannelGrouping(not_null<ChannelData*> channel, bool group); // #feed
|
||||||
base::lambda<void()> ClearHistoryHandler(not_null<PeerData*> peer);
|
base::lambda<void()> ClearHistoryHandler(not_null<PeerData*> peer);
|
||||||
base::lambda<void()> DeleteAndLeaveHandler(not_null<PeerData*> peer);
|
base::lambda<void()> DeleteAndLeaveHandler(not_null<PeerData*> peer);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue