mirror of https://github.com/procxx/kepka.git
Notify::peerUpdatedSendDelayed() now is always called from the event loop.
This commit is contained in:
parent
2c4ec3d9f3
commit
91d516f18c
|
@ -183,8 +183,8 @@ void ApiWrap::gotChatFull(PeerData *peer, const MTPmessages_ChatFull &result, mt
|
||||||
badVersion = (!vc.isEmpty() && vc.at(0).type() == mtpc_channel && vc.at(0).c_channel().vversion.v < peer->asChannel()->version);
|
badVersion = (!vc.isEmpty() && vc.at(0).type() == mtpc_channel && vc.at(0).c_channel().vversion.v < peer->asChannel()->version);
|
||||||
}
|
}
|
||||||
|
|
||||||
App::feedUsersDelayed(d.vusers);
|
App::feedUsers(d.vusers);
|
||||||
App::feedChatsDelayed(d.vchats);
|
App::feedChats(d.vchats);
|
||||||
|
|
||||||
if (peer->isChat()) {
|
if (peer->isChat()) {
|
||||||
if (d.vfull_chat.type() != mtpc_chatFull) {
|
if (d.vfull_chat.type() != mtpc_chatFull) {
|
||||||
|
@ -322,17 +322,15 @@ void ApiWrap::gotChatFull(PeerData *peer, const MTPmessages_ChatFull &result, mt
|
||||||
}
|
}
|
||||||
App::clearPeerUpdated(peer);
|
App::clearPeerUpdated(peer);
|
||||||
emit fullPeerUpdated(peer);
|
emit fullPeerUpdated(peer);
|
||||||
|
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApiWrap::gotUserFull(PeerData *peer, const MTPUserFull &result, mtpRequestId req) {
|
void ApiWrap::gotUserFull(PeerData *peer, const MTPUserFull &result, mtpRequestId req) {
|
||||||
const auto &d(result.c_userFull());
|
const auto &d(result.c_userFull());
|
||||||
App::feedUsersDelayed(MTP_vector<MTPUser>(1, d.vuser));
|
App::feedUsers(MTP_vector<MTPUser>(1, d.vuser));
|
||||||
if (d.has_profile_photo()) {
|
if (d.has_profile_photo()) {
|
||||||
App::feedPhoto(d.vprofile_photo);
|
App::feedPhoto(d.vprofile_photo);
|
||||||
}
|
}
|
||||||
App::feedUserLinkDelayed(MTP_int(peerToUser(peer->id)), d.vlink.c_contacts_link().vmy_link, d.vlink.c_contacts_link().vforeign_link);
|
App::feedUserLink(MTP_int(peerToUser(peer->id)), d.vlink.c_contacts_link().vmy_link, d.vlink.c_contacts_link().vforeign_link);
|
||||||
if (App::main()) {
|
if (App::main()) {
|
||||||
notifySettingReceived(MTP_inputNotifyPeer(peer->input), d.vnotify_settings);
|
notifySettingReceived(MTP_inputNotifyPeer(peer->input), d.vnotify_settings);
|
||||||
}
|
}
|
||||||
|
@ -353,8 +351,6 @@ void ApiWrap::gotUserFull(PeerData *peer, const MTPUserFull &result, mtpRequestI
|
||||||
}
|
}
|
||||||
App::clearPeerUpdated(peer);
|
App::clearPeerUpdated(peer);
|
||||||
emit fullPeerUpdated(peer);
|
emit fullPeerUpdated(peer);
|
||||||
|
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ApiWrap::gotPeerFullFailed(PeerData *peer, const RPCError &error) {
|
bool ApiWrap::gotPeerFullFailed(PeerData *peer, const RPCError &error) {
|
||||||
|
@ -558,7 +554,6 @@ void ApiWrap::lastParticipantsDone(ChannelData *peer, const MTPchannels_ChannelP
|
||||||
}
|
}
|
||||||
peer->mgInfo->botStatus = botStatus;
|
peer->mgInfo->botStatus = botStatus;
|
||||||
if (App::main()) emit fullPeerUpdated(peer);
|
if (App::main()) emit fullPeerUpdated(peer);
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ApiWrap::lastParticipantsFail(ChannelData *peer, const RPCError &error, mtpRequestId req) {
|
bool ApiWrap::lastParticipantsFail(ChannelData *peer, const RPCError &error, mtpRequestId req) {
|
||||||
|
@ -663,7 +658,6 @@ void ApiWrap::kickParticipantDone(KickRequest kick, const MTPUpdates &result, mt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
emit fullPeerUpdated(kick.first);
|
emit fullPeerUpdated(kick.first);
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ApiWrap::kickParticipantFail(KickRequest kick, const RPCError &error, mtpRequestId req) {
|
bool ApiWrap::kickParticipantFail(KickRequest kick, const RPCError &error, mtpRequestId req) {
|
||||||
|
@ -708,7 +702,6 @@ void ApiWrap::leaveChannel(ChannelData *channel) {
|
||||||
|
|
||||||
void ApiWrap::channelAmInUpdated(ChannelData *channel) {
|
void ApiWrap::channelAmInUpdated(ChannelData *channel) {
|
||||||
Notify::peerUpdatedDelayed(channel, Notify::PeerUpdate::Flag::ChannelAmIn);
|
Notify::peerUpdatedDelayed(channel, Notify::PeerUpdate::Flag::ChannelAmIn);
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApiWrap::channelAmInDone(ChannelData *channel, const MTPUpdates &updates) {
|
void ApiWrap::channelAmInDone(ChannelData *channel, const MTPUpdates &updates) {
|
||||||
|
@ -727,7 +720,6 @@ bool ApiWrap::channelAmInFail(ChannelData *channel, const RPCError &error) {
|
||||||
void ApiWrap::blockUser(UserData *user) {
|
void ApiWrap::blockUser(UserData *user) {
|
||||||
if (user->isBlocked()) {
|
if (user->isBlocked()) {
|
||||||
Notify::peerUpdatedDelayed(user, Notify::PeerUpdate::Flag::UserIsBlocked);
|
Notify::peerUpdatedDelayed(user, Notify::PeerUpdate::Flag::UserIsBlocked);
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
} else if (!_blockRequests.contains(user)) {
|
} else if (!_blockRequests.contains(user)) {
|
||||||
auto requestId = MTP::send(MTPcontacts_Block(user->inputUser), rpcDone(&ApiWrap::blockDone, user), rpcFail(&ApiWrap::blockFail, user));
|
auto requestId = MTP::send(MTPcontacts_Block(user->inputUser), rpcDone(&ApiWrap::blockDone, user), rpcFail(&ApiWrap::blockFail, user));
|
||||||
_blockRequests.insert(user, requestId);
|
_blockRequests.insert(user, requestId);
|
||||||
|
@ -737,7 +729,6 @@ void ApiWrap::blockUser(UserData *user) {
|
||||||
void ApiWrap::unblockUser(UserData *user) {
|
void ApiWrap::unblockUser(UserData *user) {
|
||||||
if (!user->isBlocked()) {
|
if (!user->isBlocked()) {
|
||||||
Notify::peerUpdatedDelayed(user, Notify::PeerUpdate::Flag::UserIsBlocked);
|
Notify::peerUpdatedDelayed(user, Notify::PeerUpdate::Flag::UserIsBlocked);
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
} else if (!_blockRequests.contains(user)) {
|
} else if (!_blockRequests.contains(user)) {
|
||||||
auto requestId = MTP::send(MTPcontacts_Unblock(user->inputUser), rpcDone(&ApiWrap::unblockDone, user), rpcFail(&ApiWrap::blockFail, user));
|
auto requestId = MTP::send(MTPcontacts_Unblock(user->inputUser), rpcDone(&ApiWrap::unblockDone, user), rpcFail(&ApiWrap::blockFail, user));
|
||||||
_blockRequests.insert(user, requestId);
|
_blockRequests.insert(user, requestId);
|
||||||
|
@ -748,14 +739,12 @@ void ApiWrap::blockDone(UserData *user, const MTPBool &result) {
|
||||||
_blockRequests.remove(user);
|
_blockRequests.remove(user);
|
||||||
user->setBlockStatus(UserData::BlockStatus::Blocked);
|
user->setBlockStatus(UserData::BlockStatus::Blocked);
|
||||||
emit App::main()->peerUpdated(user);
|
emit App::main()->peerUpdated(user);
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApiWrap::unblockDone(UserData *user, const MTPBool &result) {
|
void ApiWrap::unblockDone(UserData *user, const MTPBool &result) {
|
||||||
_blockRequests.remove(user);
|
_blockRequests.remove(user);
|
||||||
user->setBlockStatus(UserData::BlockStatus::NotBlocked);
|
user->setBlockStatus(UserData::BlockStatus::NotBlocked);
|
||||||
emit App::main()->peerUpdated(user);
|
emit App::main()->peerUpdated(user);
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ApiWrap::blockFail(UserData *user, const RPCError &error) {
|
bool ApiWrap::blockFail(UserData *user, const RPCError &error) {
|
||||||
|
@ -788,7 +777,6 @@ void ApiWrap::exportInviteDone(PeerData *peer, const MTPExportedChatInvite &resu
|
||||||
} else if (auto channel = peer->asChannel()) {
|
} else if (auto channel = peer->asChannel()) {
|
||||||
channel->setInviteLink((result.type() == mtpc_chatInviteExported) ? qs(result.c_chatInviteExported().vlink) : QString());
|
channel->setInviteLink((result.type() == mtpc_chatInviteExported) ? qs(result.c_chatInviteExported().vlink) : QString());
|
||||||
}
|
}
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ApiWrap::exportInviteFail(PeerData *peer, const RPCError &error) {
|
bool ApiWrap::exportInviteFail(PeerData *peer, const RPCError &error) {
|
||||||
|
@ -809,7 +797,6 @@ void ApiWrap::requestNotifySetting(PeerData *peer) {
|
||||||
void ApiWrap::notifySettingDone(MTPInputNotifyPeer notifyPeer, const MTPPeerNotifySettings &result) {
|
void ApiWrap::notifySettingDone(MTPInputNotifyPeer notifyPeer, const MTPPeerNotifySettings &result) {
|
||||||
if (auto requestedPeer = notifySettingReceived(notifyPeer, result)) {
|
if (auto requestedPeer = notifySettingReceived(notifyPeer, result)) {
|
||||||
_notifySettingRequests.remove(requestedPeer);
|
_notifySettingRequests.remove(requestedPeer);
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -842,7 +829,6 @@ bool ApiWrap::notifySettingFail(PeerData *peer, const RPCError &error) {
|
||||||
|
|
||||||
notifySettingReceived(MTP_inputNotifyPeer(peer->input), MTP_peerNotifySettingsEmpty());
|
notifySettingReceived(MTP_inputNotifyPeer(peer->input), MTP_peerNotifySettingsEmpty());
|
||||||
_notifySettingRequests.remove(peer);
|
_notifySettingRequests.remove(peer);
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -365,7 +365,7 @@ namespace {
|
||||||
return (online > now);
|
return (online > now);
|
||||||
}
|
}
|
||||||
|
|
||||||
UserData *feedUsersDelayed(const MTPVector<MTPUser> &users) {
|
UserData *feedUsers(const MTPVector<MTPUser> &users) {
|
||||||
UserData *result = nullptr;
|
UserData *result = nullptr;
|
||||||
for_const (auto &user, users.c_vector().v) {
|
for_const (auto &user, users.c_vector().v) {
|
||||||
UserData *data = nullptr;
|
UserData *data = nullptr;
|
||||||
|
@ -386,7 +386,7 @@ namespace {
|
||||||
|
|
||||||
data->input = MTP_inputPeerUser(d.vid, MTP_long(0));
|
data->input = MTP_inputPeerUser(d.vid, MTP_long(0));
|
||||||
data->inputUser = MTP_inputUser(d.vid, MTP_long(0));
|
data->inputUser = MTP_inputUser(d.vid, MTP_long(0));
|
||||||
data->setNameDelayed(lang(lng_deleted), QString(), QString(), QString());
|
data->setName(lang(lng_deleted), QString(), QString(), QString());
|
||||||
data->setPhoto(MTP_userProfilePhotoEmpty());
|
data->setPhoto(MTP_userProfilePhotoEmpty());
|
||||||
data->access = UserNoAccess;
|
data->access = UserNoAccess;
|
||||||
data->flags = 0;
|
data->flags = 0;
|
||||||
|
@ -432,7 +432,7 @@ namespace {
|
||||||
data->setPhone(QString());
|
data->setPhone(QString());
|
||||||
update.flags |= UpdateFlag::UserPhoneChanged;
|
update.flags |= UpdateFlag::UserPhoneChanged;
|
||||||
}
|
}
|
||||||
data->setNameDelayed(lang(lng_deleted), QString(), QString(), QString());
|
data->setName(lang(lng_deleted), QString(), QString(), QString());
|
||||||
data->setPhoto(MTP_userProfilePhotoEmpty());
|
data->setPhoto(MTP_userProfilePhotoEmpty());
|
||||||
data->access = UserNoAccess;
|
data->access = UserNoAccess;
|
||||||
status = &emptyStatus;
|
status = &emptyStatus;
|
||||||
|
@ -467,7 +467,7 @@ namespace {
|
||||||
if (!minimal && d.is_self() && uname != data->username) {
|
if (!minimal && d.is_self() && uname != data->username) {
|
||||||
SignalHandlers::setCrashAnnotation("Username", uname);
|
SignalHandlers::setCrashAnnotation("Username", uname);
|
||||||
}
|
}
|
||||||
data->setNameDelayed(fname, lname, pname, uname);
|
data->setName(fname, lname, pname, uname);
|
||||||
if (d.has_photo()) {
|
if (d.has_photo()) {
|
||||||
data->setPhoto(d.vphoto);
|
data->setPhoto(d.vphoto);
|
||||||
} else {
|
} else {
|
||||||
|
@ -547,7 +547,7 @@ namespace {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
PeerData *feedChatsDelayed(const MTPVector<MTPChat> &chats) {
|
PeerData *feedChats(const MTPVector<MTPChat> &chats) {
|
||||||
PeerData *result = nullptr;
|
PeerData *result = nullptr;
|
||||||
for_const (auto &chat, chats.c_vector().v) {
|
for_const (auto &chat, chats.c_vector().v) {
|
||||||
PeerData *data = nullptr;
|
PeerData *data = nullptr;
|
||||||
|
@ -565,7 +565,7 @@ namespace {
|
||||||
auto canEdit = cdata->canEdit();
|
auto canEdit = cdata->canEdit();
|
||||||
|
|
||||||
data->input = MTP_inputPeerChat(d.vid);
|
data->input = MTP_inputPeerChat(d.vid);
|
||||||
cdata->setNameDelayed(qs(d.vtitle));
|
cdata->setName(qs(d.vtitle));
|
||||||
cdata->setPhoto(d.vphoto);
|
cdata->setPhoto(d.vphoto);
|
||||||
cdata->date = d.vdate.v;
|
cdata->date = d.vdate.v;
|
||||||
|
|
||||||
|
@ -627,7 +627,7 @@ namespace {
|
||||||
auto canEdit = cdata->canEdit();
|
auto canEdit = cdata->canEdit();
|
||||||
|
|
||||||
data->input = MTP_inputPeerChat(d.vid);
|
data->input = MTP_inputPeerChat(d.vid);
|
||||||
cdata->setNameDelayed(qs(d.vtitle));
|
cdata->setName(qs(d.vtitle));
|
||||||
cdata->setPhoto(MTP_chatPhotoEmpty());
|
cdata->setPhoto(MTP_chatPhotoEmpty());
|
||||||
cdata->date = 0;
|
cdata->date = 0;
|
||||||
cdata->count = -1;
|
cdata->count = -1;
|
||||||
|
@ -679,7 +679,7 @@ namespace {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QString uname = d.has_username() ? textOneLine(qs(d.vusername)) : QString();
|
QString uname = d.has_username() ? textOneLine(qs(d.vusername)) : QString();
|
||||||
cdata->setNameDelayed(qs(d.vtitle), uname);
|
cdata->setName(qs(d.vtitle), uname);
|
||||||
|
|
||||||
cdata->isForbidden = false;
|
cdata->isForbidden = false;
|
||||||
cdata->flagsUpdated();
|
cdata->flagsUpdated();
|
||||||
|
@ -709,7 +709,7 @@ namespace {
|
||||||
|
|
||||||
cdata->inputChannel = MTP_inputChannel(d.vid, d.vaccess_hash);
|
cdata->inputChannel = MTP_inputChannel(d.vid, d.vaccess_hash);
|
||||||
|
|
||||||
cdata->setNameDelayed(qs(d.vtitle), QString());
|
cdata->setName(qs(d.vtitle), QString());
|
||||||
|
|
||||||
cdata->access = d.vaccess_hash.v;
|
cdata->access = d.vaccess_hash.v;
|
||||||
cdata->setPhoto(MTP_chatPhotoEmpty());
|
cdata->setPhoto(MTP_chatPhotoEmpty());
|
||||||
|
@ -746,18 +746,6 @@ namespace {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
UserData *feedUsers(const MTPVector<MTPUser> &users) {
|
|
||||||
auto result = feedUsersDelayed(users);
|
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
PeerData *feedChats(const MTPVector<MTPChat> &chats) {
|
|
||||||
auto result = feedChatsDelayed(chats);
|
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void feedParticipants(const MTPChatParticipants &p, bool requestBotInfos, bool emitPeerUpdated) {
|
void feedParticipants(const MTPChatParticipants &p, bool requestBotInfos, bool emitPeerUpdated) {
|
||||||
ChatData *chat = 0;
|
ChatData *chat = 0;
|
||||||
switch (p.type()) {
|
switch (p.type()) {
|
||||||
|
@ -1234,7 +1222,7 @@ namespace {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void feedUserLinkDelayed(MTPint userId, const MTPContactLink &myLink, const MTPContactLink &foreignLink) {
|
void feedUserLink(MTPint userId, const MTPContactLink &myLink, const MTPContactLink &foreignLink) {
|
||||||
UserData *user = userLoaded(userId.v);
|
UserData *user = userLoaded(userId.v);
|
||||||
if (user) {
|
if (user) {
|
||||||
auto wasContact = user->isContact();
|
auto wasContact = user->isContact();
|
||||||
|
@ -1271,7 +1259,7 @@ namespace {
|
||||||
bool showPhone = !isServiceUser(user->id) && !user->isSelf() && !user->contact;
|
bool showPhone = !isServiceUser(user->id) && !user->isSelf() && !user->contact;
|
||||||
bool showPhoneChanged = !isServiceUser(user->id) && !user->isSelf() && ((showPhone && !wasShowPhone) || (!showPhone && wasShowPhone));
|
bool showPhoneChanged = !isServiceUser(user->id) && !user->isSelf() && ((showPhone && !wasShowPhone) || (!showPhone && wasShowPhone));
|
||||||
if (showPhoneChanged) {
|
if (showPhoneChanged) {
|
||||||
user->setNameDelayed(textOneLine(user->firstName), textOneLine(user->lastName), showPhone ? App::formatPhone(user->phone()) : QString(), textOneLine(user->username));
|
user->setName(textOneLine(user->firstName), textOneLine(user->lastName), showPhone ? App::formatPhone(user->phone()) : QString(), textOneLine(user->username));
|
||||||
}
|
}
|
||||||
markPeerUpdated(user);
|
markPeerUpdated(user);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,10 +67,6 @@ namespace App {
|
||||||
UserData *feedUsers(const MTPVector<MTPUser> &users); // returns last user
|
UserData *feedUsers(const MTPVector<MTPUser> &users); // returns last user
|
||||||
PeerData *feedChats(const MTPVector<MTPChat> &chats); // returns last chat
|
PeerData *feedChats(const MTPVector<MTPChat> &chats); // returns last chat
|
||||||
|
|
||||||
// Requires Notify::peerUpdatedSendDelayed() call after.
|
|
||||||
UserData *feedUsersDelayed(const MTPVector<MTPUser> &users); // returns last user
|
|
||||||
PeerData *feedChatsDelayed(const MTPVector<MTPChat> &chats); // returns last chat
|
|
||||||
|
|
||||||
void feedParticipants(const MTPChatParticipants &p, bool requestBotInfos, bool emitPeerUpdated = true);
|
void feedParticipants(const MTPChatParticipants &p, bool requestBotInfos, bool emitPeerUpdated = true);
|
||||||
void feedParticipantAdd(const MTPDupdateChatParticipantAdd &d, bool emitPeerUpdated = true);
|
void feedParticipantAdd(const MTPDupdateChatParticipantAdd &d, bool emitPeerUpdated = true);
|
||||||
void feedParticipantDelete(const MTPDupdateChatParticipantDelete &d, bool emitPeerUpdated = true);
|
void feedParticipantDelete(const MTPDupdateChatParticipantDelete &d, bool emitPeerUpdated = true);
|
||||||
|
@ -85,7 +81,7 @@ namespace App {
|
||||||
void feedInboxRead(const PeerId &peer, MsgId upTo);
|
void feedInboxRead(const PeerId &peer, MsgId upTo);
|
||||||
void feedOutboxRead(const PeerId &peer, MsgId upTo);
|
void feedOutboxRead(const PeerId &peer, MsgId upTo);
|
||||||
void feedWereDeleted(ChannelId channelId, const QVector<MTPint> &msgsIds);
|
void feedWereDeleted(ChannelId channelId, const QVector<MTPint> &msgsIds);
|
||||||
void feedUserLinkDelayed(MTPint userId, const MTPContactLink &myLink, const MTPContactLink &foreignLink);
|
void feedUserLink(MTPint userId, const MTPContactLink &myLink, const MTPContactLink &foreignLink);
|
||||||
|
|
||||||
void markPeerUpdated(PeerData *data);
|
void markPeerUpdated(PeerData *data);
|
||||||
void clearPeerUpdated(PeerData *data);
|
void clearPeerUpdated(PeerData *data);
|
||||||
|
|
|
@ -819,7 +819,6 @@ void AppClass::doMtpUnpause() {
|
||||||
void AppClass::selfPhotoCleared(const MTPUserProfilePhoto &result) {
|
void AppClass::selfPhotoCleared(const MTPUserProfilePhoto &result) {
|
||||||
if (!App::self()) return;
|
if (!App::self()) return;
|
||||||
App::self()->setPhoto(result);
|
App::self()->setPhoto(result);
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
emit peerPhotoDone(App::self()->id);
|
emit peerPhotoDone(App::self()->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -545,7 +545,6 @@ void GroupInfoBox::exportDone(const MTPExportedChatInvite &result) {
|
||||||
_creationRequestId = 0;
|
_creationRequestId = 0;
|
||||||
if (result.type() == mtpc_chatInviteExported) {
|
if (result.type() == mtpc_chatInviteExported) {
|
||||||
_createdChannel->setInviteLink(qs(result.c_chatInviteExported().vlink));
|
_createdChannel->setInviteLink(qs(result.c_chatInviteExported().vlink));
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
Ui::showLayer(new SetupChannelBox(_createdChannel));
|
Ui::showLayer(new SetupChannelBox(_createdChannel));
|
||||||
}
|
}
|
||||||
|
@ -1357,7 +1356,6 @@ bool EditChannelBox::onSaveFail(const RPCError &error, mtpRequestId req) {
|
||||||
if (App::api()) {
|
if (App::api()) {
|
||||||
emit App::api()->fullPeerUpdated(_channel);
|
emit App::api()->fullPeerUpdated(_channel);
|
||||||
}
|
}
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
saveSign();
|
saveSign();
|
||||||
return true;
|
return true;
|
||||||
|
@ -1388,7 +1386,6 @@ void EditChannelBox::onSaveDescriptionDone(const MTPBool &result) {
|
||||||
if (App::api()) {
|
if (App::api()) {
|
||||||
emit App::api()->fullPeerUpdated(_channel);
|
emit App::api()->fullPeerUpdated(_channel);
|
||||||
}
|
}
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
saveSign();
|
saveSign();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2124,7 +2124,7 @@ void MembersInner::membersReceived(const MTPchannels_ChannelParticipants &result
|
||||||
_channel->setAdminsCount(d.vcount.v);
|
_channel->setAdminsCount(d.vcount.v);
|
||||||
if (App::main()) emit App::main()->peerUpdated(_channel);
|
if (App::main()) emit App::main()->peerUpdated(_channel);
|
||||||
}
|
}
|
||||||
App::feedUsersDelayed(d.vusers);
|
App::feedUsers(d.vusers);
|
||||||
|
|
||||||
for (QVector<MTPChannelParticipant>::const_iterator i = v.cbegin(), e = v.cend(); i != e; ++i) {
|
for (QVector<MTPChannelParticipant>::const_iterator i = v.cbegin(), e = v.cend(); i != e; ++i) {
|
||||||
int32 userId = 0, addedTime = 0;
|
int32 userId = 0, addedTime = 0;
|
||||||
|
|
|
@ -31,7 +31,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
#include "boxes/addcontactbox.h"
|
#include "boxes/addcontactbox.h"
|
||||||
#include "boxes/contactsbox.h"
|
#include "boxes/contactsbox.h"
|
||||||
#include "boxes/confirmbox.h"
|
#include "boxes/confirmbox.h"
|
||||||
#include "observer_peer.h"
|
|
||||||
#include "localstorage.h"
|
#include "localstorage.h"
|
||||||
#include "apiwrap.h"
|
#include "apiwrap.h"
|
||||||
|
|
||||||
|
@ -728,7 +727,6 @@ void DialogsInner::onContextToggleBlock() {
|
||||||
void DialogsInner::contextBlockDone(QPair<UserData*, bool> data, const MTPBool &result) {
|
void DialogsInner::contextBlockDone(QPair<UserData*, bool> data, const MTPBool &result) {
|
||||||
data.first->setBlockStatus(data.second ? UserData::BlockStatus::Blocked : UserData::BlockStatus::NotBlocked);
|
data.first->setBlockStatus(data.second ? UserData::BlockStatus::Blocked : UserData::BlockStatus::NotBlocked);
|
||||||
emit App::main()->peerUpdated(data.first);
|
emit App::main()->peerUpdated(data.first);
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogsInner::onMenuDestroyed(QObject *obj) {
|
void DialogsInner::onMenuDestroyed(QObject *obj) {
|
||||||
|
|
|
@ -4967,7 +4967,6 @@ void HistoryWidget::unblockDone(PeerData *peer, const MTPBool &result, mtpReques
|
||||||
if (_unblockRequest == req) _unblockRequest = 0;
|
if (_unblockRequest == req) _unblockRequest = 0;
|
||||||
peer->asUser()->setBlockStatus(UserData::BlockStatus::NotBlocked);
|
peer->asUser()->setBlockStatus(UserData::BlockStatus::NotBlocked);
|
||||||
emit App::main()->peerUpdated(peer);
|
emit App::main()->peerUpdated(peer);
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HistoryWidget::unblockFail(const RPCError &error, mtpRequestId req) {
|
bool HistoryWidget::unblockFail(const RPCError &error, mtpRequestId req) {
|
||||||
|
@ -4982,7 +4981,6 @@ void HistoryWidget::blockDone(PeerData *peer, const MTPBool &result) {
|
||||||
|
|
||||||
peer->asUser()->setBlockStatus(UserData::BlockStatus::Blocked);
|
peer->asUser()->setBlockStatus(UserData::BlockStatus::Blocked);
|
||||||
emit App::main()->peerUpdated(peer);
|
emit App::main()->peerUpdated(peer);
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::onBotStart() {
|
void HistoryWidget::onBotStart() {
|
||||||
|
@ -5096,8 +5094,6 @@ void HistoryWidget::shareContact(const PeerId &peer, const QString &phone, const
|
||||||
|
|
||||||
App::main()->finishForwarding(h, _broadcast.checked(), _silent.checked());
|
App::main()->finishForwarding(h, _broadcast.checked(), _silent.checked());
|
||||||
cancelReply(lastKeyboardUsed);
|
cancelReply(lastKeyboardUsed);
|
||||||
|
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::onSendPaths(const PeerId &peer) {
|
void HistoryWidget::onSendPaths(const PeerId &peer) {
|
||||||
|
@ -6290,8 +6286,6 @@ void HistoryWidget::confirmSendFile(const FileLoadResultPtr &file, bool ctrlShif
|
||||||
}
|
}
|
||||||
App::main()->dialogsToUp();
|
App::main()->dialogsToUp();
|
||||||
peerMessagesUpdated(file->to.peer);
|
peerMessagesUpdated(file->to.peer);
|
||||||
|
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::cancelSendFile(const FileLoadResultPtr &file) {
|
void HistoryWidget::cancelSendFile(const FileLoadResultPtr &file) {
|
||||||
|
@ -6926,7 +6920,6 @@ void HistoryWidget::addMessagesToFront(PeerData *peer, const QVector<MTPMessage>
|
||||||
}
|
}
|
||||||
updateBotKeyboard();
|
updateBotKeyboard();
|
||||||
}
|
}
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::addMessagesToBack(PeerData *peer, const QVector<MTPMessage> &messages, const QVector<MTPMessageGroup> *collapsed) {
|
void HistoryWidget::addMessagesToBack(PeerData *peer, const QVector<MTPMessage> &messages, const QVector<MTPMessageGroup> *collapsed) {
|
||||||
|
@ -6934,7 +6927,6 @@ void HistoryWidget::addMessagesToBack(PeerData *peer, const QVector<MTPMessage>
|
||||||
if (!_firstLoadRequest) {
|
if (!_firstLoadRequest) {
|
||||||
updateListSize(false, true, { ScrollChangeNoJumpToBottom, 0 });
|
updateListSize(false, true, { ScrollChangeNoJumpToBottom, 0 });
|
||||||
}
|
}
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::countHistoryShowFrom() {
|
void HistoryWidget::countHistoryShowFrom() {
|
||||||
|
@ -7182,8 +7174,6 @@ void HistoryWidget::onInlineResultSend(InlineBots::Result *result, UserData *bot
|
||||||
App::main()->finishForwarding(_history, _broadcast.checked(), _silent.checked());
|
App::main()->finishForwarding(_history, _broadcast.checked(), _silent.checked());
|
||||||
cancelReply(lastKeyboardUsed);
|
cancelReply(lastKeyboardUsed);
|
||||||
|
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
|
|
||||||
App::historyRegRandom(randomId, newId);
|
App::historyRegRandom(randomId, newId);
|
||||||
|
|
||||||
clearFieldText();
|
clearFieldText();
|
||||||
|
@ -7971,7 +7961,6 @@ void HistoryWidget::onDeleteSelectedSure() {
|
||||||
for (SelectedItemSet::const_iterator i = sel.cbegin(), e = sel.cend(); i != e; ++i) {
|
for (SelectedItemSet::const_iterator i = sel.cbegin(), e = sel.cend(); i != e; ++i) {
|
||||||
i.value()->destroy();
|
i.value()->destroy();
|
||||||
}
|
}
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
|
|
||||||
for (QMap<PeerData*, QVector<MTPint> >::const_iterator i = ids.cbegin(), e = ids.cend(); i != e; ++i) {
|
for (QMap<PeerData*, QVector<MTPint> >::const_iterator i = ids.cbegin(), e = ids.cend(); i != e; ++i) {
|
||||||
App::main()->deleteMessages(i.key(), i.value());
|
App::main()->deleteMessages(i.key(), i.value());
|
||||||
|
@ -7990,7 +7979,6 @@ void HistoryWidget::onDeleteContextSure() {
|
||||||
History *h = item->history();
|
History *h = item->history();
|
||||||
bool wasOnServer = (item->id > 0), wasLast = (h->lastMsg == item);
|
bool wasOnServer = (item->id > 0), wasLast = (h->lastMsg == item);
|
||||||
item->destroy();
|
item->destroy();
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
|
|
||||||
if (!wasOnServer && wasLast && !h->lastMsg) {
|
if (!wasOnServer && wasLast && !h->lastMsg) {
|
||||||
App::main()->checkPeerHistory(h->peer);
|
App::main()->checkPeerHistory(h->peer);
|
||||||
|
|
|
@ -3491,7 +3491,7 @@ namespace Local {
|
||||||
|
|
||||||
if (!wasLoaded) {
|
if (!wasLoaded) {
|
||||||
user->setPhone(phone);
|
user->setPhone(phone);
|
||||||
user->setNameDelayed(first, last, pname, username);
|
user->setName(first, last, pname, username);
|
||||||
|
|
||||||
user->access = access;
|
user->access = access;
|
||||||
user->flags = MTPDuser::Flags(flags);
|
user->flags = MTPDuser::Flags(flags);
|
||||||
|
@ -3526,7 +3526,7 @@ namespace Local {
|
||||||
flags = (flagsData == 1) ? MTPDchat::Flags(MTPDchat::Flag::f_left) : MTPDchat::Flags(0);
|
flags = (flagsData == 1) ? MTPDchat::Flags(MTPDchat::Flag::f_left) : MTPDchat::Flags(0);
|
||||||
}
|
}
|
||||||
if (!wasLoaded) {
|
if (!wasLoaded) {
|
||||||
chat->setNameDelayed(name);
|
chat->setName(name);
|
||||||
chat->count = count;
|
chat->count = count;
|
||||||
chat->date = date;
|
chat->date = date;
|
||||||
chat->version = version;
|
chat->version = version;
|
||||||
|
@ -3549,7 +3549,7 @@ namespace Local {
|
||||||
from.stream >> name >> access >> date >> version >> forbidden >> flags >> inviteLink;
|
from.stream >> name >> access >> date >> version >> forbidden >> flags >> inviteLink;
|
||||||
|
|
||||||
if (!wasLoaded) {
|
if (!wasLoaded) {
|
||||||
channel->setNameDelayed(name, QString());
|
channel->setName(name, QString());
|
||||||
channel->access = access;
|
channel->access = access;
|
||||||
channel->date = date;
|
channel->date = date;
|
||||||
channel->version = version;
|
channel->version = version;
|
||||||
|
@ -3746,7 +3746,6 @@ namespace Local {
|
||||||
peers.push_back(peer);
|
peers.push_back(peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
if (App::api()) App::api()->requestPeers(peers);
|
if (App::api()) App::api()->requestPeers(peers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -697,12 +697,10 @@ void MainWidget::deleteHistoryPart(PeerData *peer, const MTPmessages_AffectedHis
|
||||||
if (peer && peer->isChannel()) {
|
if (peer && peer->isChannel()) {
|
||||||
if (peer->asChannel()->ptsUpdated(d.vpts.v, d.vpts_count.v)) {
|
if (peer->asChannel()->ptsUpdated(d.vpts.v, d.vpts_count.v)) {
|
||||||
peer->asChannel()->ptsApplySkippedUpdates();
|
peer->asChannel()->ptsApplySkippedUpdates();
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ptsUpdated(d.vpts.v, d.vpts_count.v)) {
|
if (ptsUpdated(d.vpts.v, d.vpts_count.v)) {
|
||||||
ptsApplySkippedUpdates();
|
ptsApplySkippedUpdates();
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -727,9 +725,8 @@ void MainWidget::deleteMessages(PeerData *peer, const QVector<MTPint> &ids) {
|
||||||
|
|
||||||
void MainWidget::deletedContact(UserData *user, const MTPcontacts_Link &result) {
|
void MainWidget::deletedContact(UserData *user, const MTPcontacts_Link &result) {
|
||||||
auto &d(result.c_contacts_link());
|
auto &d(result.c_contacts_link());
|
||||||
App::feedUsersDelayed(MTP_vector<MTPUser>(1, d.vuser));
|
App::feedUsers(MTP_vector<MTPUser>(1, d.vuser));
|
||||||
App::feedUserLinkDelayed(MTP_int(peerToUser(user->id)), d.vmy_link, d.vforeign_link);
|
App::feedUserLink(MTP_int(peerToUser(user->id)), d.vmy_link, d.vforeign_link);
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::removeDialog(History *history) {
|
void MainWidget::removeDialog(History *history) {
|
||||||
|
@ -764,7 +761,6 @@ void MainWidget::deleteConversation(PeerData *peer, bool deleteHistory) {
|
||||||
if (deleteHistory) {
|
if (deleteHistory) {
|
||||||
MTP::send(MTPmessages_DeleteHistory(peer->input, MTP_int(0)), rpcDone(&MainWidget::deleteHistoryPart, peer));
|
MTP::send(MTPmessages_DeleteHistory(peer->input, MTP_int(0)), rpcDone(&MainWidget::deleteHistoryPart, peer));
|
||||||
}
|
}
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::deleteAndExit(ChatData *chat) {
|
void MainWidget::deleteAndExit(ChatData *chat) {
|
||||||
|
@ -789,7 +785,6 @@ void MainWidget::deleteAllFromUser(ChannelData *channel, UserData *from) {
|
||||||
item->destroy();
|
item->destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
MTP::send(MTPchannels_DeleteUserHistory(channel->inputChannel, from->inputUser), rpcDone(&MainWidget::deleteAllFromUserPart, { channel, from }));
|
MTP::send(MTPchannels_DeleteUserHistory(channel->inputChannel, from->inputUser), rpcDone(&MainWidget::deleteAllFromUserPart, { channel, from }));
|
||||||
}
|
}
|
||||||
|
@ -798,7 +793,6 @@ void MainWidget::deleteAllFromUserPart(DeleteAllFromUserParams params, const MTP
|
||||||
const auto &d(result.c_messages_affectedHistory());
|
const auto &d(result.c_messages_affectedHistory());
|
||||||
if (params.channel->ptsUpdated(d.vpts.v, d.vpts_count.v)) {
|
if (params.channel->ptsUpdated(d.vpts.v, d.vpts_count.v)) {
|
||||||
params.channel->ptsApplySkippedUpdates();
|
params.channel->ptsApplySkippedUpdates();
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 offset = d.voffset.v;
|
int32 offset = d.voffset.v;
|
||||||
|
@ -822,7 +816,6 @@ void MainWidget::clearHistory(PeerData *peer) {
|
||||||
}
|
}
|
||||||
Ui::showPeerHistory(peer->id, ShowAtUnreadMsgId);
|
Ui::showPeerHistory(peer->id, ShowAtUnreadMsgId);
|
||||||
MTP::send(MTPmessages_DeleteHistory(peer->input, MTP_int(0)), rpcDone(&MainWidget::deleteHistoryPart, peer));
|
MTP::send(MTPmessages_DeleteHistory(peer->input, MTP_int(0)), rpcDone(&MainWidget::deleteHistoryPart, peer));
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::addParticipants(PeerData *chatOrChannel, const QVector<UserData*> &users) {
|
void MainWidget::addParticipants(PeerData *chatOrChannel, const QVector<UserData*> &users) {
|
||||||
|
@ -979,7 +972,6 @@ void MainWidget::checkedHistory(PeerData *peer, const MTPmessages_Messages &resu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWidget::sendMessageFail(const RPCError &error) {
|
bool MainWidget::sendMessageFail(const RPCError &error) {
|
||||||
|
@ -1285,7 +1277,6 @@ void MainWidget::overviewPreloaded(PeerData *peer, const MTPmessages_Messages &r
|
||||||
App::history(peer->id)->overviewSliceDone(type, result, true);
|
App::history(peer->id)->overviewSliceDone(type, result, true);
|
||||||
|
|
||||||
if (App::wnd()) App::wnd()->mediaOverviewUpdated(peer, type);
|
if (App::wnd()) App::wnd()->mediaOverviewUpdated(peer, type);
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::mediaOverviewUpdated(PeerData *peer, MediaOverviewType type) {
|
void MainWidget::mediaOverviewUpdated(PeerData *peer, MediaOverviewType type) {
|
||||||
|
@ -1423,7 +1414,6 @@ void MainWidget::overviewLoaded(History *history, const MTPmessages_Messages &re
|
||||||
history->overviewSliceDone(type, result);
|
history->overviewSliceDone(type, result);
|
||||||
|
|
||||||
if (App::wnd()) App::wnd()->mediaOverviewUpdated(history->peer, type);
|
if (App::wnd()) App::wnd()->mediaOverviewUpdated(history->peer, type);
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::sendReadRequest(PeerData *peer, MsgId upTo) {
|
void MainWidget::sendReadRequest(PeerData *peer, MsgId upTo) {
|
||||||
|
@ -1465,12 +1455,10 @@ void MainWidget::messagesAffected(PeerData *peer, const MTPmessages_AffectedMess
|
||||||
if (peer && peer->isChannel()) {
|
if (peer && peer->isChannel()) {
|
||||||
if (peer->asChannel()->ptsUpdated(d.vpts.v, d.vpts_count.v)) {
|
if (peer->asChannel()->ptsUpdated(d.vpts.v, d.vpts_count.v)) {
|
||||||
peer->asChannel()->ptsApplySkippedUpdates();
|
peer->asChannel()->ptsApplySkippedUpdates();
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ptsUpdated(d.vpts.v, d.vpts_count.v)) {
|
if (ptsUpdated(d.vpts.v, d.vpts_count.v)) {
|
||||||
ptsApplySkippedUpdates();
|
ptsApplySkippedUpdates();
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (History *h = App::historyLoaded(peer ? peer->id : 0)) {
|
if (History *h = App::historyLoaded(peer ? peer->id : 0)) {
|
||||||
|
@ -2425,7 +2413,6 @@ void MainWidget::windowShown() {
|
||||||
|
|
||||||
void MainWidget::sentUpdatesReceived(uint64 randomId, const MTPUpdates &result) {
|
void MainWidget::sentUpdatesReceived(uint64 randomId, const MTPUpdates &result) {
|
||||||
feedUpdates(result, randomId);
|
feedUpdates(result, randomId);
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWidget::deleteChannelFailed(const RPCError &error) {
|
bool MainWidget::deleteChannelFailed(const RPCError &error) {
|
||||||
|
@ -2873,8 +2860,8 @@ void MainWidget::gotChannelDifference(ChannelData *channel, const MTPupdates_Cha
|
||||||
case mtpc_updates_channelDifference: {
|
case mtpc_updates_channelDifference: {
|
||||||
const auto &d(diff.c_updates_channelDifference());
|
const auto &d(diff.c_updates_channelDifference());
|
||||||
|
|
||||||
App::feedUsersDelayed(d.vusers);
|
App::feedUsers(d.vusers);
|
||||||
App::feedChatsDelayed(d.vchats);
|
App::feedChats(d.vchats);
|
||||||
|
|
||||||
_handlingChannelDifference = true;
|
_handlingChannelDifference = true;
|
||||||
feedMessageIds(d.vother_updates);
|
feedMessageIds(d.vother_updates);
|
||||||
|
@ -2943,8 +2930,6 @@ void MainWidget::gotChannelDifference(ChannelData *channel, const MTPupdates_Cha
|
||||||
} else if (activePeer() == channel) {
|
} else if (activePeer() == channel) {
|
||||||
channel->ptsWaitingForShortPoll(timeout ? (timeout * 1000) : WaitForChannelGetDifference);
|
channel->ptsWaitingForShortPoll(timeout ? (timeout * 1000) : WaitForChannelGetDifference);
|
||||||
}
|
}
|
||||||
|
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::gotRangeDifference(ChannelData *channel, const MTPupdates_ChannelDifference &diff) {
|
void MainWidget::gotRangeDifference(ChannelData *channel, const MTPupdates_ChannelDifference &diff) {
|
||||||
|
@ -2960,8 +2945,8 @@ void MainWidget::gotRangeDifference(ChannelData *channel, const MTPupdates_Chann
|
||||||
case mtpc_updates_channelDifferenceTooLong: {
|
case mtpc_updates_channelDifferenceTooLong: {
|
||||||
const auto &d(diff.c_updates_channelDifferenceTooLong());
|
const auto &d(diff.c_updates_channelDifferenceTooLong());
|
||||||
|
|
||||||
App::feedUsersDelayed(d.vusers);
|
App::feedUsers(d.vusers);
|
||||||
App::feedChatsDelayed(d.vchats);
|
App::feedChats(d.vchats);
|
||||||
|
|
||||||
nextRequestPts = d.vpts.v;
|
nextRequestPts = d.vpts.v;
|
||||||
isFinal = d.is_final();
|
isFinal = d.is_final();
|
||||||
|
@ -2970,8 +2955,8 @@ void MainWidget::gotRangeDifference(ChannelData *channel, const MTPupdates_Chann
|
||||||
case mtpc_updates_channelDifference: {
|
case mtpc_updates_channelDifference: {
|
||||||
const auto &d(diff.c_updates_channelDifference());
|
const auto &d(diff.c_updates_channelDifference());
|
||||||
|
|
||||||
App::feedUsersDelayed(d.vusers);
|
App::feedUsers(d.vusers);
|
||||||
App::feedChatsDelayed(d.vchats);
|
App::feedChats(d.vchats);
|
||||||
|
|
||||||
_handlingChannelDifference = true;
|
_handlingChannelDifference = true;
|
||||||
feedMessageIds(d.vother_updates);
|
feedMessageIds(d.vother_updates);
|
||||||
|
@ -2990,8 +2975,6 @@ void MainWidget::gotRangeDifference(ChannelData *channel, const MTPupdates_Chann
|
||||||
h->asChannelHistory()->getRangeDifferenceNext(nextRequestPts);
|
h->asChannelHistory()->getRangeDifferenceNext(nextRequestPts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWidget::failChannelDifference(ChannelData *channel, const RPCError &error) {
|
bool MainWidget::failChannelDifference(ChannelData *channel, const RPCError &error) {
|
||||||
|
@ -3012,8 +2995,6 @@ void MainWidget::gotState(const MTPupdates_State &state) {
|
||||||
|
|
||||||
_dialogs->loadDialogs();
|
_dialogs->loadDialogs();
|
||||||
updateOnline();
|
updateOnline();
|
||||||
|
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::gotDifference(const MTPupdates_Difference &diff) {
|
void MainWidget::gotDifference(const MTPupdates_Difference &diff) {
|
||||||
|
@ -3048,7 +3029,6 @@ void MainWidget::gotDifference(const MTPupdates_Difference &diff) {
|
||||||
gotState(d.vstate);
|
gotState(d.vstate);
|
||||||
} break;
|
} break;
|
||||||
};
|
};
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWidget::getDifferenceTimeChanged(ChannelData *channel, int32 ms, ChannelGetDifferenceTime &channelCurTime, uint64 &curTime) {
|
bool MainWidget::getDifferenceTimeChanged(ChannelData *channel, int32 ms, ChannelGetDifferenceTime &channelCurTime, uint64 &curTime) {
|
||||||
|
@ -3138,8 +3118,8 @@ void MainWidget::ptsApplySkippedUpdates() {
|
||||||
|
|
||||||
void MainWidget::feedDifference(const MTPVector<MTPUser> &users, const MTPVector<MTPChat> &chats, const MTPVector<MTPMessage> &msgs, const MTPVector<MTPUpdate> &other) {
|
void MainWidget::feedDifference(const MTPVector<MTPUser> &users, const MTPVector<MTPChat> &chats, const MTPVector<MTPMessage> &msgs, const MTPVector<MTPUpdate> &other) {
|
||||||
App::wnd()->checkAutoLock();
|
App::wnd()->checkAutoLock();
|
||||||
App::feedUsersDelayed(users);
|
App::feedUsers(users);
|
||||||
App::feedChatsDelayed(chats);
|
App::feedChats(chats);
|
||||||
feedMessageIds(other);
|
feedMessageIds(other);
|
||||||
App::feedMsgs(msgs, NewMessageUnread);
|
App::feedMsgs(msgs, NewMessageUnread);
|
||||||
feedUpdateVector(other, true);
|
feedUpdateVector(other, true);
|
||||||
|
@ -3541,6 +3521,7 @@ void MainWidget::startFull(const MTPVector<MTPUser> &users) {
|
||||||
|
|
||||||
void MainWidget::applyNotifySetting(const MTPNotifyPeer &peer, const MTPPeerNotifySettings &settings, History *h) {
|
void MainWidget::applyNotifySetting(const MTPNotifyPeer &peer, const MTPPeerNotifySettings &settings, History *h) {
|
||||||
PeerData *updatePeer = nullptr;
|
PeerData *updatePeer = nullptr;
|
||||||
|
bool changed = false;
|
||||||
switch (settings.type()) {
|
switch (settings.type()) {
|
||||||
case mtpc_peerNotifySettingsEmpty:
|
case mtpc_peerNotifySettingsEmpty:
|
||||||
switch (peer.type()) {
|
switch (peer.type()) {
|
||||||
|
@ -3548,15 +3529,17 @@ void MainWidget::applyNotifySetting(const MTPNotifyPeer &peer, const MTPPeerNoti
|
||||||
case mtpc_notifyUsers: globalNotifyUsersPtr = EmptyNotifySettings; break;
|
case mtpc_notifyUsers: globalNotifyUsersPtr = EmptyNotifySettings; break;
|
||||||
case mtpc_notifyChats: globalNotifyChatsPtr = EmptyNotifySettings; break;
|
case mtpc_notifyChats: globalNotifyChatsPtr = EmptyNotifySettings; break;
|
||||||
case mtpc_notifyPeer: {
|
case mtpc_notifyPeer: {
|
||||||
updatePeer = App::peerLoaded(peerFromMTP(peer.c_notifyPeer().vpeer));
|
if ((updatePeer = App::peerLoaded(peerFromMTP(peer.c_notifyPeer().vpeer)))) {
|
||||||
if (updatePeer && updatePeer->notify != EmptyNotifySettings) {
|
changed = (updatePeer->notify != EmptyNotifySettings);
|
||||||
if (updatePeer->notify != UnknownNotifySettings) {
|
if (changed) {
|
||||||
delete updatePeer->notify;
|
if (updatePeer->notify != UnknownNotifySettings) {
|
||||||
|
delete updatePeer->notify;
|
||||||
|
}
|
||||||
|
updatePeer->notify = EmptyNotifySettings;
|
||||||
|
App::unregMuted(updatePeer);
|
||||||
|
if (!h) h = App::history(updatePeer->id);
|
||||||
|
h->setMute(false);
|
||||||
}
|
}
|
||||||
updatePeer->notify = EmptyNotifySettings;
|
|
||||||
App::unregMuted(updatePeer);
|
|
||||||
if (!h) h = App::history(updatePeer->id);
|
|
||||||
h->setMute(false);
|
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
@ -3569,29 +3552,32 @@ void MainWidget::applyNotifySetting(const MTPNotifyPeer &peer, const MTPPeerNoti
|
||||||
case mtpc_notifyUsers: setTo = globalNotifyUsersPtr = &globalNotifyUsers; break;
|
case mtpc_notifyUsers: setTo = globalNotifyUsersPtr = &globalNotifyUsers; break;
|
||||||
case mtpc_notifyChats: setTo = globalNotifyChatsPtr = &globalNotifyChats; break;
|
case mtpc_notifyChats: setTo = globalNotifyChatsPtr = &globalNotifyChats; break;
|
||||||
case mtpc_notifyPeer: {
|
case mtpc_notifyPeer: {
|
||||||
updatePeer = App::peerLoaded(peerFromMTP(peer.c_notifyPeer().vpeer));
|
if ((updatePeer = App::peerLoaded(peerFromMTP(peer.c_notifyPeer().vpeer)))) {
|
||||||
if (!updatePeer) break;
|
if (updatePeer->notify == UnknownNotifySettings || updatePeer->notify == EmptyNotifySettings) {
|
||||||
|
changed = true;
|
||||||
if (updatePeer->notify == UnknownNotifySettings || updatePeer->notify == EmptyNotifySettings) {
|
updatePeer->notify = new NotifySettings();
|
||||||
updatePeer->notify = new NotifySettings();
|
}
|
||||||
|
setTo = updatePeer->notify;
|
||||||
}
|
}
|
||||||
setTo = updatePeer->notify;
|
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
if (setTo == UnknownNotifySettings) break;
|
if (setTo == UnknownNotifySettings) break;
|
||||||
|
|
||||||
setTo->flags = d.vflags.v;
|
changed = (setTo->flags != d.vflags.v) || (setTo->mute != d.vmute_until.v) || (setTo->sound != d.vsound.c_string().v);
|
||||||
setTo->mute = d.vmute_until.v;
|
if (changed) {
|
||||||
setTo->sound = d.vsound.c_string().v;
|
setTo->flags = d.vflags.v;
|
||||||
if (updatePeer) {
|
setTo->mute = d.vmute_until.v;
|
||||||
if (!h) h = App::history(updatePeer->id);
|
setTo->sound = d.vsound.c_string().v;
|
||||||
int32 changeIn = 0;
|
if (updatePeer) {
|
||||||
if (isNotifyMuted(setTo, &changeIn)) {
|
if (!h) h = App::history(updatePeer->id);
|
||||||
App::wnd()->notifyClear(h);
|
int32 changeIn = 0;
|
||||||
h->setMute(true);
|
if (isNotifyMuted(setTo, &changeIn)) {
|
||||||
App::regMuted(updatePeer, changeIn);
|
App::wnd()->notifyClear(h);
|
||||||
} else {
|
h->setMute(true);
|
||||||
h->setMute(false);
|
App::regMuted(updatePeer, changeIn);
|
||||||
|
} else {
|
||||||
|
h->setMute(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
@ -3602,8 +3588,9 @@ void MainWidget::applyNotifySetting(const MTPNotifyPeer &peer, const MTPPeerNoti
|
||||||
_history->updateNotifySettings();
|
_history->updateNotifySettings();
|
||||||
}
|
}
|
||||||
_dialogs->updateNotifySettings(updatePeer);
|
_dialogs->updateNotifySettings(updatePeer);
|
||||||
|
if (changed) {
|
||||||
Notify::peerUpdatedDelayed(updatePeer, Notify::PeerUpdate::Flag::NotificationsEnabled);
|
Notify::peerUpdatedDelayed(updatePeer, Notify::PeerUpdate::Flag::NotificationsEnabled);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3845,7 +3832,6 @@ void MainWidget::updateReceived(const mtpPrime *from, const mtpPrime *end) {
|
||||||
if (!_ptsWaiter.requesting()) {
|
if (!_ptsWaiter.requesting()) {
|
||||||
feedUpdates(updates);
|
feedUpdates(updates);
|
||||||
}
|
}
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
} catch (mtpErrorUnexpected &) { // just some other type
|
} catch (mtpErrorUnexpected &) { // just some other type
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3965,8 +3951,8 @@ void MainWidget::feedUpdates(const MTPUpdates &updates, uint64 randomId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
App::feedUsersDelayed(d.vusers);
|
App::feedUsers(d.vusers);
|
||||||
App::feedChatsDelayed(d.vchats);
|
App::feedChats(d.vchats);
|
||||||
feedUpdateVector(d.vupdates);
|
feedUpdateVector(d.vupdates);
|
||||||
|
|
||||||
updSetState(0, d.vdate.v, updQts, d.vseq.v);
|
updSetState(0, d.vdate.v, updQts, d.vseq.v);
|
||||||
|
@ -3982,8 +3968,8 @@ void MainWidget::feedUpdates(const MTPUpdates &updates, uint64 randomId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
App::feedUsersDelayed(d.vusers);
|
App::feedUsers(d.vusers);
|
||||||
App::feedChatsDelayed(d.vchats);
|
App::feedChats(d.vchats);
|
||||||
feedUpdateVector(d.vupdates);
|
feedUpdateVector(d.vupdates);
|
||||||
|
|
||||||
updSetState(0, d.vdate.v, updQts, d.vseq.v);
|
updSetState(0, d.vdate.v, updQts, d.vseq.v);
|
||||||
|
@ -4311,9 +4297,9 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
|
||||||
auto &d(update.c_updateUserName());
|
auto &d(update.c_updateUserName());
|
||||||
if (auto user = App::userLoaded(d.vuser_id.v)) {
|
if (auto user = App::userLoaded(d.vuser_id.v)) {
|
||||||
if (user->contact <= 0) {
|
if (user->contact <= 0) {
|
||||||
user->setNameDelayed(textOneLine(qs(d.vfirst_name)), textOneLine(qs(d.vlast_name)), user->nameOrPhone, textOneLine(qs(d.vusername)));
|
user->setName(textOneLine(qs(d.vfirst_name)), textOneLine(qs(d.vlast_name)), user->nameOrPhone, textOneLine(qs(d.vusername)));
|
||||||
} else {
|
} else {
|
||||||
user->setNameDelayed(textOneLine(user->firstName), textOneLine(user->lastName), user->nameOrPhone, textOneLine(qs(d.vusername)));
|
user->setName(textOneLine(user->firstName), textOneLine(user->lastName), user->nameOrPhone, textOneLine(qs(d.vusername)));
|
||||||
}
|
}
|
||||||
App::markPeerUpdated(user);
|
App::markPeerUpdated(user);
|
||||||
}
|
}
|
||||||
|
@ -4354,7 +4340,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
|
||||||
|
|
||||||
case mtpc_updateContactLink: {
|
case mtpc_updateContactLink: {
|
||||||
const auto &d(update.c_updateContactLink());
|
const auto &d(update.c_updateContactLink());
|
||||||
App::feedUserLinkDelayed(d.vuser_id, d.vmy_link, d.vforeign_link);
|
App::feedUserLink(d.vuser_id, d.vmy_link, d.vforeign_link);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case mtpc_updateNotifySettings: {
|
case mtpc_updateNotifySettings: {
|
||||||
|
@ -4373,7 +4359,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
|
||||||
auto newPhone = qs(d.vphone);
|
auto newPhone = qs(d.vphone);
|
||||||
if (newPhone != user->phone()) {
|
if (newPhone != user->phone()) {
|
||||||
user->setPhone(newPhone);
|
user->setPhone(newPhone);
|
||||||
user->setNameDelayed(user->firstName, user->lastName, (user->contact || isServiceUser(user->id) || user->isSelf() || user->phone().isEmpty()) ? QString() : App::formatPhone(user->phone()), user->username);
|
user->setName(user->firstName, user->lastName, (user->contact || isServiceUser(user->id) || user->isSelf() || user->phone().isEmpty()) ? QString() : App::formatPhone(user->phone()), user->username);
|
||||||
App::markPeerUpdated(user);
|
App::markPeerUpdated(user);
|
||||||
|
|
||||||
Notify::peerUpdatedDelayed(user, Notify::PeerUpdate::Flag::UserPhoneChanged);
|
Notify::peerUpdatedDelayed(user, Notify::PeerUpdate::Flag::UserPhoneChanged);
|
||||||
|
|
|
@ -271,11 +271,6 @@ bool UserData::setAbout(const QString &newAbout) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserData::setName(const QString &newFirstName, const QString &newLastName, const QString &newPhoneName, const QString &newUsername) {
|
void UserData::setName(const QString &newFirstName, const QString &newLastName, const QString &newPhoneName, const QString &newUsername) {
|
||||||
setNameDelayed(newFirstName, newLastName, newPhoneName, newUsername);
|
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
|
||||||
|
|
||||||
void UserData::setNameDelayed(const QString &newFirstName, const QString &newLastName, const QString &newPhoneName, const QString &newUsername) {
|
|
||||||
bool changeName = !newFirstName.isEmpty() || !newLastName.isEmpty();
|
bool changeName = !newFirstName.isEmpty() || !newLastName.isEmpty();
|
||||||
|
|
||||||
QString newFullName;
|
QString newFullName;
|
||||||
|
@ -431,11 +426,6 @@ void ChatData::setPhoto(const MTPChatPhoto &p, const PhotoId &phId) { // see Loc
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatData::setName(const QString &newName) {
|
void ChatData::setName(const QString &newName) {
|
||||||
setNameDelayed(newName);
|
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ChatData::setNameDelayed(const QString &newName) {
|
|
||||||
updateNameDelayed(newName.isEmpty() ? name : newName, QString(), QString());
|
updateNameDelayed(newName.isEmpty() ? name : newName, QString(), QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -479,11 +469,6 @@ void ChannelData::setPhoto(const MTPChatPhoto &p, const PhotoId &phId) { // see
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelData::setName(const QString &newName, const QString &newUsername) {
|
void ChannelData::setName(const QString &newName, const QString &newUsername) {
|
||||||
setNameDelayed(newName, newUsername);
|
|
||||||
Notify::peerUpdatedSendDelayed();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ChannelData::setNameDelayed(const QString &newName, const QString &newUsername) {
|
|
||||||
updateNameDelayed(newName.isEmpty() ? name : newName, QString(), newUsername);
|
updateNameDelayed(newName.isEmpty() ? name : newName, QString(), newUsername);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -337,7 +337,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Requires Notify::peerUpdatedSendDelayed() call after.
|
|
||||||
void updateNameDelayed(const QString &newName, const QString &newNameOrPhone, const QString &newUsername);
|
void updateNameDelayed(const QString &newName, const QString &newNameOrPhone, const QString &newUsername);
|
||||||
|
|
||||||
ImagePtr _userpic;
|
ImagePtr _userpic;
|
||||||
|
@ -399,10 +398,6 @@ public:
|
||||||
void setName(const QString &newFirstName, const QString &newLastName
|
void setName(const QString &newFirstName, const QString &newLastName
|
||||||
, const QString &newPhoneName, const QString &newUsername);
|
, const QString &newPhoneName, const QString &newUsername);
|
||||||
|
|
||||||
// Requires Notify::peerUpdatedSendDelayed() call after.
|
|
||||||
void setNameDelayed(const QString &newFirstName, const QString &newLastName
|
|
||||||
, const QString &newPhoneName, const QString &newUsername);
|
|
||||||
|
|
||||||
void setPhone(const QString &newPhone);
|
void setPhone(const QString &newPhone);
|
||||||
void setBotInfoVersion(int version);
|
void setBotInfoVersion(int version);
|
||||||
void setBotInfo(const MTPBotInfo &info);
|
void setBotInfo(const MTPBotInfo &info);
|
||||||
|
@ -499,9 +494,6 @@ public:
|
||||||
|
|
||||||
void setName(const QString &newName);
|
void setName(const QString &newName);
|
||||||
|
|
||||||
// Requires Notify::peerUpdatedSendDelayed() call after.
|
|
||||||
void setNameDelayed(const QString &newName);
|
|
||||||
|
|
||||||
void invalidateParticipants() {
|
void invalidateParticipants() {
|
||||||
participants = ChatData::Participants();
|
participants = ChatData::Participants();
|
||||||
admins = ChatData::Admins();
|
admins = ChatData::Admins();
|
||||||
|
@ -679,9 +671,6 @@ public:
|
||||||
|
|
||||||
void setName(const QString &name, const QString &username);
|
void setName(const QString &name, const QString &username);
|
||||||
|
|
||||||
// Requires Notify::peerUpdatedSendDelayed() call after.
|
|
||||||
void setNameDelayed(const QString &name, const QString &username);
|
|
||||||
|
|
||||||
void updateFull(bool force = false);
|
void updateFull(bool force = false);
|
||||||
void fullUpdated();
|
void fullUpdated();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue