2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-03 16:05:57 +00:00

Notify::peerUpdatedSendDelayed() now is always called from the event loop.

This commit is contained in:
John Preston
2016-06-02 16:57:49 +03:00
parent 2c4ec3d9f3
commit 91d516f18c
12 changed files with 73 additions and 162 deletions

View File

@@ -365,7 +365,7 @@ namespace {
return (online > now);
}
UserData *feedUsersDelayed(const MTPVector<MTPUser> &users) {
UserData *feedUsers(const MTPVector<MTPUser> &users) {
UserData *result = nullptr;
for_const (auto &user, users.c_vector().v) {
UserData *data = nullptr;
@@ -386,7 +386,7 @@ namespace {
data->input = MTP_inputPeerUser(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->access = UserNoAccess;
data->flags = 0;
@@ -432,7 +432,7 @@ namespace {
data->setPhone(QString());
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->access = UserNoAccess;
status = &emptyStatus;
@@ -467,7 +467,7 @@ namespace {
if (!minimal && d.is_self() && uname != data->username) {
SignalHandlers::setCrashAnnotation("Username", uname);
}
data->setNameDelayed(fname, lname, pname, uname);
data->setName(fname, lname, pname, uname);
if (d.has_photo()) {
data->setPhoto(d.vphoto);
} else {
@@ -547,7 +547,7 @@ namespace {
return result;
}
PeerData *feedChatsDelayed(const MTPVector<MTPChat> &chats) {
PeerData *feedChats(const MTPVector<MTPChat> &chats) {
PeerData *result = nullptr;
for_const (auto &chat, chats.c_vector().v) {
PeerData *data = nullptr;
@@ -565,7 +565,7 @@ namespace {
auto canEdit = cdata->canEdit();
data->input = MTP_inputPeerChat(d.vid);
cdata->setNameDelayed(qs(d.vtitle));
cdata->setName(qs(d.vtitle));
cdata->setPhoto(d.vphoto);
cdata->date = d.vdate.v;
@@ -627,7 +627,7 @@ namespace {
auto canEdit = cdata->canEdit();
data->input = MTP_inputPeerChat(d.vid);
cdata->setNameDelayed(qs(d.vtitle));
cdata->setName(qs(d.vtitle));
cdata->setPhoto(MTP_chatPhotoEmpty());
cdata->date = 0;
cdata->count = -1;
@@ -679,7 +679,7 @@ namespace {
}
}
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->flagsUpdated();
@@ -709,7 +709,7 @@ namespace {
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->setPhoto(MTP_chatPhotoEmpty());
@@ -746,18 +746,6 @@ namespace {
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) {
ChatData *chat = 0;
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);
if (user) {
auto wasContact = user->isContact();
@@ -1271,7 +1259,7 @@ namespace {
bool showPhone = !isServiceUser(user->id) && !user->isSelf() && !user->contact;
bool showPhoneChanged = !isServiceUser(user->id) && !user->isSelf() && ((showPhone && !wasShowPhone) || (!showPhone && wasShowPhone));
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);
}