2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

supergroups done

This commit is contained in:
John Preston
2015-11-20 21:24:44 +03:00
parent ecc49f9cd4
commit b05e1a8899
15 changed files with 146 additions and 46 deletions

View File

@@ -292,11 +292,11 @@ void ApiWrap::gotChatFull(PeerData *peer, const MTPmessages_ChatFull &result, mt
channel->flagsUpdated();
}
ChatData *cfrom = App::chat(peerFromChat(f.vmigrated_from_chat_id));
bool updated = (cfrom->migrateToPtr != channel);
if (updated) {
bool updatedTo = (cfrom->migrateToPtr != channel), updatedFrom = (channel->mgInfo->migrateFromPtr != cfrom);
if (updatedTo) {
cfrom->migrateToPtr = channel;
}
if (channel->mgInfo->migrateFromPtr != cfrom) {
if (updatedFrom) {
channel->mgInfo->migrateFromPtr = cfrom;
if (History *h = App::historyLoaded(cfrom->id)) {
if (History *hto = App::historyLoaded(channel->id)) {
@@ -308,8 +308,10 @@ void ApiWrap::gotChatFull(PeerData *peer, const MTPmessages_ChatFull &result, mt
}
}
}
Notify::migrateUpdated(channel);
}
if (updated) {
if (updatedTo) {
Notify::migrateUpdated(cfrom);
App::main()->peerUpdated(cfrom);
}
}
@@ -344,9 +346,6 @@ void ApiWrap::gotChatFull(PeerData *peer, const MTPmessages_ChatFull &result, mt
h->inboxReadBefore = f.vread_inbox_max_id.v + 1;
h->asChannelHistory()->unreadCountAll = f.vunread_count.v;
}
if (channel->migrateFrom()) {
h->asChannelHistory()->removeJoinedMessage();
}
}
channel->fullUpdated();
@@ -449,7 +448,7 @@ void ApiWrap::requestLastParticipants(ChannelData *peer, bool fromStart) {
return;
}
}
mtpRequestId req = MTP::send(MTPchannels_GetParticipants(peer->inputChannel, MTP_channelParticipantsRecent(), MTP_int(fromStart ? 0 : peer->mgInfo->lastParticipants.size()), MTP_int(1)), rpcDone(&ApiWrap::lastParticipantsDone, peer), rpcFail(&ApiWrap::lastParticipantsFail, peer));
mtpRequestId req = MTP::send(MTPchannels_GetParticipants(peer->inputChannel, MTP_channelParticipantsRecent(), MTP_int(fromStart ? 0 : peer->mgInfo->lastParticipants.size()), MTP_int(cMaxGroupCount())), rpcDone(&ApiWrap::lastParticipantsDone, peer), rpcFail(&ApiWrap::lastParticipantsFail, peer));
_participantsRequests.insert(peer, fromStart ? req : -req);
}