version 0.8.35.dev ready with some optimizations

This commit is contained in:
John Preston 2015-06-30 01:09:23 +03:00
parent 4b2fccf762
commit d57f6a973f
18 changed files with 275 additions and 110 deletions

View File

@ -1,10 +1,10 @@
@echo OFF @echo OFF
set "AppVersionStrMajor=0.8" set "AppVersionStrMajor=0.8"
set "AppVersion=8034" set "AppVersion=8035"
set "AppVersionStrSmall=0.8.34" set "AppVersionStrSmall=0.8.35"
set "AppVersionStr=0.8.34" set "AppVersionStr=0.8.35"
set "AppVersionStrFull=0.8.34.0" set "AppVersionStrFull=0.8.35.0"
set "DevChannel=1" set "DevChannel=1"
if %DevChannel% neq 0 goto preparedev if %DevChannel% neq 0 goto preparedev

View File

@ -132,22 +132,27 @@ void ApiWrap::gotReplyTo(const MTPmessages_Messages &msgs, mtpRequestId req) {
} }
void ApiWrap::requestFullPeer(PeerData *peer) { void ApiWrap::requestFullPeer(PeerData *peer) {
if (!peer || _fullRequests.contains(peer)) return; if (!peer || _fullPeerRequests.contains(peer)) return;
mtpRequestId req; mtpRequestId req;
if (peer->chat) { if (peer->chat) {
req = MTP::send(MTPmessages_GetFullChat(MTP_int(App::chatFromPeer(peer->id))), rpcDone(&ApiWrap::gotChatFull, peer), rpcFail(&ApiWrap::gotPeerFailed, peer)); req = MTP::send(MTPmessages_GetFullChat(MTP_int(App::chatFromPeer(peer->id))), rpcDone(&ApiWrap::gotChatFull, peer), rpcFail(&ApiWrap::gotPeerFullFailed, peer));
} else { } else {
req = MTP::send(MTPusers_GetFullUser(peer->asUser()->inputUser), rpcDone(&ApiWrap::gotUserFull, peer), rpcFail(&ApiWrap::gotPeerFailed, peer)); req = MTP::send(MTPusers_GetFullUser(peer->asUser()->inputUser), rpcDone(&ApiWrap::gotUserFull, peer), rpcFail(&ApiWrap::gotPeerFullFailed, peer));
} }
_fullRequests.insert(peer, req); _fullPeerRequests.insert(peer, req);
} }
void ApiWrap::gotChatFull(PeerData *peer, const MTPmessages_ChatFull &result) { void ApiWrap::gotChatFull(PeerData *peer, const MTPmessages_ChatFull &result) {
const MTPDmessages_chatFull &d(result.c_messages_chatFull()); const MTPDmessages_chatFull &d(result.c_messages_chatFull());
const MTPDchatFull &f(d.vfull_chat.c_chatFull()); const MTPDchatFull &f(d.vfull_chat.c_chatFull());
App::feedUsers(d.vusers);
App::feedChats(d.vchats); const QVector<MTPChat> &vc(d.vchats.c_vector().v);
App::feedParticipants(f.vparticipants); bool badVersion = (!vc.isEmpty() && vc.at(0).type() == mtpc_chat && vc.at(0).c_chat().vversion.v < peer->asChat()->version);
App::feedUsers(d.vusers, false);
App::feedChats(d.vchats, false);
App::feedParticipants(f.vparticipants, false, false);
const QVector<MTPBotInfo> &v(f.vbot_info.c_vector().v); const QVector<MTPBotInfo> &v(f.vbot_info.c_vector().v);
for (QVector<MTPBotInfo>::const_iterator i = v.cbegin(), e = v.cend(); i < e; ++i) { for (QVector<MTPBotInfo>::const_iterator i = v.cbegin(), e = v.cend(); i < e; ++i) {
switch (i->type()) { switch (i->type()) {
@ -156,6 +161,7 @@ void ApiWrap::gotChatFull(PeerData *peer, const MTPmessages_ChatFull &result) {
UserData *user = App::userLoaded(b.vuser_id.v); UserData *user = App::userLoaded(b.vuser_id.v);
if (user) { if (user) {
user->setBotInfo(*i); user->setBotInfo(*i);
App::clearPeerUpdated(user);
emit fullPeerUpdated(user); emit fullPeerUpdated(user);
} }
} break; } break;
@ -167,33 +173,86 @@ void ApiWrap::gotChatFull(PeerData *peer, const MTPmessages_ChatFull &result) {
if (photo) { if (photo) {
chat->photoId = photo->id; chat->photoId = photo->id;
photo->chat = chat; photo->chat = chat;
} else {
chat->photoId = 0;
} }
chat->invitationUrl = (f.vexported_invite.type() == mtpc_chatInviteExported) ? qs(f.vexported_invite.c_chatInviteExported().vlink) : QString(); chat->invitationUrl = (f.vexported_invite.type() == mtpc_chatInviteExported) ? qs(f.vexported_invite.c_chatInviteExported().vlink) : QString();
} }
App::main()->gotNotifySetting(MTP_inputNotifyPeer(peer->input), f.vnotify_settings); App::main()->gotNotifySetting(MTP_inputNotifyPeer(peer->input), f.vnotify_settings);
_fullRequests.remove(peer); _fullPeerRequests.remove(peer);
if (badVersion) {
peer->asChat()->version = vc.at(0).c_chat().vversion.v;
requestPeer(peer);
}
App::clearPeerUpdated(peer);
emit fullPeerUpdated(peer); emit fullPeerUpdated(peer);
App::emitPeerUpdated();
} }
void ApiWrap::gotUserFull(PeerData *peer, const MTPUserFull &result) { void ApiWrap::gotUserFull(PeerData *peer, const MTPUserFull &result) {
const MTPDuserFull &d(result.c_userFull()); const MTPDuserFull &d(result.c_userFull());
App::feedUsers(MTP_vector<MTPUser>(1, d.vuser)); App::feedUsers(MTP_vector<MTPUser>(1, d.vuser), false);
App::feedPhoto(d.vprofile_photo); App::feedPhoto(d.vprofile_photo);
App::feedUserLink(MTP_int(App::userFromPeer(peer->id)), d.vlink.c_contacts_link().vmy_link, d.vlink.c_contacts_link().vforeign_link); App::feedUserLink(MTP_int(App::userFromPeer(peer->id)), d.vlink.c_contacts_link().vmy_link, d.vlink.c_contacts_link().vforeign_link, false);
App::main()->gotNotifySetting(MTP_inputNotifyPeer(peer->input), d.vnotify_settings); App::main()->gotNotifySetting(MTP_inputNotifyPeer(peer->input), d.vnotify_settings);
peer->asUser()->setBotInfo(d.vbot_info); peer->asUser()->setBotInfo(d.vbot_info);
_fullRequests.remove(peer); _fullPeerRequests.remove(peer);
App::clearPeerUpdated(peer);
emit fullPeerUpdated(peer); emit fullPeerUpdated(peer);
App::emitPeerUpdated();
}
bool ApiWrap::gotPeerFullFailed(PeerData *peer, const RPCError &error) {
if (error.type().startsWith(qsl("FLOOD_WAIT_"))) return false;
_fullPeerRequests.remove(peer);
return true;
}
void ApiWrap::requestPeer(PeerData *peer) {
if (!peer || _fullPeerRequests.contains(peer) || _peerRequests.contains(peer)) return;
mtpRequestId req;
if (peer->chat) {
req = MTP::send(MTPmessages_GetChats(MTP_vector<MTPint>(1, MTP_int(App::chatFromPeer(peer->id)))), rpcDone(&ApiWrap::gotChat, peer), rpcFail(&ApiWrap::gotPeerFailed, peer));
} else {
req = MTP::send(MTPusers_GetUsers(MTP_vector<MTPInputUser>(1, peer->asUser()->inputUser)), rpcDone(&ApiWrap::gotUser, peer), rpcFail(&ApiWrap::gotPeerFailed, peer));
}
_peerRequests.insert(peer, req);
}
void ApiWrap::gotChat(PeerData *peer, const MTPmessages_Chats &result) {
_peerRequests.remove(peer);
if (result.type() == mtpc_messages_chats) {
const QVector<MTPChat> &v(result.c_messages_chats().vchats.c_vector().v);
bool badVersion = (!v.isEmpty() && v.at(0).type() == mtpc_chat && v.at(0).c_chat().vversion.v < peer->asChat()->version);
ChatData *chat = App::feedChats(result.c_messages_chats().vchats);
if (chat == peer) {
if (badVersion) {
peer->asChat()->version = v.at(0).c_chat().vversion.v;
requestPeer(peer);
}
}
}
}
void ApiWrap::gotUser(PeerData *peer, const MTPVector<MTPUser> &result) {
_peerRequests.remove(peer);
UserData *user = App::feedUsers(result);
if (user == peer) {
}
} }
bool ApiWrap::gotPeerFailed(PeerData *peer, const RPCError &error) { bool ApiWrap::gotPeerFailed(PeerData *peer, const RPCError &error) {
if (error.type().startsWith(qsl("FLOOD_WAIT_"))) return false; if (error.type().startsWith(qsl("FLOOD_WAIT_"))) return false;
_fullRequests.remove(peer); _peerRequests.remove(peer);
return true; return true;
} }

View File

@ -31,6 +31,7 @@ public:
void requestReplyTo(HistoryReply *reply, MsgId to); void requestReplyTo(HistoryReply *reply, MsgId to);
void requestFullPeer(PeerData *peer); void requestFullPeer(PeerData *peer);
void requestPeer(PeerData *peer);
void requestWebPageDelayed(WebPageData *page); void requestWebPageDelayed(WebPageData *page);
void clearWebPageRequest(WebPageData *page); void clearWebPageRequest(WebPageData *page);
@ -65,9 +66,14 @@ private:
void gotChatFull(PeerData *peer, const MTPmessages_ChatFull &result); void gotChatFull(PeerData *peer, const MTPmessages_ChatFull &result);
void gotUserFull(PeerData *peer, const MTPUserFull &result); void gotUserFull(PeerData *peer, const MTPUserFull &result);
bool gotPeerFullFailed(PeerData *peer, const RPCError &err);
typedef QMap<PeerData*, mtpRequestId> PeerRequests;
PeerRequests _fullPeerRequests;
void gotChat(PeerData *peer, const MTPmessages_Chats &result);
void gotUser(PeerData *peer, const MTPVector<MTPUser> &result);
bool gotPeerFailed(PeerData *peer, const RPCError &err); bool gotPeerFailed(PeerData *peer, const RPCError &err);
typedef QMap<PeerData*, mtpRequestId> FullRequests; PeerRequests _peerRequests;
FullRequests _fullRequests;
void gotWebPages(const MTPmessages_Messages &result, mtpRequestId req); void gotWebPages(const MTPmessages_Messages &result, mtpRequestId req);
typedef QMap<WebPageData*, mtpRequestId> WebPagesPending; typedef QMap<WebPageData*, mtpRequestId> WebPagesPending;

View File

@ -37,6 +37,9 @@ namespace {
typedef QMap<PeerData*, bool> MutedPeers; typedef QMap<PeerData*, bool> MutedPeers;
MutedPeers mutedPeers; MutedPeers mutedPeers;
typedef QMap<PeerData*, bool> UpdatedPeers;
UpdatedPeers updatedPeers;
typedef QHash<PhotoId, PhotoData*> PhotosData; typedef QHash<PhotoId, PhotoData*> PhotosData;
PhotosData photosData; PhotosData photosData;
@ -330,7 +333,7 @@ namespace App {
return (online > now); return (online > now);
} }
UserData *feedUsers(const MTPVector<MTPUser> &users) { UserData *feedUsers(const MTPVector<MTPUser> &users, bool emitPeerUpdated) {
UserData *data = 0; UserData *data = 0;
const QVector<MTPUser> &v(users.c_vector().v); const QVector<MTPUser> &v(users.c_vector().v);
for (QVector<MTPUser>::const_iterator i = v.cbegin(), e = v.cend(); i != e; ++i) { for (QVector<MTPUser>::const_iterator i = v.cbegin(), e = v.cend(); i != e; ++i) {
@ -428,19 +431,25 @@ namespace App {
if (data->contact < 0 && !data->phone.isEmpty() && int32(data->id & 0xFFFFFFFF) != MTP::authedId()) { if (data->contact < 0 && !data->phone.isEmpty() && int32(data->id & 0xFFFFFFFF) != MTP::authedId()) {
data->contact = 0; data->contact = 0;
} }
if (data->contact > 0 && !wasContact) { if (App::main()) {
App::main()->addNewContact(data->id & 0xFFFFFFFF, false); if (data->contact > 0 && !wasContact) {
} else if (wasContact && data->contact <= 0) { App::main()->addNewContact(data->id & 0xFFFFFFFF, false);
App::main()->removeContact(data); } else if (wasContact && data->contact <= 0) {
} App::main()->removeContact(data);
}
if (App::main()) App::main()->peerUpdated(data); if (emitPeerUpdated) {
App::main()->peerUpdated(data);
} else {
markPeerUpdated(data);
}
}
} }
return data; return data;
} }
ChatData *feedChats(const MTPVector<MTPChat> &chats) { ChatData *feedChats(const MTPVector<MTPChat> &chats, bool emitPeerUpdated) {
ChatData *data = 0; ChatData *data = 0;
const QVector<MTPChat> &v(chats.c_vector().v); const QVector<MTPChat> &v(chats.c_vector().v);
for (QVector<MTPChat>::const_iterator i = v.cbegin(), e = v.cend(); i != e; ++i) { for (QVector<MTPChat>::const_iterator i = v.cbegin(), e = v.cend(); i != e; ++i) {
@ -507,24 +516,31 @@ namespace App {
data->loaded = true; data->loaded = true;
data->updateName(title.trimmed(), QString(), QString()); data->updateName(title.trimmed(), QString(), QString());
if (App::main()) App::main()->peerUpdated(data); if (App::main()) {
if (emitPeerUpdated) {
App::main()->peerUpdated(data);
} else {
markPeerUpdated(data);
}
}
} }
return data; return data;
} }
void feedParticipants(const MTPChatParticipants &p, bool requestBotInfos) { void feedParticipants(const MTPChatParticipants &p, bool requestBotInfos, bool emitPeerUpdated) {
ChatData *chat = 0;
switch (p.type()) { switch (p.type()) {
case mtpc_chatParticipantsForbidden: { case mtpc_chatParticipantsForbidden: {
const MTPDchatParticipantsForbidden &d(p.c_chatParticipantsForbidden()); const MTPDchatParticipantsForbidden &d(p.c_chatParticipantsForbidden());
ChatData *chat = App::chat(d.vchat_id.v); chat = App::chat(d.vchat_id.v);
chat->count = -1; chat->count = -1;
if (App::main()) App::main()->peerUpdated(chat);
} break; } break;
case mtpc_chatParticipants: { case mtpc_chatParticipants: {
const MTPDchatParticipants &d(p.c_chatParticipants()); const MTPDchatParticipants &d(p.c_chatParticipants());
ChatData *chat = App::chat(d.vchat_id.v); chat = App::chat(d.vchat_id.v);
chat->admin = d.vadmin_id.v; chat->admin = d.vadmin_id.v;
if (chat->version <= d.vversion.v) { if (!requestBotInfos || chat->version <= d.vversion.v) { // !requestBotInfos is true on getFullChat result
chat->version = d.vversion.v; chat->version = d.vversion.v;
const QVector<MTPChatParticipant> &v(d.vparticipants.c_vector().v); const QVector<MTPChatParticipant> &v(d.vparticipants.c_vector().v);
chat->count = v.size(); chat->count = v.size();
@ -568,13 +584,19 @@ namespace App {
if (App::main()) App::main()->updateBotKeyboard(); if (App::main()) App::main()->updateBotKeyboard();
} }
} }
if (App::main()) App::main()->peerUpdated(chat);
} }
} break; } break;
} }
if (chat && App::main()) {
if (emitPeerUpdated) {
App::main()->peerUpdated(chat);
} else {
markPeerUpdated(chat);
}
}
} }
void feedParticipantAdd(const MTPDupdateChatParticipantAdd &d) { void feedParticipantAdd(const MTPDupdateChatParticipantAdd &d, bool emitPeerUpdated) {
ChatData *chat = App::chat(d.vchat_id.v); ChatData *chat = App::chat(d.vchat_id.v);
if (chat->version <= d.vversion.v && chat->count >= 0) { if (chat->version <= d.vversion.v && chat->count >= 0) {
chat->version = d.vversion.v; chat->version = d.vversion.v;
@ -601,11 +623,17 @@ namespace App {
chat->botStatus = 0; chat->botStatus = 0;
chat->count++; chat->count++;
} }
if (App::main()) App::main()->peerUpdated(chat); if (App::main()) {
if (emitPeerUpdated) {
App::main()->peerUpdated(chat);
} else {
markPeerUpdated(chat);
}
}
} }
} }
void feedParticipantDelete(const MTPDupdateChatParticipantDelete &d) { void feedParticipantDelete(const MTPDupdateChatParticipantDelete &d, bool emitPeerUpdated) {
ChatData *chat = App::chat(d.vchat_id.v); ChatData *chat = App::chat(d.vchat_id.v);
if (chat->version <= d.vversion.v && chat->count > 0) { if (chat->version <= d.vversion.v && chat->count > 0) {
chat->version = d.vversion.v; chat->version = d.vversion.v;
@ -645,7 +673,13 @@ namespace App {
chat->botStatus = 0; chat->botStatus = 0;
chat->count--; chat->count--;
} }
if (App::main()) App::main()->peerUpdated(chat); if (App::main()) {
if (emitPeerUpdated) {
App::main()->peerUpdated(chat);
} else {
markPeerUpdated(chat);
}
}
} }
} }
@ -764,23 +798,30 @@ namespace App {
} }
} }
void feedUserLinks(const MTPVector<MTPcontacts_Link> &links) { void feedUserLinks(const MTPVector<MTPcontacts_Link> &links, bool emitPeerUpdated) {
const QVector<MTPcontacts_Link> &v(links.c_vector().v); const QVector<MTPcontacts_Link> &v(links.c_vector().v);
for (QVector<MTPcontacts_Link>::const_iterator i = v.cbegin(), e = v.cend(); i != e; ++i) { for (QVector<MTPcontacts_Link>::const_iterator i = v.cbegin(), e = v.cend(); i != e; ++i) {
const MTPDcontacts_link &dv(i->c_contacts_link()); const MTPDcontacts_link &dv(i->c_contacts_link());
feedUsers(MTP_vector<MTPUser>(1, dv.vuser)); UserData *user = feedUsers(MTP_vector<MTPUser>(1, dv.vuser), false);
MTPint userId(MTP_int(0)); MTPint userId(MTP_int(0));
switch (dv.vuser.type()) { switch (dv.vuser.type()) {
case mtpc_userEmpty: userId = dv.vuser.c_userEmpty().vid; break; case mtpc_userEmpty: userId = dv.vuser.c_userEmpty().vid; break;
case mtpc_user: userId = dv.vuser.c_user().vid; break; case mtpc_user: userId = dv.vuser.c_user().vid; break;
} }
if (userId.v) { if (userId.v) {
feedUserLink(userId, dv.vmy_link, dv.vforeign_link); feedUserLink(userId, dv.vmy_link, dv.vforeign_link, false);
}
if (user && App::main()) {
if (emitPeerUpdated) {
App::main()->peerUpdated(user);
} else {
markPeerUpdated(user);
}
} }
} }
} }
void feedUserLink(MTPint userId, const MTPContactLink &myLink, const MTPContactLink &foreignLink) { void feedUserLink(MTPint userId, const MTPContactLink &myLink, const MTPContactLink &foreignLink, bool emitPeerUpdated) {
UserData *user = userLoaded(userId.v); UserData *user = userLoaded(userId.v);
if (user) { if (user) {
bool wasContact = (user->contact > 0); bool wasContact = (user->contact > 0);
@ -815,7 +856,32 @@ namespace App {
} }
} }
user->setName(textOneLine(user->firstName), textOneLine(user->lastName), (user->contact || isServiceUser(user->id) || user->phone.isEmpty()) ? QString() : App::formatPhone(user->phone), textOneLine(user->username)); user->setName(textOneLine(user->firstName), textOneLine(user->lastName), (user->contact || isServiceUser(user->id) || user->phone.isEmpty()) ? QString() : App::formatPhone(user->phone), textOneLine(user->username));
if (App::main()) App::main()->peerUpdated(user); if (App::main()) {
if (emitPeerUpdated) {
App::main()->peerUpdated(user);
} else {
markPeerUpdated(user);
}
}
}
}
void markPeerUpdated(PeerData *data) {
updatedPeers.insert(data, true);
}
void clearPeerUpdated(PeerData *data) {
updatedPeers.remove(data);
}
void emitPeerUpdated() {
if (!updatedPeers.isEmpty() && App::main()) {
UpdatedPeers upd = updatedPeers;
updatedPeers.clear();
for (UpdatedPeers::const_iterator i = upd.cbegin(), e = upd.cend(); i != e; ++i) {
App::main()->peerUpdated(i.key());
}
} }
} }
@ -1553,6 +1619,7 @@ namespace App {
historyClearMsgs(); historyClearMsgs();
randomData.clear(); randomData.clear();
mutedPeers.clear(); mutedPeers.clear();
updatedPeers.clear();
for (PeersData::const_iterator i = peersData.cbegin(), e = peersData.cend(); i != e; ++i) { for (PeersData::const_iterator i = peersData.cbegin(), e = peersData.cend(); i != e; ++i) {
delete *i; delete *i;
} }

View File

@ -107,18 +107,23 @@ namespace App {
QString onlineText(UserData *user, int32 nowOnServer, bool precise = false); QString onlineText(UserData *user, int32 nowOnServer, bool precise = false);
bool onlineColorUse(UserData *user, int32 now); bool onlineColorUse(UserData *user, int32 now);
UserData *feedUsers(const MTPVector<MTPUser> &users); // returns last user UserData *feedUsers(const MTPVector<MTPUser> &users, bool emitPeerUpdated = true); // returns last user
ChatData *feedChats(const MTPVector<MTPChat> &chats); // returns last chat ChatData *feedChats(const MTPVector<MTPChat> &chats, bool emitPeerUpdated = true); // returns last chat
void feedParticipants(const MTPChatParticipants &p, bool requestBotInfos = false); void feedParticipants(const MTPChatParticipants &p, bool requestBotInfos, bool emitPeerUpdated = true);
void feedParticipantAdd(const MTPDupdateChatParticipantAdd &d); void feedParticipantAdd(const MTPDupdateChatParticipantAdd &d, bool emitPeerUpdated = true);
void feedParticipantDelete(const MTPDupdateChatParticipantDelete &d); void feedParticipantDelete(const MTPDupdateChatParticipantDelete &d, bool emitPeerUpdated = true);
void feedMsgs(const MTPVector<MTPMessage> &msgs, int msgsState = 0); // 2 - new read message, 1 - new unread message, 0 - not new message, -1 - searched message void feedMsgs(const MTPVector<MTPMessage> &msgs, int msgsState = 0); // 2 - new read message, 1 - new unread message, 0 - not new message, -1 - searched message
void feedWereRead(const QVector<MTPint> &msgsIds); void feedWereRead(const QVector<MTPint> &msgsIds);
void feedInboxRead(const PeerId &peer, int32 upTo); void feedInboxRead(const PeerId &peer, int32 upTo);
void feedOutboxRead(const PeerId &peer, int32 upTo); void feedOutboxRead(const PeerId &peer, int32 upTo);
void feedWereDeleted(const QVector<MTPint> &msgsIds); void feedWereDeleted(const QVector<MTPint> &msgsIds);
void feedUserLinks(const MTPVector<MTPcontacts_Link> &links); void feedUserLinks(const MTPVector<MTPcontacts_Link> &links, bool emitPeerUpdated = true);
void feedUserLink(MTPint userId, const MTPContactLink &myLink, const MTPContactLink &foreignLink); void feedUserLink(MTPint userId, const MTPContactLink &myLink, const MTPContactLink &foreignLink, bool emitPeerUpdated = true);
void markPeerUpdated(PeerData *data);
void clearPeerUpdated(PeerData *data);
void emitPeerUpdated();
int32 maxMsgId(); int32 maxMsgId();
ImagePtr image(const MTPPhotoSize &size); ImagePtr image(const MTPPhotoSize &size);

View File

@ -640,8 +640,8 @@ void Application::checkMapVersion() {
psRegisterCustomScheme(); psRegisterCustomScheme();
if (Local::oldMapVersion()) { if (Local::oldMapVersion()) {
QString versionFeatures; QString versionFeatures;
if (DevChannel && Local::oldMapVersion() < 8034) { if (DevChannel && Local::oldMapVersion() < 8035) {
versionFeatures = QString::fromUtf8("\xe2\x80\x94 Forward photos, media and stickers with drag-n-drop\n\xe2\x80\x94 Drag-n-drop text messages by timestamp to forward them\n\xe2\x80\x94 Larger stickers panel");// .replace('@', qsl("@") + QChar(0x200D)); versionFeatures = lang(lng_new_version_minor);// QString::fromUtf8("\xe2\x80\x94 Forward photos, media and stickers with drag-n-drop\n\xe2\x80\x94 Drag-n-drop text messages by timestamp to forward them\n\xe2\x80\x94 Larger stickers panel");// .replace('@', qsl("@") + QChar(0x200D));
} else if (!DevChannel && Local::oldMapVersion() < 8030) { } else if (!DevChannel && Local::oldMapVersion() < 8030) {
versionFeatures = lang(lng_new_version_text).trimmed(); versionFeatures = lang(lng_new_version_text).trimmed();
} }

View File

@ -17,8 +17,8 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once
static const int32 AppVersion = 8034; static const int32 AppVersion = 8035;
static const wchar_t *AppVersionStr = L"0.8.34"; static const wchar_t *AppVersionStr = L"0.8.35";
static const bool DevChannel = true; static const bool DevChannel = true;
static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)"; static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)";

View File

@ -5093,7 +5093,6 @@ void HistoryWidget::onCancel() {
} }
void HistoryWidget::onFullPeerUpdated(PeerData *data) { void HistoryWidget::onFullPeerUpdated(PeerData *data) {
peerUpdated(data);
if (_list && data == histPeer) { if (_list && data == histPeer) {
checkMentionDropdown(); checkMentionDropdown();
_list->updateBotInfo(); _list->updateBotInfo();

View File

@ -369,6 +369,7 @@ _failDifferenceTimeout(1), _lastUpdateTime(0), _cachedX(0), _cachedY(0), _backgr
connect(&_bySeqTimer, SIGNAL(timeout()), this, SLOT(getDifference())); connect(&_bySeqTimer, SIGNAL(timeout()), this, SLOT(getDifference()));
connect(&_byPtsTimer, SIGNAL(timeout()), this, SLOT(getDifference())); connect(&_byPtsTimer, SIGNAL(timeout()), this, SLOT(getDifference()));
connect(&_failDifferenceTimer, SIGNAL(timeout()), this, SLOT(getDifferenceForce())); connect(&_failDifferenceTimer, SIGNAL(timeout()), this, SLOT(getDifferenceForce()));
connect(_api, SIGNAL(fullPeerUpdated(PeerData*)), this, SIGNAL(peerUpdated(PeerData*)));
connect(this, SIGNAL(peerUpdated(PeerData*)), &history, SLOT(peerUpdated(PeerData*))); connect(this, SIGNAL(peerUpdated(PeerData*)), &history, SLOT(peerUpdated(PeerData*)));
connect(&_topBar, SIGNAL(clicked()), this, SLOT(onTopBarClick())); connect(&_topBar, SIGNAL(clicked()), this, SLOT(onTopBarClick()));
connect(&history, SIGNAL(peerShown(PeerData*)), this, SLOT(onPeerShown(PeerData*))); connect(&history, SIGNAL(peerShown(PeerData*)), this, SLOT(onPeerShown(PeerData*)));
@ -763,14 +764,16 @@ void MainWidget::deleteMessages(const QVector<MTPint> &ids) {
void MainWidget::deletedContact(UserData *user, const MTPcontacts_Link &result) { void MainWidget::deletedContact(UserData *user, const MTPcontacts_Link &result) {
const MTPDcontacts_link &d(result.c_contacts_link()); const MTPDcontacts_link &d(result.c_contacts_link());
App::feedUsers(MTP_vector<MTPUser>(1, d.vuser)); App::feedUsers(MTP_vector<MTPUser>(1, d.vuser), false);
App::feedUserLink(MTP_int(user->id & 0xFFFFFFFF), d.vmy_link, d.vforeign_link); App::feedUserLink(MTP_int(user->id & 0xFFFFFFFF), d.vmy_link, d.vforeign_link, false);
App::emitPeerUpdated();
} }
void MainWidget::deleteHistoryAndContact(UserData *user, const MTPcontacts_Link &result) { void MainWidget::deleteHistoryAndContact(UserData *user, const MTPcontacts_Link &result) {
const MTPDcontacts_link &d(result.c_contacts_link()); const MTPDcontacts_link &d(result.c_contacts_link());
App::feedUsers(MTP_vector<MTPUser>(1, d.vuser)); App::feedUsers(MTP_vector<MTPUser>(1, d.vuser), false);
App::feedUserLink(MTP_int(user->id & 0xFFFFFFFF), d.vmy_link, d.vforeign_link); App::feedUserLink(MTP_int(user->id & 0xFFFFFFFF), d.vmy_link, d.vforeign_link, false);
App::emitPeerUpdated();
if ((profile && profile->peer() == user) || (overview && overview->peer() == user) || _stack.contains(user) || history.peer() == user) { if ((profile && profile->peer() == user) || (overview && overview->peer() == user) || _stack.contains(user) || history.peer() == user) {
showPeer(0); showPeer(0);
@ -834,13 +837,13 @@ void MainWidget::checkedHistory(PeerData *peer, const MTPmessages_Messages &resu
const QVector<MTPMessage> *v = 0; const QVector<MTPMessage> *v = 0;
if (result.type() == mtpc_messages_messages) { if (result.type() == mtpc_messages_messages) {
const MTPDmessages_messages &d(result.c_messages_messages()); const MTPDmessages_messages &d(result.c_messages_messages());
App::feedChats(d.vchats);
App::feedUsers(d.vusers); App::feedUsers(d.vusers);
App::feedChats(d.vchats);
v = &d.vmessages.c_vector().v; v = &d.vmessages.c_vector().v;
} else if (result.type() == mtpc_messages_messagesSlice) { } else if (result.type() == mtpc_messages_messagesSlice) {
const MTPDmessages_messagesSlice &d(result.c_messages_messagesSlice()); const MTPDmessages_messagesSlice &d(result.c_messages_messagesSlice());
App::feedChats(d.vchats);
App::feedUsers(d.vusers); App::feedUsers(d.vusers);
App::feedChats(d.vchats);
v = &d.vmessages.c_vector().v; v = &d.vmessages.c_vector().v;
} }
if (!v) return; if (!v) return;
@ -2090,6 +2093,7 @@ void MainWidget::sentDataReceived(uint64 randomId, const MTPmessages_SentMessage
void MainWidget::sentUpdatesReceived(const MTPUpdates &result) { void MainWidget::sentUpdatesReceived(const MTPUpdates &result) {
handleUpdates(result); handleUpdates(result);
App::emitPeerUpdated();
} }
void MainWidget::msgUpdated(PeerId peer, const HistoryItem *msg) { void MainWidget::msgUpdated(PeerId peer, const HistoryItem *msg) {
@ -2417,6 +2421,8 @@ void MainWidget::gotState(const MTPupdates_State &state) {
dialogs.loadDialogs(); dialogs.loadDialogs();
updateOnline(); updateOnline();
App::emitPeerUpdated();
} }
void MainWidget::gotDifference(const MTPupdates_Difference &diff) { void MainWidget::gotDifference(const MTPupdates_Difference &diff) {
@ -2432,6 +2438,8 @@ void MainWidget::gotDifference(const MTPupdates_Difference &diff) {
noUpdatesTimer.start(NoUpdatesTimeout); noUpdatesTimer.start(NoUpdatesTimeout);
updInited = true; updInited = true;
App::emitPeerUpdated();
} break; } break;
case mtpc_updates_differenceSlice: { case mtpc_updates_differenceSlice: {
const MTPDupdates_differenceSlice &d(diff.c_updates_differenceSlice()); const MTPDupdates_differenceSlice &d(diff.c_updates_differenceSlice());
@ -2444,6 +2452,8 @@ void MainWidget::gotDifference(const MTPupdates_Difference &diff) {
MTP_LOG(0, ("getDifference { good - after a slice of difference was received }%1").arg(cTestMode() ? " TESTMODE" : "")); MTP_LOG(0, ("getDifference { good - after a slice of difference was received }%1").arg(cTestMode() ? " TESTMODE" : ""));
getDifference(); getDifference();
App::emitPeerUpdated();
} break; } break;
case mtpc_updates_difference: { case mtpc_updates_difference: {
const MTPDupdates_difference &d(diff.c_updates_difference()); const MTPDupdates_difference &d(diff.c_updates_difference());
@ -2471,6 +2481,7 @@ void MainWidget::applySkippedPtsUpdates() {
} }
--updSkipPtsUpdateLevel; --updSkipPtsUpdateLevel;
clearSkippedPtsUpdates(); clearSkippedPtsUpdates();
App::emitPeerUpdated();
} }
void MainWidget::clearSkippedPtsUpdates() { void MainWidget::clearSkippedPtsUpdates() {
@ -2500,8 +2511,8 @@ bool MainWidget::updPtsUpdated(int pts, int ptsCount) { // return false if need
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::feedUsers(users); App::feedUsers(users, false);
App::feedChats(chats); App::feedChats(chats, false);
feedMessageIds(other); feedMessageIds(other);
App::feedMsgs(msgs, 1); App::feedMsgs(msgs, 1);
feedUpdates(other, true); feedUpdates(other, true);
@ -3079,7 +3090,8 @@ void MainWidget::updateReceived(const mtpPrime *from, const mtpPrime *end) {
noUpdatesTimer.start(NoUpdatesTimeout); noUpdatesTimer.start(NoUpdatesTimeout);
handleUpdates(updates); handleUpdates(updates);
} catch(mtpErrorUnexpected &e) { // just some other type App::emitPeerUpdated();
} catch (mtpErrorUnexpected &e) { // just some other type
} }
} }
update(); update();
@ -3097,8 +3109,8 @@ void MainWidget::handleUpdates(const MTPUpdates &updates) {
} }
} }
App::feedChats(d.vchats); App::feedUsers(d.vusers, false);
App::feedUsers(d.vusers); App::feedChats(d.vchats, false);
feedUpdates(d.vupdates); feedUpdates(d.vupdates);
updSetState(0, d.vdate.v, updQts, d.vseq.v); updSetState(0, d.vdate.v, updQts, d.vseq.v);
@ -3114,8 +3126,8 @@ void MainWidget::handleUpdates(const MTPUpdates &updates) {
} }
} }
App::feedChats(d.vchats); App::feedUsers(d.vusers, false);
App::feedUsers(d.vusers); App::feedChats(d.vchats, false);
feedUpdates(d.vupdates); feedUpdates(d.vupdates);
updSetState(0, d.vdate.v, updQts, d.vseq.v); updSetState(0, d.vdate.v, updQts, d.vseq.v);
@ -3308,17 +3320,17 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
case mtpc_updateChatParticipants: { case mtpc_updateChatParticipants: {
const MTPDupdateChatParticipants &d(update.c_updateChatParticipants()); const MTPDupdateChatParticipants &d(update.c_updateChatParticipants());
App::feedParticipants(d.vparticipants, true); App::feedParticipants(d.vparticipants, true, false);
} break; } break;
case mtpc_updateChatParticipantAdd: { case mtpc_updateChatParticipantAdd: {
const MTPDupdateChatParticipantAdd &d(update.c_updateChatParticipantAdd()); const MTPDupdateChatParticipantAdd &d(update.c_updateChatParticipantAdd());
App::feedParticipantAdd(d); App::feedParticipantAdd(d, false);
} break; } break;
case mtpc_updateChatParticipantDelete: { case mtpc_updateChatParticipantDelete: {
const MTPDupdateChatParticipantDelete &d(update.c_updateChatParticipantDelete()); const MTPDupdateChatParticipantDelete &d(update.c_updateChatParticipantDelete());
App::feedParticipantDelete(d); App::feedParticipantDelete(d, false);
} break; } break;
case mtpc_updateUserStatus: { case mtpc_updateUserStatus: {
@ -3337,7 +3349,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
case mtpc_userStatusOffline: user->onlineTill = d.vstatus.c_userStatusOffline().vwas_online.v; break; case mtpc_userStatusOffline: user->onlineTill = d.vstatus.c_userStatusOffline().vwas_online.v; break;
case mtpc_userStatusOnline: user->onlineTill = d.vstatus.c_userStatusOnline().vexpires.v; break; case mtpc_userStatusOnline: user->onlineTill = d.vstatus.c_userStatusOnline().vexpires.v; break;
} }
if (App::main()) App::main()->peerUpdated(user); App::markPeerUpdated(user);
} }
if (d.vuser_id.v == MTP::authedId()) { if (d.vuser_id.v == MTP::authedId()) {
if (d.vstatus.type() == mtpc_userStatusOffline || d.vstatus.type() == mtpc_userStatusEmpty) { if (d.vstatus.type() == mtpc_userStatusOffline || d.vstatus.type() == mtpc_userStatusEmpty) {
@ -3360,7 +3372,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
} else { } else {
user->setName(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)));
} }
if (App::main()) App::main()->peerUpdated(user); App::markPeerUpdated(user);
} }
} break; } break;
@ -3374,7 +3386,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
user->photosCount = -1; user->photosCount = -1;
user->photos.clear(); user->photos.clear();
} else { } else {
if (user->photoId) { if (user->photoId && user->photoId != UnknownPeerPhotoId) {
if (user->photosCount > 0) ++user->photosCount; if (user->photosCount > 0) ++user->photosCount;
user->photos.push_front(App::photo(user->photoId)); user->photos.push_front(App::photo(user->photoId));
} else { } else {
@ -3382,7 +3394,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
user->photos.clear(); user->photos.clear();
} }
} }
if (App::main()) App::main()->peerUpdated(user); App::markPeerUpdated(user);
if (App::wnd()) App::wnd()->mediaOverviewUpdated(user); if (App::wnd()) App::wnd()->mediaOverviewUpdated(user);
} }
} break; } break;
@ -3399,7 +3411,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
case mtpc_updateContactLink: { case mtpc_updateContactLink: {
const MTPDupdateContactLink &d(update.c_updateContactLink()); const MTPDupdateContactLink &d(update.c_updateContactLink());
App::feedUserLink(d.vuser_id, d.vmy_link, d.vforeign_link); App::feedUserLink(d.vuser_id, d.vmy_link, d.vforeign_link, false);
} break; } break;
case mtpc_updateNotifySettings: { case mtpc_updateNotifySettings: {
@ -3418,7 +3430,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
if (user) { if (user) {
user->setPhone(qs(d.vphone)); user->setPhone(qs(d.vphone));
user->setName(user->firstName, user->lastName, (user->contact || isServiceUser(user->id) || user->phone.isEmpty()) ? QString() : App::formatPhone(user->phone), user->username); user->setName(user->firstName, user->lastName, (user->contact || isServiceUser(user->id) || user->phone.isEmpty()) ? QString() : App::formatPhone(user->phone), user->username);
if (App::main()) App::main()->peerUpdated(user); App::markPeerUpdated(user);
} }
} break; } break;

View File

@ -682,7 +682,7 @@ void MediaView::showPhoto(PhotoData *photo, PeerData *context) {
_photo = photo; _photo = photo;
_overview = OverviewCount; _overview = OverviewCount;
if (_user) { if (_user) {
if (_user->photos.isEmpty() && _user->photosCount < 0 && _user->photoId) { if (_user->photos.isEmpty() && _user->photosCount < 0 && _user->photoId && _user->photoId != UnknownPeerPhotoId) {
_index = 0; _index = 0;
} }
for (int i = 0, l = _user->photos.size(); i < l; ++i) { for (int i = 0, l = _user->photos.size(); i < l; ++i) {

View File

@ -77,14 +77,21 @@ ProfileInner::ProfileInner(ProfileWidget *profile, ScrollArea *scroll, const Pee
if (_peerUser) { if (_peerUser) {
_phoneText = _peerUser->phone.isEmpty() ? QString() : App::formatPhone(_peerUser->phone); _phoneText = _peerUser->phone.isEmpty() ? QString() : App::formatPhone(_peerUser->phone);
App::api()->requestFullPeer(_peer); PhotoData *userPhoto = (_peerUser->photoId && _peerUser->photoId != UnknownPeerPhotoId) ? App::photo(_peerUser->photoId) : 0;
} else if (_peerChat->photoId) { if (userPhoto && userPhoto->date) {
PhotoData *ph = App::photo(_peerChat->photoId); _photoLink = TextLinkPtr(new PhotoLink(userPhoto, _peer));
if (ph->date) { }
_photoLink = TextLinkPtr(new PhotoLink(ph, _peer)); if ((_peerUser->botInfo && !_peerUser->botInfo->inited) || (_peerUser->photoId == UnknownPeerPhotoId) || (_peerUser->photoId && !userPhoto->date)) {
App::api()->requestFullPeer(_peer);
} }
} else { } else {
App::api()->requestFullPeer(_peer); PhotoData *chatPhoto = (_peerChat->photoId && _peerChat->photoId != UnknownPeerPhotoId) ? App::photo(_peerChat->photoId) : 0;
if (chatPhoto && chatPhoto->date) {
_photoLink = TextLinkPtr(new PhotoLink(chatPhoto, _peer));
}
if (_peerChat->photoId == UnknownPeerPhotoId) {
App::api()->requestFullPeer(_peer);
}
} }
// profile // profile
@ -325,7 +332,7 @@ void ProfileInner::chatInviteDone(const MTPExportedChatInvite &result) {
void ProfileInner::onFullPeerUpdated(PeerData *peer) { void ProfileInner::onFullPeerUpdated(PeerData *peer) {
if (peer != _peer) return; if (peer != _peer) return;
if (_peerUser) { if (_peerUser) {
PhotoData *userPhoto = _peerUser->photoId ? App::photo(_peerUser->photoId) : 0; PhotoData *userPhoto = (_peerUser->photoId && _peerUser->photoId != UnknownPeerPhotoId) ? App::photo(_peerUser->photoId) : 0;
if (userPhoto && userPhoto->date) { if (userPhoto && userPhoto->date) {
_photoLink = TextLinkPtr(new PhotoLink(userPhoto, _peer)); _photoLink = TextLinkPtr(new PhotoLink(userPhoto, _peer));
} else { } else {
@ -376,9 +383,9 @@ void ProfileInner::peerUpdated(PeerData *data) {
PhotoData *photo = 0; PhotoData *photo = 0;
if (_peerUser) { if (_peerUser) {
_phoneText = _peerUser->phone.isEmpty() ? QString() : App::formatPhone(_peerUser->phone); _phoneText = _peerUser->phone.isEmpty() ? QString() : App::formatPhone(_peerUser->phone);
if (_peerUser->photoId) photo = App::photo(_peerUser->photoId); if (_peerUser->photoId && _peerUser->photoId != UnknownPeerPhotoId) photo = App::photo(_peerUser->photoId);
} else { } else {
if (_peerChat->photoId) photo = App::photo(_peerChat->photoId); if (_peerChat->photoId && _peerChat->photoId != UnknownPeerPhotoId) photo = App::photo(_peerChat->photoId);
} }
_photoLink = (photo && photo->date) ? TextLinkPtr(new PhotoLink(photo, _peer)) : TextLinkPtr(); _photoLink = (photo && photo->date) ? TextLinkPtr(new PhotoLink(photo, _peer)) : TextLinkPtr();
if (_peer->name != _nameCache) { if (_peer->name != _nameCache) {

View File

@ -190,7 +190,7 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : QWidget(parent),
{ {
if (self()) { if (self()) {
_nameText.setText(st::setNameFont, _nameCache, _textNameOptions); _nameText.setText(st::setNameFont, _nameCache, _textNameOptions);
PhotoData *selfPhoto = self()->photoId ? App::photo(self()->photoId) : 0; PhotoData *selfPhoto = (self()->photoId && self()->photoId != UnknownPeerPhotoId) ? App::photo(self()->photoId) : 0;
if (selfPhoto && selfPhoto->date) _photoLink = TextLinkPtr(new PhotoLink(selfPhoto, self())); if (selfPhoto && selfPhoto->date) _photoLink = TextLinkPtr(new PhotoLink(selfPhoto, self()));
MTP::send(MTPusers_GetFullUser(self()->inputUser), rpcDone(&SettingsInner::gotFullSelf), RPCFailHandlerPtr(), 0, 10); MTP::send(MTPusers_GetFullUser(self()->inputUser), rpcDone(&SettingsInner::gotFullSelf), RPCFailHandlerPtr(), 0, 10);
onReloadPassword(); onReloadPassword();
@ -312,7 +312,7 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : QWidget(parent),
void SettingsInner::peerUpdated(PeerData *data) { void SettingsInner::peerUpdated(PeerData *data) {
if (self() && data == self()) { if (self() && data == self()) {
if (self()->photoId) { if (self()->photoId && self()->photoId != UnknownPeerPhotoId) {
PhotoData *selfPhoto = App::photo(self()->photoId); PhotoData *selfPhoto = App::photo(self()->photoId);
if (selfPhoto->date) { if (selfPhoto->date) {
_photoLink = TextLinkPtr(new PhotoLink(selfPhoto, self())); _photoLink = TextLinkPtr(new PhotoLink(selfPhoto, self()));
@ -851,7 +851,7 @@ void SettingsInner::gotFullSelf(const MTPUserFull &selfFull) {
if (!self()) return; if (!self()) return;
App::feedPhoto(selfFull.c_userFull().vprofile_photo); App::feedPhoto(selfFull.c_userFull().vprofile_photo);
App::feedUsers(MTP_vector<MTPUser>(1, selfFull.c_userFull().vuser)); App::feedUsers(MTP_vector<MTPUser>(1, selfFull.c_userFull().vuser));
PhotoData *selfPhoto = self()->photoId ? App::photo(self()->photoId) : 0; PhotoData *selfPhoto = (self()->photoId && self()->photoId != UnknownPeerPhotoId) ? App::photo(self()->photoId) : 0;
if (selfPhoto && selfPhoto->date) { if (selfPhoto && selfPhoto->date) {
_photoLink = TextLinkPtr(new PhotoLink(selfPhoto, self())); _photoLink = TextLinkPtr(new PhotoLink(selfPhoto, self()));
} else { } else {

View File

@ -133,23 +133,31 @@ void PeerData::updateName(const QString &newName, const QString &newNameOrPhone,
} }
void UserData::setPhoto(const MTPUserProfilePhoto &p) { void UserData::setPhoto(const MTPUserProfilePhoto &p) {
PhotoId newPhotoId = photoId;
ImagePtr newPhoto = photo;
switch (p.type()) { switch (p.type()) {
case mtpc_userProfilePhoto: { case mtpc_userProfilePhoto: {
const MTPDuserProfilePhoto d(p.c_userProfilePhoto()); const MTPDuserProfilePhoto d(p.c_userProfilePhoto());
photoId = d.vphoto_id.v; newPhotoId = d.vphoto_id.v;
photo = ImagePtr(160, 160, d.vphoto_small, userDefPhoto(colorIndex)); newPhoto = ImagePtr(160, 160, d.vphoto_small, userDefPhoto(colorIndex));
// App::feedPhoto(App::photoFromUserPhoto(MTP_int(id & 0xFFFFFFFF), MTP_int(unixtime()), p)); //App::feedPhoto(App::photoFromUserPhoto(MTP_int(id & 0xFFFFFFFF), MTP_int(unixtime()), p));
} break; } break;
default: { default: {
photoId = 0; newPhotoId = 0;
if (id == ServiceUserId) { if (id == ServiceUserId) {
photo = ImagePtr(QPixmap::fromImage(App::wnd()->iconLarge().scaledToWidth(160, Qt::SmoothTransformation), Qt::ColorOnly), "PNG"); if (photo->isNull()) {
newPhoto = ImagePtr(QPixmap::fromImage(App::wnd()->iconLarge().scaledToWidth(160, Qt::SmoothTransformation), Qt::ColorOnly), "PNG");
}
} else { } else {
photo = userDefPhoto(colorIndex); newPhoto = userDefPhoto(colorIndex);
} }
} break; } break;
} }
emit App::main()->peerPhotoChanged(this); if (newPhotoId != photoId || newPhoto.v() != photo.v()) {
photoId = newPhotoId;
photo = newPhoto;
emit App::main()->peerPhotoChanged(this);
}
} }
void PeerData::fillNames() { void PeerData::fillNames() {
@ -262,10 +270,10 @@ void UserData::madeAction() {
int32 t = unixtime(); int32 t = unixtime();
if (onlineTill <= 0 && -onlineTill < t) { if (onlineTill <= 0 && -onlineTill < t) {
onlineTill = -t - SetOnlineAfterActivity; onlineTill = -t - SetOnlineAfterActivity;
if (App::main()) App::main()->peerUpdated(this); App::markPeerUpdated(this);
} else if (onlineTill > 0 && onlineTill < t + 1) { } else if (onlineTill > 0 && onlineTill < t + 1) {
onlineTill = t + SetOnlineAfterActivity; onlineTill = t + SetOnlineAfterActivity;
if (App::main()) App::main()->peerUpdated(this); App::markPeerUpdated(this);
} }
} }
@ -275,7 +283,7 @@ void ChatData::setPhoto(const MTPChatPhoto &p, const PhotoId &phId) {
const MTPDchatPhoto d(p.c_chatPhoto()); const MTPDchatPhoto d(p.c_chatPhoto());
photo = ImagePtr(160, 160, d.vphoto_small, chatDefPhoto(colorIndex)); photo = ImagePtr(160, 160, d.vphoto_small, chatDefPhoto(colorIndex));
photoFull = ImagePtr(640, 640, d.vphoto_big, chatDefPhoto(colorIndex)); photoFull = ImagePtr(640, 640, d.vphoto_big, chatDefPhoto(colorIndex));
if (phId) { if (phId != UnknownPeerPhotoId) {
photoId = phId; photoId = phId;
} }
} break; } break;

View File

@ -138,9 +138,11 @@ struct BotInfo {
QString startToken, startGroupToken; QString startToken, startGroupToken;
}; };
static const PhotoId UnknownPeerPhotoId = 0xFFFFFFFFFFFFFFFFULL;
struct PhotoData; struct PhotoData;
struct UserData : public PeerData { struct UserData : public PeerData {
UserData(const PeerId &id) : PeerData(id), photoId(0), lnk(new PeerLink(this)), onlineTill(0), contact(-1), photosCount(-1), botInfo(0) { UserData(const PeerId &id) : PeerData(id), photoId(UnknownPeerPhotoId), lnk(new PeerLink(this)), onlineTill(0), contact(-1), photosCount(-1), botInfo(0) {
} }
void setPhoto(const MTPUserProfilePhoto &photo); void setPhoto(const MTPUserProfilePhoto &photo);
void setName(const QString &first, const QString &last, const QString &phoneName, const QString &username); void setName(const QString &first, const QString &last, const QString &phoneName, const QString &username);
@ -169,9 +171,9 @@ struct UserData : public PeerData {
}; };
struct ChatData : public PeerData { struct ChatData : public PeerData {
ChatData(const PeerId &id) : PeerData(id), count(0), date(0), version(0), left(false), forbidden(true), botStatus(0), photoId(0) { ChatData(const PeerId &id) : PeerData(id), count(0), date(0), version(0), left(false), forbidden(true), botStatus(0), photoId(UnknownPeerPhotoId) {
} }
void setPhoto(const MTPChatPhoto &photo, const PhotoId &phId = 0); void setPhoto(const MTPChatPhoto &photo, const PhotoId &phId = UnknownPeerPhotoId);
int32 count; int32 count;
int32 date; int32 date;
int32 version; int32 version;

View File

@ -11,7 +11,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>0.8.34</string> <string>0.8.35</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string> <string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>

Binary file not shown.

View File

@ -1701,7 +1701,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0.8.34; CURRENT_PROJECT_VERSION = 0.8.35;
DEBUG_INFORMATION_FORMAT = dwarf; DEBUG_INFORMATION_FORMAT = dwarf;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_OPTIMIZATION_LEVEL = 0; GCC_OPTIMIZATION_LEVEL = 0;
@ -1719,7 +1719,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COPY_PHASE_STRIP = YES; COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 0.8.34; CURRENT_PROJECT_VERSION = 0.8.35;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_OPTIMIZATION_LEVEL = fast; GCC_OPTIMIZATION_LEVEL = fast;
GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h; GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h;
@ -1745,10 +1745,10 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0.8.34; CURRENT_PROJECT_VERSION = 0.8.35;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DYLIB_COMPATIBILITY_VERSION = 0.8; DYLIB_COMPATIBILITY_VERSION = 0.8;
DYLIB_CURRENT_VERSION = 0.8.34; DYLIB_CURRENT_VERSION = 0.8.35;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_SEARCH_PATHS = ""; FRAMEWORK_SEARCH_PATHS = "";
GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
@ -1888,10 +1888,10 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0.8.34; CURRENT_PROJECT_VERSION = 0.8.35;
DEBUG_INFORMATION_FORMAT = dwarf; DEBUG_INFORMATION_FORMAT = dwarf;
DYLIB_COMPATIBILITY_VERSION = 0.8; DYLIB_COMPATIBILITY_VERSION = 0.8;
DYLIB_CURRENT_VERSION = 0.8.34; DYLIB_CURRENT_VERSION = 0.8.35;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_SEARCH_PATHS = ""; FRAMEWORK_SEARCH_PATHS = "";
GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = YES;

View File

@ -1,2 +1,2 @@
echo 0.8 8034 0.8.34 1 echo 0.8 8035 0.8.35 1
# AppVersionStrMajor AppVersion AppVersionStr DevChannel # AppVersionStrMajor AppVersion AppVersionStr DevChannel