mirror of
https://github.com/telegramdesktop/tdesktop
synced 2024-12-15 19:04:43 +00:00
version 0.8.8.dev - audio listened status, photo caption display, map places name-address display, gray muted badges, invite links support, some fixes
This commit is contained in:
parent
aeb2ec68ef
commit
fb32c5bcd1
@ -1,10 +1,10 @@
|
||||
@echo OFF
|
||||
|
||||
set "AppVersion=8007"
|
||||
set "AppVersionStrSmall=0.8.7"
|
||||
set "AppVersionStr=0.8.7"
|
||||
set "AppVersionStrFull=0.8.7.0"
|
||||
set "DevChannel=0"
|
||||
set "AppVersion=8008"
|
||||
set "AppVersionStrSmall=0.8.8"
|
||||
set "AppVersionStr=0.8.8"
|
||||
set "AppVersionStrFull=0.8.8.0"
|
||||
set "DevChannel=1"
|
||||
|
||||
if %DevChannel% neq 0 goto preparedev
|
||||
|
||||
|
@ -382,12 +382,26 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
"lng_action_kick_user" = "{from} kicked {user}";
|
||||
"lng_action_user_left" = "{from} left the group";
|
||||
"lng_action_user_joined" = "{from} joined the group";
|
||||
"lng_action_user_joined_by_link" = "{from} joined the group via invite link";
|
||||
"lng_action_user_registered" = "{from} just joined Telegram";
|
||||
"lng_action_removed_photo" = "{from} removed group photo";
|
||||
"lng_action_changed_photo" = "{from} changed group photo";
|
||||
"lng_action_changed_title" = "{from} changed group name to «{title}»";
|
||||
"lng_action_created_chat" = "{from} created group «{title}»";
|
||||
|
||||
"lng_group_invite_bad_link" = "This invite link is broken\nor it has expired.";
|
||||
"lng_group_invite_want_join" = "Do you want to join the group «{title}»?";
|
||||
"lng_group_invite_full" = "Sorry, this group is already full.";
|
||||
"lng_group_invite_join" = "Join";
|
||||
|
||||
"lng_group_invite_link" = "Invite link";
|
||||
"lng_group_invite_create" = "Create an invite link";
|
||||
"lng_group_invite_about" = "You can create a link for joining this group.\nAnyone who has that link can join.";
|
||||
"lng_group_invite_create_new" = "Create new link";
|
||||
"lng_group_invite_about_new" = "Current invite link will stop working\nwhen you create a new one.";
|
||||
"lng_group_invite_copied" = "Invite link was copied to clipboard.";
|
||||
"lng_group_invite_no_room" = "Unable to join this group because there are\ntoo many members in it already.";
|
||||
|
||||
"lng_forwarded_from" = "Forwarded from";
|
||||
"lng_in_reply_to" = "In reply to";
|
||||
|
||||
@ -550,7 +564,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
|
||||
"lng_new_version_wrap" = "Telegram Desktop was updated to version {version}\n\n{changes}\n\nFull version history is available here:\n{link}";
|
||||
"lng_new_version_minor" = "— Bug fixes and other minor improvements";
|
||||
"lng_new_version_text" = "— New photo viewer design\n— Switch between files in the photo viewer\n— Grouped notifications when several messages are forwarded\n— New default chat background image (you can change it in Settings)";
|
||||
"lng_new_version_text" = "— Invite links for group chats\n— Gray unread badge for muted conversations";
|
||||
|
||||
"lng_menu_insert_unicode" = "Insert Unicode control character";
|
||||
|
||||
|
@ -699,6 +699,7 @@ dlgDateSkip: 5px;
|
||||
|
||||
dlgUnreadColor: #FFF;
|
||||
dlgUnreadBG: #6fc766;
|
||||
dlgUnreadMutedBG: #bbb;
|
||||
dlgUnreadFont: font(12px bold);
|
||||
dlgUnreadPaddingHor: 5px;
|
||||
dlgUnreadPaddingVer: 1px;
|
||||
@ -919,6 +920,12 @@ mediaInColor: msgInDateColor;
|
||||
mediaOutColor: msgOutDateColor;
|
||||
mediaInSelectColor: msgInSelectDateColor;
|
||||
mediaOutSelectColor: msgOutSelectDateColor;
|
||||
mediaOutUnreadColor: #6aad60;
|
||||
mediaOutUnreadSelectColor: #5aa382;
|
||||
mediaInUnreadColor: #999;
|
||||
mediaInUnreadSelectColor: #7b95aa;
|
||||
mediaUnreadSize: 4px;
|
||||
mediaUnreadSkip: 5px;
|
||||
mediaSaveDelta: 14px; // between bubble and download
|
||||
mediaSaveButton: flatButton(btnDefFlat) {
|
||||
color: #507da2;
|
||||
|
@ -116,18 +116,21 @@ void ApiWrap::clearWebPageRequests() {
|
||||
|
||||
void ApiWrap::gotChatFull(PeerData *peer, const MTPmessages_ChatFull &result) {
|
||||
const MTPDmessages_chatFull &d(result.c_messages_chatFull());
|
||||
const MTPDchatFull &f(d.vfull_chat.c_chatFull());
|
||||
App::feedUsers(d.vusers);
|
||||
App::feedChats(d.vchats);
|
||||
App::feedParticipants(d.vfull_chat.c_chatFull().vparticipants);
|
||||
PhotoData *photo = App::feedPhoto(d.vfull_chat.c_chatFull().vchat_photo);
|
||||
if (photo) {
|
||||
ChatData *chat = peer->asChat();
|
||||
if (chat) {
|
||||
App::feedParticipants(f.vparticipants);
|
||||
PhotoData *photo = App::feedPhoto(f.vchat_photo);
|
||||
ChatData *chat = peer->asChat();
|
||||
if (chat) {
|
||||
if (photo) {
|
||||
chat->photoId = photo->id;
|
||||
photo->chat = chat;
|
||||
}
|
||||
chat->invitationUrl = (f.vexported_invite.type() == mtpc_chatInviteExported) ? qs(f.vexported_invite.c_chatInviteExported().vlink) : QString();
|
||||
}
|
||||
App::main()->gotNotifySetting(MTP_inputNotifyPeer(peer->input), d.vfull_chat.c_chatFull().vnotify_settings);
|
||||
|
||||
App::main()->gotNotifySetting(MTP_inputNotifyPeer(peer->input), f.vnotify_settings);
|
||||
|
||||
_fullRequests.remove(peer);
|
||||
emit fullPeerLoaded(peer);
|
||||
@ -136,6 +139,7 @@ void ApiWrap::gotChatFull(PeerData *peer, const MTPmessages_ChatFull &result) {
|
||||
void ApiWrap::gotUserFull(PeerData *peer, const MTPUserFull &result) {
|
||||
const MTPDuserFull &d(result.c_userFull());
|
||||
App::feedUsers(MTP_vector<MTPUser>(1, d.vuser));
|
||||
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::main()->gotNotifySetting(MTP_inputNotifyPeer(peer->input), d.vnotify_settings);
|
||||
|
||||
|
@ -34,6 +34,9 @@ namespace {
|
||||
typedef QHash<PeerId, PeerData*> PeersData;
|
||||
PeersData peersData;
|
||||
|
||||
typedef QMap<PeerData*, bool> MutedPeers;
|
||||
MutedPeers mutedPeers;
|
||||
|
||||
typedef QHash<PhotoId, PhotoData*> PhotosData;
|
||||
PhotosData photosData;
|
||||
|
||||
@ -441,11 +444,12 @@ namespace App {
|
||||
return data;
|
||||
}
|
||||
|
||||
void feedChats(const MTPVector<MTPChat> &chats) {
|
||||
ChatData *feedChats(const MTPVector<MTPChat> &chats) {
|
||||
ChatData *data = 0;
|
||||
const QVector<MTPChat> &v(chats.c_vector().v);
|
||||
for (QVector<MTPChat>::const_iterator i = v.cbegin(), e = v.cend(); i != e; ++i) {
|
||||
const MTPchat &chat(*i);
|
||||
ChatData *data = 0;
|
||||
data = 0;
|
||||
QString title;
|
||||
switch (chat.type()) {
|
||||
case mtpc_chat: {
|
||||
@ -458,7 +462,7 @@ namespace App {
|
||||
data->setPhoto(d.vphoto);
|
||||
data->date = d.vdate.v;
|
||||
data->count = d.vparticipants_count.v;
|
||||
data->left = false;
|
||||
data->left = d.vleft.v;
|
||||
data->forbidden = false;
|
||||
data->access = 0;
|
||||
if (data->version < d.vversion.v) {
|
||||
@ -507,6 +511,7 @@ namespace App {
|
||||
|
||||
if (App::main()) App::main()->peerUpdated(data);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
void feedParticipants(const MTPChatParticipants &p) {
|
||||
@ -1288,7 +1293,7 @@ namespace App {
|
||||
photoSizes.push_back(MTP_photoSize(MTP_string("a"), uphoto.vphoto_small, MTP_int(160), MTP_int(160), MTP_int(0)));
|
||||
photoSizes.push_back(MTP_photoSize(MTP_string("c"), uphoto.vphoto_big, MTP_int(640), MTP_int(640), MTP_int(0)));
|
||||
|
||||
return MTP_photo(uphoto.vphoto_id, MTP_long(0), userId, date, MTP_string(""), MTP_geoPointEmpty(), MTP_vector<MTPPhotoSize>(photoSizes));
|
||||
return MTP_photo(uphoto.vphoto_id, MTP_long(0), userId, date, MTP_geoPointEmpty(), MTP_vector<MTPPhotoSize>(photoSizes));
|
||||
}
|
||||
return MTP_photoEmpty(MTP_long(0));
|
||||
}
|
||||
@ -1431,6 +1436,7 @@ namespace App {
|
||||
void historyClearItems() {
|
||||
historyClearMsgs();
|
||||
randomData.clear();
|
||||
mutedPeers.clear();
|
||||
for (PeersData::const_iterator i = peersData.cbegin(), e = peersData.cend(); i != e; ++i) {
|
||||
delete *i;
|
||||
}
|
||||
@ -1772,6 +1778,34 @@ namespace App {
|
||||
return ::webPageItems;
|
||||
}
|
||||
|
||||
void regMuted(PeerData *peer, int32 changeIn) {
|
||||
::mutedPeers.insert(peer, true);
|
||||
if (App::main()) App::main()->updateMutedIn(changeIn);
|
||||
}
|
||||
|
||||
void unregMuted(PeerData *peer) {
|
||||
::mutedPeers.remove(peer);
|
||||
}
|
||||
|
||||
void updateMuted() {
|
||||
int32 changeInMin = 0;
|
||||
for (MutedPeers::iterator i = ::mutedPeers.begin(); i != ::mutedPeers.end();) {
|
||||
int32 changeIn = 0;
|
||||
History *h = App::history(i.key()->id);
|
||||
if (isNotifyMuted(i.key()->notify, &changeIn)) {
|
||||
h->setMute(true);
|
||||
if (changeIn && (!changeInMin || changeIn < changeInMin)) {
|
||||
changeInMin = changeIn;
|
||||
}
|
||||
++i;
|
||||
} else {
|
||||
h->setMute(false);
|
||||
i = ::mutedPeers.erase(i);
|
||||
}
|
||||
}
|
||||
if (changeInMin) App::main()->updateMutedIn(changeInMin);
|
||||
}
|
||||
|
||||
void setProxySettings(QNetworkAccessManager &manager) {
|
||||
if (cConnectionType() == dbictHttpProxy) {
|
||||
const ConnectionProxy &p(cConnectionProxy());
|
||||
@ -1802,6 +1836,12 @@ namespace App {
|
||||
}
|
||||
}
|
||||
|
||||
void joinGroupByHash(const QString &hash) {
|
||||
if (App::main()) {
|
||||
App::main()->joinGroupByHash(hash);
|
||||
}
|
||||
}
|
||||
|
||||
void openLocalUrl(const QString &url) {
|
||||
if (App::main()) {
|
||||
App::main()->openLocalUrl(url);
|
||||
|
@ -72,8 +72,8 @@ namespace App {
|
||||
QString onlineText(UserData *user, int32 nowOnServer, bool precise = false);
|
||||
bool onlineColorUse(int32 online, int32 now);
|
||||
|
||||
UserData *feedUsers(const MTPVector<MTPUser> &users); // returnes last user
|
||||
void feedChats(const MTPVector<MTPChat> &chats);
|
||||
UserData *feedUsers(const MTPVector<MTPUser> &users); // returns last user
|
||||
ChatData *feedChats(const MTPVector<MTPChat> &chats); // returns last chat
|
||||
void feedParticipants(const MTPChatParticipants &p);
|
||||
void feedParticipantAdd(const MTPDupdateChatParticipantAdd &d);
|
||||
void feedParticipantDelete(const MTPDupdateChatParticipantDelete &d);
|
||||
@ -189,11 +189,16 @@ namespace App {
|
||||
void unregWebPageItem(WebPageData *data, HistoryItem *item);
|
||||
const WebPageItems &webPageItems();
|
||||
|
||||
void regMuted(PeerData *peer, int32 changeIn);
|
||||
void unregMuted(PeerData *peer);
|
||||
void updateMuted();
|
||||
|
||||
void setProxySettings(QNetworkAccessManager &manager);
|
||||
void setProxySettings(QTcpSocket &socket);
|
||||
|
||||
void searchByHashtag(const QString &tag);
|
||||
void openUserByName(const QString &username, bool toProfile = false);
|
||||
void joinGroupByHash(const QString &hash);
|
||||
void openLocalUrl(const QString &url);
|
||||
|
||||
void initBackground(int32 id = DefaultChatBackground, const QImage &p = QImage(), bool nowrite = false);
|
||||
|
@ -481,7 +481,7 @@ void Application::uploadProfilePhoto(const QImage &tosend, const PeerId &peerId)
|
||||
|
||||
PhotoId id = MTP::nonce<PhotoId>();
|
||||
|
||||
MTPPhoto photo(MTP_photo(MTP_long(id), MTP_long(0), MTP_int(MTP::authedId()), MTP_int(unixtime()), MTP_string(""), MTP_geoPointEmpty(), MTP_vector<MTPPhotoSize>(photoSizes)));
|
||||
MTPPhoto photo(MTP_photo(MTP_long(id), MTP_long(0), MTP_int(MTP::authedId()), MTP_int(unixtime()), MTP_geoPointEmpty(), MTP_vector<MTPPhotoSize>(photoSizes)));
|
||||
|
||||
QString file, filename;
|
||||
int32 filesize = 0;
|
||||
|
@ -414,10 +414,6 @@ void VoiceMessagesFader::onTimer() {
|
||||
if (m.state == VoiceMessagePausing || m.state == VoiceMessageFinishing) {
|
||||
newGain = 1. - newGain;
|
||||
}
|
||||
if (newGain < 0) {
|
||||
int a = 0, b;
|
||||
b = a;
|
||||
}
|
||||
alSourcef(m.source, AL_GAIN, newGain);
|
||||
}
|
||||
} else if (playing && (state == AL_PLAYING || !m.loading)) {
|
||||
|
@ -17,9 +17,9 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
static const int32 AppVersion = 8007;
|
||||
static const wchar_t *AppVersionStr = L"0.8.7";
|
||||
static const bool DevChannel = false;
|
||||
static const int32 AppVersion = 8008;
|
||||
static const wchar_t *AppVersionStr = L"0.8.8";
|
||||
static const bool DevChannel = true;
|
||||
|
||||
static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)";
|
||||
static const wchar_t *AppName = L"Telegram Desktop";
|
||||
|
@ -759,9 +759,12 @@ namespace {
|
||||
void TextLink::onClick(Qt::MouseButton button) const {
|
||||
if (button == Qt::LeftButton || button == Qt::MiddleButton) {
|
||||
QString url = TextLink::encoded();
|
||||
QRegularExpressionMatch telegramMe = QRegularExpression(qsl("^https?://telegram\\.me/([a-zA-Z0-9\\.\\_]+)(\\?|$)"), QRegularExpression::CaseInsensitiveOption).match(url);
|
||||
if (telegramMe.hasMatch()) {
|
||||
App::openUserByName(telegramMe.captured(1));
|
||||
QRegularExpressionMatch telegramMeUser = QRegularExpression(qsl("^https?://telegram\\.me/([a-zA-Z0-9\\.\\_]+)(\\?|$)"), QRegularExpression::CaseInsensitiveOption).match(url);
|
||||
QRegularExpressionMatch telegramMeGroup = QRegularExpression(qsl("^https?://telegram\\.me/joinchat/([a-zA-Z0-9\\.\\_\\-]+)(\\?|$)"), QRegularExpression::CaseInsensitiveOption).match(url);
|
||||
if (telegramMeUser.hasMatch()) {
|
||||
App::openUserByName(telegramMeUser.captured(1));
|
||||
} else if (telegramMeGroup.hasMatch()) {
|
||||
App::joinGroupByHash(telegramMeGroup.captured(1));
|
||||
} else if (QRegularExpression(qsl("^tg://[a-zA-Z0-9]+"), QRegularExpression::CaseInsensitiveOption).match(url).hasMatch()) {
|
||||
App::openLocalUrl(url);
|
||||
} else {
|
||||
|
@ -202,7 +202,7 @@ void DialogRow::paint(QPainter &p, int32 w, bool act, bool sel) const {
|
||||
int32 unreadRectLeft = w - st::dlgPaddingHor - unreadRectWidth;
|
||||
int32 unreadRectTop = st::dlgHeight - st::dlgPaddingVer - unreadRectHeight;
|
||||
lastWidth -= unreadRectWidth + st::dlgUnreadPaddingHor;
|
||||
p.setBrush((act ? st::dlgActiveUnreadBG : st::dlgUnreadBG)->b);
|
||||
p.setBrush((act ? st::dlgActiveUnreadBG : (history->mute ? st::dlgUnreadMutedBG : st::dlgUnreadBG))->b);
|
||||
p.setPen(Qt::NoPen);
|
||||
p.drawRoundedRect(unreadRectLeft, unreadRectTop, unreadRectWidth, unreadRectHeight, st::dlgUnreadRadius, st::dlgUnreadRadius);
|
||||
p.setFont(st::dlgUnreadFont->f);
|
||||
@ -540,6 +540,25 @@ HistoryItem *Histories::addToBack(const MTPmessage &msg, int msgState) {
|
||||
HistoryItem *History::createItem(HistoryBlock *block, const MTPmessage &msg, bool newMsg, bool returnExisting) {
|
||||
HistoryItem *result = 0;
|
||||
|
||||
MsgId msgId = 0;
|
||||
switch (msg.type()) {
|
||||
case mtpc_messageEmpty: msgId = msg.c_messageEmpty().vid.v; break;
|
||||
case mtpc_message: msgId = msg.c_message().vid.v; break;
|
||||
case mtpc_messageService: msgId = msg.c_messageService().vid.v; break;
|
||||
}
|
||||
|
||||
HistoryItem *existing = App::histItemById(msgId);
|
||||
if (existing) {
|
||||
const MTPMessageMedia *media = 0;
|
||||
switch (msg.type()) {
|
||||
case mtpc_message: media = &msg.c_message().vmedia; break;
|
||||
}
|
||||
if (media) {
|
||||
existing->updateMedia(*media);
|
||||
}
|
||||
return returnExisting ? existing : 0;
|
||||
}
|
||||
|
||||
switch (msg.type()) {
|
||||
case mtpc_messageEmpty:
|
||||
result = new HistoryServiceMsg(this, block, msg.c_messageEmpty().vid.v, date(), lang(lng_message_empty));
|
||||
@ -567,6 +586,11 @@ HistoryItem *History::createItem(HistoryBlock *block, const MTPmessage &msg, boo
|
||||
// App::user(App::peerFromUser(d.vuser_id)); added
|
||||
} break;
|
||||
|
||||
case mtpc_messageActionChatJoinedByLink: {
|
||||
const MTPDmessageActionChatJoinedByLink &d(action.c_messageActionChatJoinedByLink());
|
||||
// App::user(App::peerFromUser(d.vuser_id)); added
|
||||
} break;
|
||||
|
||||
case mtpc_messageActionChatDeletePhoto: {
|
||||
ChatData *chat = peer->asChat();
|
||||
if (chat) chat->setPhoto(MTP_chatPhotoEmpty());
|
||||
@ -615,17 +639,7 @@ HistoryItem *History::createItem(HistoryBlock *block, const MTPmessage &msg, boo
|
||||
} break;
|
||||
}
|
||||
|
||||
HistoryItem *existing = regItem(result, true);
|
||||
if (existing && result != existing) {
|
||||
const MTPMessageMedia *media = 0;
|
||||
switch (msg.type()) {
|
||||
case mtpc_message: media = &msg.c_message().vmedia; break;
|
||||
}
|
||||
if (media) {
|
||||
existing->updateMedia(*media);
|
||||
}
|
||||
}
|
||||
return (returnExisting || existing == result) ? existing : 0;
|
||||
return regItem(result, returnExisting);
|
||||
}
|
||||
|
||||
HistoryItem *History::createItemForwarded(HistoryBlock *block, MsgId id, HistoryMessage *msg) {
|
||||
@ -1037,7 +1051,8 @@ void History::setMsgCount(int32 newMsgCount) {
|
||||
if (mute != newMute) {
|
||||
App::histories().unreadMuted += newMute ? unreadCount : (-unreadCount);
|
||||
mute = newMute;
|
||||
App::wnd()->updateCounter();
|
||||
if (App::wnd()) App::wnd()->updateCounter();
|
||||
if (App::main()) App::main()->dlgUpdated(this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1522,10 +1537,14 @@ HistoryItem *regItem(HistoryItem *item, bool returnExisting) {
|
||||
return item;
|
||||
}
|
||||
|
||||
HistoryPhoto::HistoryPhoto(const MTPDphoto &photo) : HistoryMedia()
|
||||
HistoryPhoto::HistoryPhoto(const MTPDphoto &photo, const QString &caption, HistoryItem *parent) : HistoryMedia()
|
||||
, pixw(1), pixh(1)
|
||||
, data(App::feedPhoto(photo))
|
||||
, _caption(st::minPhotoSize)
|
||||
, openl(new PhotoLink(data)) {
|
||||
if (!caption.isEmpty()) {
|
||||
_caption.setText(st::msgFont, caption + textcmdSkipBlock(parent->timeWidth(true), st::msgDateFont->height - st::msgDateDelta.y()), _historyTextOptions);
|
||||
}
|
||||
init();
|
||||
}
|
||||
|
||||
@ -1554,20 +1573,36 @@ void HistoryPhoto::initDimensions(const HistoryItem *parent) {
|
||||
}
|
||||
_maxw = qMax(w, int32(st::minPhotoSize));
|
||||
_minh = qMax(thumbh, int32(st::minPhotoSize));
|
||||
if (const HistoryReply *reply = toHistoryReply(parent)) {
|
||||
const HistoryReply *reply = toHistoryReply(parent);
|
||||
const HistoryForwarded *fwd = toHistoryForwarded(parent);
|
||||
if (reply || !_caption.isEmpty()) {
|
||||
_maxw += st::mediaPadding.left() + st::mediaPadding.right();
|
||||
_minh += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom() + st::mediaPadding.top() + st::mediaPadding.bottom();
|
||||
if (reply) {
|
||||
_minh += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom();
|
||||
} else {
|
||||
if (parent->out() || !parent->history()->peer->chat || !fwd) {
|
||||
_minh += st::msgPadding.top();
|
||||
}
|
||||
if (fwd) {
|
||||
_minh += st::msgServiceNameFont->height + st::msgPadding.top();
|
||||
}
|
||||
}
|
||||
if (!parent->out() && parent->history()->peer->chat) {
|
||||
_minh += st::msgPadding.top() + st::msgNameFont->height;
|
||||
}
|
||||
if (!_caption.isEmpty()) {
|
||||
_minh += _caption.minHeight();
|
||||
}
|
||||
_minh += st::mediaPadding.bottom();
|
||||
}
|
||||
}
|
||||
|
||||
int32 HistoryPhoto::resize(int32 width, bool dontRecountText, const HistoryItem *parent) {
|
||||
const HistoryReply *reply = toHistoryReply(parent);
|
||||
const HistoryForwarded *fwd = reply ? 0 : toHistoryForwarded(parent);
|
||||
|
||||
pixw = qMin(width, _maxw);
|
||||
if (reply) {
|
||||
if (reply || !_caption.isEmpty()) {
|
||||
pixw -= st::mediaPadding.left() + st::mediaPadding.right();
|
||||
}
|
||||
|
||||
@ -1594,12 +1629,25 @@ int32 HistoryPhoto::resize(int32 width, bool dontRecountText, const HistoryItem
|
||||
if (pixh < 1) pixh = 1;
|
||||
w = qMax(pixw, int16(st::minPhotoSize));
|
||||
_height = qMax(pixh, int16(st::minPhotoSize));
|
||||
if (reply) {
|
||||
w += st::mediaPadding.left() + st::mediaPadding.right();
|
||||
_height += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom() + st::mediaPadding.top() + st::mediaPadding.bottom();
|
||||
if (reply || !_caption.isEmpty()) {
|
||||
if (reply) {
|
||||
_height += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom();
|
||||
} else {
|
||||
if (parent->out() || !parent->history()->peer->chat || !fwd) {
|
||||
_height += st::msgPadding.top();
|
||||
}
|
||||
if (fwd) {
|
||||
_height += st::msgServiceNameFont->height + st::msgPadding.top();
|
||||
}
|
||||
}
|
||||
if (!parent->out() && parent->history()->peer->chat) {
|
||||
_height += st::msgPadding.top() + st::msgNameFont->height;
|
||||
}
|
||||
if (!_caption.isEmpty()) {
|
||||
_height += st::webPagePhotoSkip + _caption.countHeight(w);
|
||||
}
|
||||
_height += st::mediaPadding.bottom();
|
||||
w += st::mediaPadding.left() + st::mediaPadding.right();
|
||||
}
|
||||
return _height;
|
||||
}
|
||||
@ -1622,24 +1670,47 @@ void HistoryPhoto::getState(TextLinkPtr &lnk, bool &inText, int32 x, int32 y, co
|
||||
if (width < 1) return;
|
||||
|
||||
int skipx = 0, skipy = 0, height = _height;
|
||||
if (const HistoryReply *reply = toHistoryReply(parent)) {
|
||||
const HistoryReply *reply = toHistoryReply(parent);
|
||||
const HistoryForwarded *fwd = reply ? 0 : toHistoryForwarded(parent);
|
||||
int replyFrom = 0, fwdFrom = 0;
|
||||
if (reply || !_caption.isEmpty()) {
|
||||
skipx = st::mediaPadding.left();
|
||||
skipy = st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom() + st::mediaPadding.top();
|
||||
height -= st::mediaPadding.bottom();
|
||||
int replyFrom = 0;
|
||||
if (reply) {
|
||||
skipy = st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom();
|
||||
} else if (fwd) {
|
||||
skipy = st::msgServiceNameFont->height + st::msgPadding.top();
|
||||
}
|
||||
if (!parent->out() && parent->history()->peer->chat) {
|
||||
replyFrom = st::msgPadding.top() + st::msgNameFont->height;
|
||||
fwdFrom = st::msgPadding.top() + st::msgNameFont->height;
|
||||
skipy += replyFrom;
|
||||
if (x >= st::mediaPadding.left() && y >= st::msgPadding.top() && x < width - st::mediaPadding.left() - st::mediaPadding.right() && x < st::mediaPadding.left() + parent->from()->nameText.maxWidth() && y < replyFrom) {
|
||||
lnk = parent->from()->lnk;
|
||||
return;
|
||||
}
|
||||
if (!reply && !fwd) skipy += st::msgPadding.top();
|
||||
} else if (!reply) {
|
||||
fwdFrom = st::msgPadding.top();
|
||||
skipy += fwdFrom;
|
||||
}
|
||||
if (x >= 0 && y >= replyFrom + st::msgReplyPadding.top() && x < width && y < skipy - st::msgReplyPadding.bottom() - st::mediaPadding.top()) {
|
||||
lnk = reply->replyToLink();
|
||||
return;
|
||||
if (reply) {
|
||||
if (x >= 0 && y >= replyFrom + st::msgReplyPadding.top() && x < width && y < skipy - st::msgReplyPadding.bottom()) {
|
||||
lnk = reply->replyToLink();
|
||||
return;
|
||||
}
|
||||
} else if (fwd) {
|
||||
if (y >= fwdFrom && y < fwdFrom + st::msgServiceNameFont->height) {
|
||||
return fwd->getForwardedState(lnk, inText, x - st::mediaPadding.left(), width - st::mediaPadding.left() - st::mediaPadding.right());
|
||||
}
|
||||
}
|
||||
height -= st::mediaPadding.bottom();
|
||||
width -= st::mediaPadding.left() + st::mediaPadding.right();
|
||||
if (!_caption.isEmpty()) {
|
||||
height -= _caption.countHeight(width) + st::webPagePhotoSkip;
|
||||
if (x >= skipx && y >= height + st::webPagePhotoSkip && x < skipx + width && y < _height) {
|
||||
return _caption.getState(lnk, inText, x - skipx, y - height - st::webPagePhotoSkip, width);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (x >= skipx && y >= skipy && x < skipx + width && y < height) {
|
||||
lnk = openl;
|
||||
@ -1686,26 +1757,40 @@ void HistoryPhoto::updateFrom(const MTPMessageMedia &media) {
|
||||
}
|
||||
|
||||
void HistoryPhoto::draw(QPainter &p, const HistoryItem *parent, bool selected, int32 width) const {
|
||||
const HistoryReply *reply = toHistoryReply(parent);
|
||||
const HistoryForwarded *fwd = reply ? 0 : toHistoryForwarded(parent);
|
||||
if (width < 0) width = w;
|
||||
int skipx = 0, skipy = 0, height = _height;
|
||||
if (const HistoryReply *reply = toHistoryReply(parent)) {
|
||||
if (reply || !_caption.isEmpty()) {
|
||||
skipx = st::mediaPadding.left();
|
||||
skipy = st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom() + st::mediaPadding.top();
|
||||
|
||||
style::color bg(selected ? (parent->out() ? st::msgOutSelectBG : st::msgInSelectBG) : (parent->out() ? st::msgOutBG : st::msgInBG));
|
||||
p.fillRect(QRect(0, 0, width, _height), bg->b);
|
||||
int replyFrom = 0;
|
||||
int replyFrom = 0, fwdFrom = 0;
|
||||
if (!parent->out() && parent->history()->peer->chat) {
|
||||
replyFrom = st::msgPadding.top() + st::msgNameFont->height;
|
||||
fwdFrom = st::msgPadding.top() + st::msgNameFont->height;
|
||||
skipy += replyFrom;
|
||||
p.setFont(st::msgNameFont->f);
|
||||
p.setPen(parent->from()->color->p);
|
||||
parent->from()->nameText.drawElided(p, st::mediaPadding.left(), st::msgPadding.top(), width - st::mediaPadding.left() - st::mediaPadding.right());
|
||||
if (!fwd && !reply) skipy += st::msgPadding.top();
|
||||
} else if (!reply) {
|
||||
fwdFrom = st::msgPadding.top();
|
||||
skipy += fwdFrom;
|
||||
}
|
||||
if (reply) {
|
||||
skipy += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom();
|
||||
reply->drawReplyTo(p, st::msgReplyPadding.left(), replyFrom, width - st::msgReplyPadding.left() - st::msgReplyPadding.right(), selected);
|
||||
} else if (fwd) {
|
||||
skipy += st::msgServiceNameFont->height + st::msgPadding.top();
|
||||
fwd->drawForwardedFrom(p, st::mediaPadding.left(), fwdFrom, width - st::mediaPadding.left() - st::mediaPadding.right(), selected);
|
||||
}
|
||||
reply->drawReplyTo(p, st::msgReplyPadding.left(), replyFrom, width - st::msgReplyPadding.left() - st::msgReplyPadding.right(), selected);
|
||||
|
||||
width -= st::mediaPadding.left() + st::mediaPadding.right();
|
||||
height -= skipy + st::mediaPadding.bottom();
|
||||
if (!_caption.isEmpty()) {
|
||||
height -= st::webPagePhotoSkip + _caption.countHeight(width);
|
||||
}
|
||||
}
|
||||
data->full->load(false, false);
|
||||
bool out = parent->out();
|
||||
@ -1749,35 +1834,59 @@ void HistoryPhoto::draw(QPainter &p, const HistoryItem *parent, bool selected, i
|
||||
|
||||
// date
|
||||
QString time(parent->time());
|
||||
if (time.isEmpty()) return;
|
||||
int32 dateX = skipx + width - parent->timeWidth() - st::msgDateImgDelta - 2 * st::msgDateImgPadding.x();
|
||||
int32 dateY = skipy + height - st::msgDateFont->height - 2 * st::msgDateImgPadding.y() - st::msgDateImgDelta;
|
||||
if (parent->out()) {
|
||||
dateX -= st::msgCheckRect.pxWidth() + st::msgDateImgCheckSpace;
|
||||
}
|
||||
int32 dateW = skipx + width - dateX - st::msgDateImgDelta;
|
||||
int32 dateH = skipy + height - dateY - st::msgDateImgDelta;
|
||||
|
||||
p.fillRect(dateX, dateY, dateW, dateH, st::msgDateImgBg->b);
|
||||
if (selected) {
|
||||
p.fillRect(dateX, dateY, dateW, dateH, textstyleCurrent()->selectOverlay->b);
|
||||
}
|
||||
p.setFont(st::msgDateFont->f);
|
||||
p.setPen(st::msgDateImgColor->p);
|
||||
p.drawText(dateX + st::msgDateImgPadding.x(), dateY + st::msgDateImgPadding.y() + st::msgDateFont->ascent, time);
|
||||
if (out) {
|
||||
QPoint iconPos(dateX - 2 + dateW - st::msgDateImgCheckSpace - st::msgCheckRect.pxWidth(), dateY + (dateH - st::msgCheckRect.pxHeight()) / 2);
|
||||
const QRect *iconRect;
|
||||
if (parent->id > 0) {
|
||||
if (parent->unread()) {
|
||||
iconRect = &st::msgImgCheckRect;
|
||||
} else {
|
||||
iconRect = &st::msgImgDblCheckRect;
|
||||
}
|
||||
} else {
|
||||
iconRect = &st::msgImgSendingRect;
|
||||
if (_caption.isEmpty()) {
|
||||
if (time.isEmpty()) return;
|
||||
int32 dateX = skipx + width - parent->timeWidth(false) - st::msgDateImgDelta - 2 * st::msgDateImgPadding.x();
|
||||
int32 dateY = skipy + height - st::msgDateFont->height - 2 * st::msgDateImgPadding.y() - st::msgDateImgDelta;
|
||||
if (parent->out()) {
|
||||
dateX -= st::msgCheckRect.pxWidth() + st::msgDateImgCheckSpace;
|
||||
}
|
||||
int32 dateW = skipx + width - dateX - st::msgDateImgDelta;
|
||||
int32 dateH = skipy + height - dateY - st::msgDateImgDelta;
|
||||
|
||||
p.fillRect(dateX, dateY, dateW, dateH, st::msgDateImgBg->b);
|
||||
if (selected) {
|
||||
p.fillRect(dateX, dateY, dateW, dateH, textstyleCurrent()->selectOverlay->b);
|
||||
}
|
||||
p.setFont(st::msgDateFont->f);
|
||||
p.setPen(st::msgDateImgColor->p);
|
||||
p.drawText(dateX + st::msgDateImgPadding.x(), dateY + st::msgDateImgPadding.y() + st::msgDateFont->ascent, time);
|
||||
if (out) {
|
||||
QPoint iconPos(dateX - 2 + dateW - st::msgDateImgCheckSpace - st::msgCheckRect.pxWidth(), dateY + (dateH - st::msgCheckRect.pxHeight()) / 2);
|
||||
const QRect *iconRect;
|
||||
if (parent->id > 0) {
|
||||
if (parent->unread()) {
|
||||
iconRect = &st::msgImgCheckRect;
|
||||
} else {
|
||||
iconRect = &st::msgImgDblCheckRect;
|
||||
}
|
||||
} else {
|
||||
iconRect = &st::msgImgSendingRect;
|
||||
}
|
||||
p.drawPixmap(iconPos, App::sprite(), *iconRect);
|
||||
}
|
||||
} else {
|
||||
p.setPen(st::black->p);
|
||||
_caption.draw(p, skipx, skipy + height + st::webPagePhotoSkip, width);
|
||||
|
||||
style::color date(selected ? (out ? st::msgOutSelectDateColor : st::msgInSelectDateColor) : (out ? st::msgOutDateColor : st::msgInDateColor));
|
||||
p.setPen(date->p);
|
||||
|
||||
p.drawText(w - st::msgPadding.right() + st::msgDateDelta.x() - parent->timeWidth(true) + st::msgDateSpace, _height - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgDateFont->descent, time);
|
||||
if (out) {
|
||||
QPoint iconPos(w + st::msgCheckPos.x() - st::msgPadding.right() - st::msgCheckRect.pxWidth(), _height + st::msgCheckPos.y() - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgCheckRect.pxHeight());
|
||||
const QRect *iconRect;
|
||||
if (parent->id > 0) {
|
||||
if (parent->unread()) {
|
||||
iconRect = &(selected ? st::msgSelectCheckRect : st::msgCheckRect);
|
||||
} else {
|
||||
iconRect = &(selected ? st::msgSelectDblCheckRect : st::msgDblCheckRect);
|
||||
}
|
||||
} else {
|
||||
iconRect = &st::msgSendingRect;
|
||||
}
|
||||
p.drawPixmap(iconPos, App::sprite(), *iconRect);
|
||||
}
|
||||
p.drawPixmap(iconPos, App::sprite(), *iconRect);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1821,11 +1930,12 @@ QString formatDurationAndSizeText(qint64 duration, qint64 size) {
|
||||
|
||||
int32 _downloadWidth = 0, _openWithWidth = 0, _cancelWidth = 0, _buttonWidth = 0;
|
||||
|
||||
HistoryVideo::HistoryVideo(const MTPDvideo &video) : HistoryMedia()
|
||||
HistoryVideo::HistoryVideo(const MTPDvideo &video, const QString &caption, HistoryItem *parent) : HistoryMedia()
|
||||
, data(App::feedVideo(video))
|
||||
, _openl(new VideoOpenLink(data))
|
||||
, _savel(new VideoSaveLink(data))
|
||||
, _cancell(new VideoCancelLink(data))
|
||||
, _caption(st::minPhotoSize)
|
||||
, _dldDone(0)
|
||||
, _uplDone(0)
|
||||
{
|
||||
@ -2037,7 +2147,7 @@ void HistoryVideo::draw(QPainter &p, const HistoryItem *parent, bool selected, i
|
||||
|
||||
int32 tleft = st::mediaPadding.left() + st::mediaThumbSize + st::mediaPadding.right();
|
||||
int32 twidth = width - tleft - st::mediaPadding.right();
|
||||
int32 fullTimeWidth = parent->timeWidth() + st::msgDateSpace + (out ? st::msgDateCheckSpace + st::msgCheckRect.pxWidth() : 0) + st::msgPadding.right() - st::msgDateDelta.x();
|
||||
int32 fullTimeWidth = parent->timeWidth(true) + st::msgPadding.right();
|
||||
int32 secondwidth = width - tleft - fullTimeWidth;
|
||||
|
||||
p.setFont(st::mediaFont->f);
|
||||
@ -2068,8 +2178,18 @@ void HistoryVideo::draw(QPainter &p, const HistoryItem *parent, bool selected, i
|
||||
statusText = _size;
|
||||
}
|
||||
}
|
||||
p.drawText(tleft, skipy + st::mediaPadding.top() + st::mediaThumbSize - st::mediaDetailsShift - st::mediaFont->descent, statusText);
|
||||
|
||||
int32 texty = skipy + st::mediaPadding.top() + st::mediaThumbSize - st::mediaDetailsShift - st::mediaFont->height;
|
||||
p.drawText(tleft, texty + st::mediaFont->ascent, statusText);
|
||||
if (parent->isMediaUnread()) {
|
||||
int32 w = st::mediaFont->m.width(statusText);
|
||||
if (w + st::mediaUnreadSkip + st::mediaUnreadSize <= twidth) {
|
||||
p.setRenderHint(QPainter::HighQualityAntialiasing, true);
|
||||
p.setPen(Qt::NoPen);
|
||||
p.setBrush((out ? (selected ? st::mediaOutUnreadSelectColor : st::mediaOutUnreadColor) : (selected ? st::mediaInUnreadSelectColor : st::mediaInUnreadColor))->b);
|
||||
p.drawEllipse(QRect(tleft + w + st::mediaUnreadSkip, texty + ((st::mediaFont->height - st::mediaUnreadSize) / 2), st::mediaUnreadSize, st::mediaUnreadSize));
|
||||
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
|
||||
}
|
||||
}
|
||||
p.setFont(st::msgDateFont->f);
|
||||
|
||||
style::color date(selected ? (out ? st::msgOutSelectDateColor : st::msgInSelectDateColor) : (out ? st::msgOutDateColor : st::msgInDateColor));
|
||||
@ -2233,7 +2353,7 @@ void HistoryAudio::draw(QPainter &p, const HistoryItem *parent, bool selected, i
|
||||
|
||||
int32 tleft = st::mediaPadding.left() + st::mediaThumbSize + st::mediaPadding.right();
|
||||
int32 twidth = width - tleft - st::mediaPadding.right();
|
||||
int32 fullTimeWidth = parent->timeWidth() + st::msgDateSpace + (out ? st::msgDateCheckSpace + st::msgCheckRect.pxWidth() : 0) + st::msgPadding.right() - st::msgDateDelta.x();
|
||||
int32 fullTimeWidth = parent->timeWidth(true) + st::msgPadding.right();
|
||||
int32 secondwidth = width - tleft - fullTimeWidth;
|
||||
|
||||
p.setFont(st::mediaFont->f);
|
||||
@ -2271,7 +2391,18 @@ void HistoryAudio::draw(QPainter &p, const HistoryItem *parent, bool selected, i
|
||||
}
|
||||
}
|
||||
}
|
||||
p.drawText(tleft, skipy + st::mediaPadding.top() + st::mediaThumbSize - st::mediaDetailsShift - st::mediaFont->descent, statusText);
|
||||
int32 texty = skipy + st::mediaPadding.top() + st::mediaThumbSize - st::mediaDetailsShift - st::mediaFont->height;
|
||||
p.drawText(tleft, texty + st::mediaFont->ascent, statusText);
|
||||
if (parent->isMediaUnread()) {
|
||||
int32 w = st::mediaFont->m.width(statusText);
|
||||
if (w + st::mediaUnreadSkip + st::mediaUnreadSize <= twidth) {
|
||||
p.setRenderHint(QPainter::HighQualityAntialiasing, true);
|
||||
p.setPen(Qt::NoPen);
|
||||
p.setBrush((out ? (selected ? st::mediaOutUnreadSelectColor : st::mediaOutUnreadColor) : (selected ? st::mediaInUnreadSelectColor : st::mediaInUnreadColor))->b);
|
||||
p.drawEllipse(QRect(tleft + w + st::mediaUnreadSkip, texty + ((st::mediaFont->height - st::mediaUnreadSize) / 2), st::mediaUnreadSize, st::mediaUnreadSize));
|
||||
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
|
||||
}
|
||||
}
|
||||
p.setFont(st::msgDateFont->f);
|
||||
|
||||
style::color date(selected ? (out ? st::msgOutSelectDateColor : st::msgInSelectDateColor) : (out ? st::msgOutDateColor : st::msgInDateColor));
|
||||
@ -2543,7 +2674,7 @@ void HistoryDocument::draw(QPainter &p, const HistoryItem *parent, bool selected
|
||||
|
||||
int32 tleft = st::mediaPadding.left() + st::mediaThumbSize + st::mediaPadding.right();
|
||||
int32 twidth = width - tleft - st::mediaPadding.right();
|
||||
int32 fullTimeWidth = parent->timeWidth() + st::msgDateSpace + (out ? st::msgDateCheckSpace + st::msgCheckRect.pxWidth() : 0) + st::msgPadding.right() - st::msgDateDelta.x();
|
||||
int32 fullTimeWidth = parent->timeWidth(true) + st::msgPadding.right();
|
||||
int32 secondwidth = width - tleft - fullTimeWidth;
|
||||
|
||||
p.setFont(st::mediaFont->f);
|
||||
@ -2835,7 +2966,7 @@ void HistorySticker::draw(QPainter &p, const HistoryItem *parent, bool selected,
|
||||
// date
|
||||
QString time(parent->time());
|
||||
if (time.isEmpty()) return;
|
||||
int32 dateX = usex + usew - parent->timeWidth() - st::msgDateImgDelta - 2 * st::msgDateImgPadding.x();
|
||||
int32 dateX = usex + usew - parent->timeWidth(false) - st::msgDateImgDelta - 2 * st::msgDateImgPadding.x();
|
||||
int32 dateY = _height - st::msgDateFont->height - 2 * st::msgDateImgPadding.y() - st::msgDateImgDelta;
|
||||
if (parent->out()) {
|
||||
dateX -= st::msgCheckRect.pxWidth() + st::msgDateImgCheckSpace;
|
||||
@ -2965,7 +3096,7 @@ HistoryContact::HistoryContact(int32 userId, const QString &first, const QString
|
||||
|
||||
void HistoryContact::initDimensions(const HistoryItem *parent) {
|
||||
int32 tleft = st::mediaPadding.left() + st::mediaThumbSize + st::mediaPadding.right();
|
||||
int32 fullTimeWidth = parent->timeWidth() + st::msgDateSpace + (parent->out() ? st::msgDateCheckSpace + st::msgCheckRect.pxWidth() : 0) + st::msgPadding.right() - st::msgDateDelta.x();
|
||||
int32 fullTimeWidth = parent->timeWidth(true) + st::msgPadding.right();
|
||||
if (name.maxWidth() + tleft + fullTimeWidth > _maxw) {
|
||||
_maxw = name.maxWidth() + tleft + fullTimeWidth;
|
||||
}
|
||||
@ -3101,7 +3232,7 @@ void HistoryContact::draw(QPainter &p, const HistoryItem *parent, bool selected,
|
||||
|
||||
int32 tleft = st::mediaPadding.left() + st::mediaThumbSize + st::mediaPadding.right();
|
||||
int32 twidth = width - tleft - st::mediaPadding.right();
|
||||
int32 fullTimeWidth = parent->timeWidth() + st::msgDateSpace + (out ? st::msgDateCheckSpace + st::msgCheckRect.pxWidth() : 0) + st::msgPadding.right() - st::msgDateDelta.x();
|
||||
int32 fullTimeWidth = parent->timeWidth(true) + st::msgPadding.right();
|
||||
int32 secondwidth = width - tleft - fullTimeWidth;
|
||||
|
||||
p.setFont(st::mediaFont->f);
|
||||
@ -3211,7 +3342,7 @@ void HistoryWebPage::initDimensions(const HistoryItem *parent) {
|
||||
|
||||
w = thumbw;
|
||||
|
||||
_maxw = st::webPageLeft + qMax(w, int32(st::minPhotoSize)) + parent->timeWidth();
|
||||
_maxw = st::webPageLeft + qMax(w, int32(st::minPhotoSize)) + parent->timeWidth(true);
|
||||
_minh = qMax(thumbh, int32(st::minPhotoSize));
|
||||
_minh += st::webPagePhotoSkip;
|
||||
} else {
|
||||
@ -3224,7 +3355,7 @@ void HistoryWebPage::initDimensions(const HistoryItem *parent) {
|
||||
if (_asArticle) {
|
||||
_maxw = qMax(_maxw, int32(st::webPageLeft + _siteNameWidth + st::webPagePhotoDelta + st::webPagePhotoSize));
|
||||
} else {
|
||||
_maxw = qMax(_maxw, int32(st::webPageLeft + _siteNameWidth + parent->timeWidth()));
|
||||
_maxw = qMax(_maxw, int32(st::webPageLeft + _siteNameWidth + parent->timeWidth(true)));
|
||||
_minh += st::webPageTitleFont->height;
|
||||
}
|
||||
}
|
||||
@ -3234,13 +3365,13 @@ void HistoryWebPage::initDimensions(const HistoryItem *parent) {
|
||||
if (_asArticle) {
|
||||
_maxw = qMax(_maxw, int32(st::webPageLeft + _title.maxWidth() + st::webPagePhotoDelta + st::webPagePhotoSize));
|
||||
} else {
|
||||
_maxw = qMax(_maxw, int32(st::webPageLeft + _title.maxWidth() + parent->timeWidth()));
|
||||
_maxw = qMax(_maxw, int32(st::webPageLeft + _title.maxWidth() + (data->photo ? parent->timeWidth(true) : 0)));
|
||||
_minh += qMin(_title.minHeight(), 2 * st::webPageTitleFont->height);
|
||||
}
|
||||
}
|
||||
if (!data->description.isEmpty()) {
|
||||
QString text = textClean(data->description);
|
||||
if (!_asArticle) text += textcmdSkipBlock(parent->timeWidth(), st::msgDateFont->height - st::msgDateDelta.y());
|
||||
if (!_asArticle && !data->photo) text += textcmdSkipBlock(parent->timeWidth(true), st::msgDateFont->height - st::msgDateDelta.y());
|
||||
const TextParseOptions *opts = &_webpageDescriptionOptions;
|
||||
if (data->siteName == QLatin1String("Twitter")) {
|
||||
opts = &_twitterDescriptionOptions;
|
||||
@ -3273,7 +3404,7 @@ void HistoryWebPage::draw(QPainter &p, const HistoryItem *parent, bool selected,
|
||||
if (!data->pendingTill) {
|
||||
if (data->photo) {
|
||||
bottomSkip += st::webPagePhotoSkip;
|
||||
if (_asArticle || (st::webPageLeft + qMax(_pixw, int16(st::minPhotoSize)) + parent->timeWidth() > width)) {
|
||||
if (_asArticle || (st::webPageLeft + qMax(_pixw, int16(st::minPhotoSize)) + parent->timeWidth(true) > width)) {
|
||||
bottomSkip += (st::msgDateFont->height - st::msgDateDelta.y());
|
||||
}
|
||||
}
|
||||
@ -3324,7 +3455,7 @@ void HistoryWebPage::draw(QPainter &p, const HistoryItem *parent, bool selected,
|
||||
if (_asArticle) {
|
||||
availw -= st::webPagePhotoSize + st::webPagePhotoDelta;
|
||||
} else if (_title.isEmpty() && _description.isEmpty() && !data->photo) {
|
||||
availw -= parent->timeWidth();
|
||||
availw -= parent->timeWidth(true);
|
||||
}
|
||||
p.setFont(st::webPageTitleFont->f);
|
||||
p.setPen(semibold->p);
|
||||
@ -3338,7 +3469,7 @@ void HistoryWebPage::draw(QPainter &p, const HistoryItem *parent, bool selected,
|
||||
if (_asArticle) {
|
||||
availw -= st::webPagePhotoSize + st::webPagePhotoDelta;
|
||||
} else if (_description.isEmpty() && !data->photo) {
|
||||
endskip = parent->timeWidth();
|
||||
endskip = parent->timeWidth(true);
|
||||
}
|
||||
_title.drawElided(p, 0, 0, availw, 2, style::al_left, 0, -1, endskip);
|
||||
int32 h = _title.countHeight(availw);
|
||||
@ -3356,8 +3487,8 @@ void HistoryWebPage::draw(QPainter &p, const HistoryItem *parent, bool selected,
|
||||
if (_asArticle) {
|
||||
availw -= st::webPagePhotoSize + st::webPagePhotoDelta;
|
||||
if (articleLines > 3) articleLines = 3;
|
||||
} else if (!data->photo) {
|
||||
endskip = parent->timeWidth();
|
||||
} else {
|
||||
if (!data->photo) endskip = parent->timeWidth(true);
|
||||
articleLines = 3;
|
||||
}
|
||||
_description.drawElided(p, 0, 0, availw, articleLines, style::al_left, 0, -1, endskip);
|
||||
@ -3487,7 +3618,7 @@ int32 HistoryWebPage::resize(int32 width, bool dontRecountText, const HistoryIte
|
||||
if (_pixh < 1) _pixh = 1;
|
||||
_height = qMax(_pixh, int16(st::minPhotoSize));
|
||||
_height += st::webPagePhotoSkip;
|
||||
if (qMax(_pixw, int16(st::minPhotoSize)) + parent->timeWidth() > width) {
|
||||
if (qMax(_pixw, int16(st::minPhotoSize)) + parent->timeWidth(true) > width) {
|
||||
_height += (st::msgDateFont->height - st::msgDateDelta.y());
|
||||
}
|
||||
} else {
|
||||
@ -3953,7 +4084,16 @@ void ImageLinkData::load() {
|
||||
manager.getData(this);
|
||||
}
|
||||
|
||||
HistoryImageLink::HistoryImageLink(const QString &url) : HistoryMedia() {
|
||||
HistoryImageLink::HistoryImageLink(const QString &url, const QString &title, const QString &description) : HistoryMedia(),
|
||||
_title(st::msgMinWidth),
|
||||
_description(st::msgMinWidth) {
|
||||
if (!title.isEmpty()) {
|
||||
_title.setText(st::webPageTitleFont, textClean(title), _webpageTitleOptions);
|
||||
}
|
||||
if (!description.isEmpty()) {
|
||||
_description.setText(st::webPageDescriptionFont, textClean(description), _webpageDescriptionOptions);
|
||||
}
|
||||
|
||||
if (url.startsWith(qsl("location:"))) {
|
||||
QString lnk = qsl("https://maps.google.com/maps?q=") + url.mid(9) + qsl("&ll=") + url.mid(9) + qsl("&z=17");
|
||||
link.reset(new TextLink(lnk));
|
||||
@ -4030,12 +4170,35 @@ void HistoryImageLink::initDimensions(const HistoryItem *parent) {
|
||||
}
|
||||
_maxw = w;
|
||||
_minh = thumbh;
|
||||
if (const HistoryReply *reply = toHistoryReply(parent)) {
|
||||
const HistoryReply *reply = toHistoryReply(parent);
|
||||
const HistoryForwarded *fwd = toHistoryForwarded(parent);
|
||||
if (reply || !_title.isEmpty() || !_description.isEmpty()) {
|
||||
_maxw += st::mediaPadding.left() + st::mediaPadding.right();
|
||||
_minh += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom() + st::mediaPadding.top() + st::mediaPadding.bottom();
|
||||
if (reply) {
|
||||
_minh += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom();
|
||||
} else {
|
||||
if (parent->out() || !parent->history()->peer->chat || !fwd) {
|
||||
_minh += st::msgPadding.top();
|
||||
}
|
||||
if (fwd) {
|
||||
_minh += st::msgServiceNameFont->height + st::msgPadding.top();
|
||||
}
|
||||
}
|
||||
if (!parent->out() && parent->history()->peer->chat) {
|
||||
_minh += st::msgPadding.top() + st::msgNameFont->height;
|
||||
}
|
||||
if (!_title.isEmpty()) {
|
||||
_maxw = qMax(_maxw, int32(st::webPageLeft + _title.maxWidth()));
|
||||
_minh += qMin(_title.minHeight(), 2 * st::webPageTitleFont->height);
|
||||
}
|
||||
if (!_description.isEmpty()) {
|
||||
_maxw = qMax(_maxw, int32(st::webPageLeft + _description.maxWidth()));
|
||||
_minh += qMin(_description.minHeight(), 3 * st::webPageTitleFont->height);
|
||||
}
|
||||
if (!_title.isEmpty() || !_description.isEmpty()) {
|
||||
_minh += st::webPagePhotoSkip;
|
||||
}
|
||||
_minh += st::mediaPadding.bottom();
|
||||
}
|
||||
_height = _minh;
|
||||
}
|
||||
@ -4043,23 +4206,48 @@ void HistoryImageLink::initDimensions(const HistoryItem *parent) {
|
||||
void HistoryImageLink::draw(QPainter &p, const HistoryItem *parent, bool selected, int32 width) const {
|
||||
if (width < 0) width = w;
|
||||
int skipx = 0, skipy = 0, height = _height;
|
||||
if (const HistoryReply *reply = toHistoryReply(parent)) {
|
||||
const HistoryReply *reply = toHistoryReply(parent);
|
||||
const HistoryForwarded *fwd = toHistoryForwarded(parent);
|
||||
if (reply || !_title.isEmpty() || !_description.isEmpty()) {
|
||||
skipx = st::mediaPadding.left();
|
||||
skipy = st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom() + st::mediaPadding.top();
|
||||
|
||||
style::color bg(selected ? (parent->out() ? st::msgOutSelectBG : st::msgInSelectBG) : (parent->out() ? st::msgOutBG : st::msgInBG));
|
||||
p.fillRect(QRect(0, 0, width, _height), bg->b);
|
||||
int replyFrom = 0;
|
||||
int replyFrom = 0, fwdFrom = 0;
|
||||
if (!parent->out() && parent->history()->peer->chat) {
|
||||
replyFrom = st::msgPadding.top() + st::msgNameFont->height;
|
||||
fwdFrom = st::msgPadding.top() + st::msgNameFont->height;
|
||||
skipy += replyFrom;
|
||||
p.setFont(st::msgNameFont->f);
|
||||
p.setPen(parent->from()->color->p);
|
||||
parent->from()->nameText.drawElided(p, st::mediaPadding.left(), st::msgPadding.top(), width - st::mediaPadding.left() - st::mediaPadding.right());
|
||||
if (!fwd && !reply) skipy += st::msgPadding.top();
|
||||
} else if (!reply) {
|
||||
fwdFrom = st::msgPadding.top();
|
||||
skipy += fwdFrom;
|
||||
}
|
||||
if (reply) {
|
||||
skipy += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom();
|
||||
reply->drawReplyTo(p, st::msgReplyPadding.left(), replyFrom, width - st::msgReplyPadding.left() - st::msgReplyPadding.right(), selected);
|
||||
} else if (fwd) {
|
||||
skipy += st::msgServiceNameFont->height + st::msgPadding.top();
|
||||
fwd->drawForwardedFrom(p, st::mediaPadding.left(), fwdFrom, width - st::mediaPadding.left() - st::mediaPadding.right(), selected);
|
||||
}
|
||||
reply->drawReplyTo(p, st::msgReplyPadding.left(), replyFrom, width - st::msgReplyPadding.left() - st::msgReplyPadding.right(), selected);
|
||||
|
||||
width -= st::mediaPadding.left() + st::mediaPadding.right();
|
||||
|
||||
if (!_title.isEmpty()) {
|
||||
p.setPen(st::black->p);
|
||||
_title.drawElided(p, st::mediaPadding.left(), skipy, width, 2);
|
||||
skipy += qMin(_title.countHeight(width), 2 * st::webPageTitleFont->height);
|
||||
}
|
||||
if (!_description.isEmpty()) {
|
||||
p.setPen(st::black->p);
|
||||
_description.drawElided(p, st::mediaPadding.left(), skipy, width, 3);
|
||||
skipy += qMin(_description.countHeight(width), 3 * st::webPageDescriptionFont->height);
|
||||
}
|
||||
if (!_title.isEmpty() || !_description.isEmpty()) {
|
||||
skipy += st::webPagePhotoSkip;
|
||||
}
|
||||
height -= skipy + st::mediaPadding.bottom();
|
||||
}
|
||||
|
||||
@ -4112,7 +4300,7 @@ void HistoryImageLink::draw(QPainter &p, const HistoryItem *parent, bool selecte
|
||||
// date
|
||||
QString time(parent->time());
|
||||
if (time.isEmpty()) return;
|
||||
int32 dateX = skipx + width - parent->timeWidth() - st::msgDateImgDelta - 2 * st::msgDateImgPadding.x();
|
||||
int32 dateX = skipx + width - parent->timeWidth(false) - st::msgDateImgDelta - 2 * st::msgDateImgPadding.x();
|
||||
int32 dateY = skipy + height - st::msgDateFont->height - 2 * st::msgDateImgPadding.y() - st::msgDateImgDelta;
|
||||
if (parent->out()) {
|
||||
dateX -= st::msgCheckRect.pxWidth() + st::msgDateImgCheckSpace;
|
||||
@ -4145,9 +4333,10 @@ void HistoryImageLink::draw(QPainter &p, const HistoryItem *parent, bool selecte
|
||||
|
||||
int32 HistoryImageLink::resize(int32 width, bool dontRecountText, const HistoryItem *parent) {
|
||||
const HistoryReply *reply = toHistoryReply(parent);
|
||||
const HistoryForwarded *fwd = toHistoryForwarded(parent);
|
||||
|
||||
w = qMin(width, _maxw);
|
||||
if (reply) {
|
||||
if (reply || !_title.isEmpty() || !_description.isEmpty()) {
|
||||
w -= st::mediaPadding.left() + st::mediaPadding.right();
|
||||
}
|
||||
|
||||
@ -4172,12 +4361,31 @@ int32 HistoryImageLink::resize(int32 width, bool dontRecountText, const HistoryI
|
||||
if (_height < st::minPhotoSize) {
|
||||
_height = st::minPhotoSize;
|
||||
}
|
||||
if (reply) {
|
||||
w += st::mediaPadding.left() + st::mediaPadding.right();
|
||||
_height += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom() + st::mediaPadding.top() + st::mediaPadding.bottom();
|
||||
if (reply || !_title.isEmpty() || !_description.isEmpty()) {
|
||||
if (!parent->out() && parent->history()->peer->chat) {
|
||||
_height += st::msgPadding.top() + st::msgNameFont->height;
|
||||
}
|
||||
if (reply) {
|
||||
_height += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom();
|
||||
} else {
|
||||
if (parent->out() || !parent->history()->peer->chat || !fwd) {
|
||||
_height += st::msgPadding.top();
|
||||
}
|
||||
if (fwd) {
|
||||
_height += st::msgServiceNameFont->height + st::msgPadding.top();
|
||||
}
|
||||
}
|
||||
if (!_title.isEmpty()) {
|
||||
_height += qMin(_title.countHeight(w), st::webPageTitleFont->height * 2);
|
||||
}
|
||||
if (!_description.isEmpty()) {
|
||||
_height += qMin(_description.countHeight(w), st::webPageDescriptionFont->height * 3);
|
||||
}
|
||||
if (!_title.isEmpty() || !_description.isEmpty()) {
|
||||
_height += st::webPagePhotoSkip;
|
||||
}
|
||||
_height += st::mediaPadding.bottom();
|
||||
w += st::mediaPadding.left() + st::mediaPadding.right();
|
||||
}
|
||||
return _height;
|
||||
}
|
||||
@ -4214,23 +4422,40 @@ bool HistoryImageLink::hasPoint(int32 x, int32 y, const HistoryItem *parent, int
|
||||
void HistoryImageLink::getState(TextLinkPtr &lnk, bool &inText, int32 x, int32 y, const HistoryItem *parent, int32 width) const {
|
||||
if (width < 0) width = w;
|
||||
int skipx = 0, skipy = 0, height = _height;
|
||||
if (const HistoryReply *reply = toHistoryReply(parent)) {
|
||||
const HistoryReply *reply = toHistoryReply(parent);
|
||||
const HistoryForwarded *fwd = reply ? 0 : toHistoryForwarded(parent);
|
||||
int replyFrom = 0, fwdFrom = 0;
|
||||
if (reply || !_title.isEmpty() || !_description.isEmpty()) {
|
||||
skipx = st::mediaPadding.left();
|
||||
skipy = st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom() + st::mediaPadding.top();
|
||||
height -= st::mediaPadding.bottom();
|
||||
int replyFrom = 0;
|
||||
if (reply) {
|
||||
skipy = st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom();
|
||||
} if (fwd) {
|
||||
skipy = st::msgServiceNameFont->height + st::msgPadding.top();
|
||||
}
|
||||
if (!parent->out() && parent->history()->peer->chat) {
|
||||
replyFrom = st::msgPadding.top() + st::msgNameFont->height;
|
||||
fwdFrom = st::msgPadding.top() + st::msgNameFont->height;
|
||||
skipy += replyFrom;
|
||||
if (x >= st::mediaPadding.left() && y >= st::msgPadding.top() && x < width - st::mediaPadding.left() - st::mediaPadding.right() && x < st::mediaPadding.left() + parent->from()->nameText.maxWidth() && y < replyFrom) {
|
||||
lnk = parent->from()->lnk;
|
||||
return;
|
||||
}
|
||||
if (!fwd && !reply) skipy += st::msgPadding.top();
|
||||
} else if (!reply) {
|
||||
fwdFrom = st::msgPadding.top();
|
||||
skipy += fwdFrom;
|
||||
}
|
||||
if (x >= 0 && y >= replyFrom + st::msgReplyPadding.top() && x < width && y < skipy - st::msgReplyPadding.bottom() - st::mediaPadding.top()) {
|
||||
lnk = reply->replyToLink();
|
||||
return;
|
||||
if (reply) {
|
||||
if (x >= 0 && y >= replyFrom + st::msgReplyPadding.top() && x < width && y < skipy - st::msgReplyPadding.bottom()) {
|
||||
lnk = reply->replyToLink();
|
||||
return;
|
||||
}
|
||||
} else if (fwd) {
|
||||
if (y >= fwdFrom && y < fwdFrom + st::msgServiceNameFont->height) {
|
||||
return fwd->getForwardedState(lnk, inText, x - st::mediaPadding.left(), width - st::mediaPadding.left() - st::mediaPadding.right());
|
||||
}
|
||||
}
|
||||
height -= st::mediaPadding.bottom();
|
||||
width -= st::mediaPadding.left() + st::mediaPadding.right();
|
||||
}
|
||||
if (x >= skipx && y >= skipy && x < skipx + width && y < height && data) {
|
||||
@ -4251,6 +4476,7 @@ HistoryMessage::HistoryMessage(History *history, HistoryBlock *block, const MTPD
|
||||
, _media(0)
|
||||
{
|
||||
QString text(textClean(qs(msg.vmessage)));
|
||||
initTime();
|
||||
initMedia(msg.vmedia, text);
|
||||
initDimensions(text);
|
||||
}
|
||||
@ -4263,6 +4489,7 @@ HistoryItem(history, block, msgId, flags, date, from)
|
||||
, _media(0)
|
||||
{
|
||||
QString text(msg);
|
||||
initTime();
|
||||
initMedia(media, text);
|
||||
initDimensions(text);
|
||||
}
|
||||
@ -4274,6 +4501,7 @@ HistoryItem(history, block, msgId, flags, date, from)
|
||||
, _textHeight(0)
|
||||
, _media(0)
|
||||
{
|
||||
initTime();
|
||||
if (fromMedia) {
|
||||
_media = fromMedia->clone();
|
||||
_media->regItem(this);
|
||||
@ -4288,10 +4516,16 @@ HistoryItem(history, block, msgId, flags, date, from)
|
||||
, _textHeight(0)
|
||||
, _media(0)
|
||||
{
|
||||
initTime();
|
||||
initMediaFromDocument(doc);
|
||||
initDimensions(QString());
|
||||
}
|
||||
|
||||
void HistoryMessage::initTime() {
|
||||
_time = date.toString(cTimeFormat());
|
||||
_timeWidth = st::msgDateFont->m.width(_time);
|
||||
}
|
||||
|
||||
void HistoryMessage::initMedia(const MTPMessageMedia &media, QString ¤tText) {
|
||||
switch (media.type()) {
|
||||
case mtpc_messageMediaEmpty: initMediaFromText(currentText); break;
|
||||
@ -4306,16 +4540,23 @@ void HistoryMessage::initMedia(const MTPMessageMedia &media, QString ¤tTex
|
||||
_media = new HistoryImageLink(qsl("location:%1,%2").arg(d.vlat.v).arg(d.vlong.v));
|
||||
}
|
||||
} break;
|
||||
case mtpc_messageMediaVenue: {
|
||||
const MTPDmessageMediaVenue &d(media.c_messageMediaVenue());
|
||||
if (d.vgeo.type() == mtpc_geoPoint) {
|
||||
const MTPDgeoPoint &g(d.vgeo.c_geoPoint());
|
||||
_media = new HistoryImageLink(qsl("location:%1,%2").arg(g.vlat.v).arg(g.vlong.v), qs(d.vtitle), qs(d.vaddress));
|
||||
}
|
||||
} break;
|
||||
case mtpc_messageMediaPhoto: {
|
||||
const MTPPhoto &photo(media.c_messageMediaPhoto().vphoto);
|
||||
if (photo.type() == mtpc_photo) {
|
||||
_media = new HistoryPhoto(photo.c_photo());
|
||||
const MTPDmessageMediaPhoto &photo(media.c_messageMediaPhoto());
|
||||
if (photo.vphoto.type() == mtpc_photo) {
|
||||
_media = new HistoryPhoto(photo.vphoto.c_photo(), qs(photo.vcaption), this);
|
||||
}
|
||||
} break;
|
||||
case mtpc_messageMediaVideo: {
|
||||
const MTPVideo &video(media.c_messageMediaVideo().vvideo);
|
||||
if (video.type() == mtpc_video) {
|
||||
_media = new HistoryVideo(video.c_video());
|
||||
const MTPDmessageMediaVideo &video(media.c_messageMediaVideo());
|
||||
if (video.vvideo.type() == mtpc_video) {
|
||||
_media = new HistoryVideo(video.vvideo.c_video(), qs(video.vcaption), this);
|
||||
}
|
||||
} break;
|
||||
case mtpc_messageMediaAudio: {
|
||||
@ -4368,14 +4609,11 @@ void HistoryMessage::initMediaFromDocument(DocumentData *doc) {
|
||||
}
|
||||
|
||||
void HistoryMessage::initDimensions(const QString &text) {
|
||||
_time = date.toString(cTimeFormat());
|
||||
_timeWidth = st::msgDateFont->m.width(_time);
|
||||
if (!_media || !text.isEmpty()) { // !justMedia()
|
||||
_timeWidth += st::msgDateSpace + (out() ? st::msgDateCheckSpace + st::msgCheckRect.pxWidth() : 0) - st::msgDateDelta.x();
|
||||
if (_media) {
|
||||
_text.setText(st::msgFont, text, _historyTextOptions);
|
||||
} else {
|
||||
_text.setText(st::msgFont, text + textcmdSkipBlock(_timeWidth, st::msgDateFont->height - st::msgDateDelta.y()), _historyTextOptions);
|
||||
_text.setText(st::msgFont, text + textcmdSkipBlock(timeWidth(true), st::msgDateFont->height - st::msgDateDelta.y()), _historyTextOptions);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4430,17 +4668,17 @@ HistoryMedia *HistoryMessage::getMedia(bool inOverview) const {
|
||||
|
||||
void HistoryMessage::setMedia(const MTPmessageMedia &media) {
|
||||
if ((!_media || _media->isImageLink()) && media.type() == mtpc_messageMediaEmpty) return;
|
||||
bool wasMedia = false;
|
||||
if (_media) {
|
||||
wasMedia = true;
|
||||
delete _media;
|
||||
_media = 0;
|
||||
}
|
||||
QString t;
|
||||
initMedia(media, t);
|
||||
if (_media) {
|
||||
if (_media && !wasMedia) {
|
||||
QString was = HistoryMessage::selectedText(FullItemSel);
|
||||
if (was.isEmpty()) {
|
||||
_timeWidth -= st::msgDateSpace + (out() ? st::msgDateCheckSpace + st::msgCheckRect.pxWidth() : 0) - st::msgDateDelta.x();
|
||||
} else {
|
||||
if (!was.isEmpty()) {
|
||||
_text.setText(st::msgFont, was, _historyTextOptions); // without date skip
|
||||
_textWidth = 0;
|
||||
_textHeight = 0;
|
||||
@ -4528,7 +4766,7 @@ void HistoryMessage::draw(QPainter &p, uint32 selection) const {
|
||||
style::color date(selected ? (out() ? st::msgOutSelectDateColor : st::msgInSelectDateColor) : (out() ? st::msgOutDateColor : st::msgInDateColor));
|
||||
p.setPen(date->p);
|
||||
|
||||
p.drawText(r.right() - st::msgPadding.right() + st::msgDateDelta.x() - _timeWidth + st::msgDateSpace, r.bottom() - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgDateFont->descent, _time);
|
||||
p.drawText(r.right() - st::msgPadding.right() + st::msgDateDelta.x() - timeWidth(true) + st::msgDateSpace, r.bottom() - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgDateFont->descent, _time);
|
||||
if (out()) {
|
||||
QPoint iconPos(r.right() + st::msgCheckPos.x() - st::msgPadding.right() - st::msgCheckRect.pxWidth(), r.bottom() + st::msgCheckPos.y() - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgCheckRect.pxHeight());
|
||||
const QRect *iconRect;
|
||||
@ -4758,7 +4996,7 @@ HistoryForwarded::HistoryForwarded(History *history, HistoryBlock *block, const
|
||||
fwdNameUpdated();
|
||||
}
|
||||
|
||||
HistoryForwarded::HistoryForwarded(History *history, HistoryBlock *block, MsgId id, HistoryMessage *msg) : HistoryMessage(history, block, id, (history->peer->input.type() != mtpc_inputPeerSelf) ? (MTPDmessage_flag_out | MTPDmessage_flag_unread) : 0, ::date(unixtime()), MTP::authedId(), msg->justMedia() ? QString() : msg->HistoryMessage::selectedText(FullItemSel), msg->getMedia())
|
||||
HistoryForwarded::HistoryForwarded(History *history, HistoryBlock *block, MsgId id, HistoryMessage *msg) : HistoryMessage(history, block, id, ((history->peer->input.type() != mtpc_inputPeerSelf) ? (MTPDmessage_flag_out | MTPDmessage_flag_unread) : 0) | (msg->getMedia() && (msg->getMedia()->type() == MediaTypeAudio/* || msg->getMedia()->type() == MediaTypeVideo*/) ? MTPDmessage_flag_media_unread : 0), ::date(unixtime()), MTP::authedId(), msg->justMedia() ? QString() : msg->HistoryMessage::selectedText(FullItemSel), msg->getMedia())
|
||||
, fwdDate(msg->dateForwarded())
|
||||
, fwdFrom(msg->fromForwarded())
|
||||
, fwdFromVersion(fwdFrom->nameVersion)
|
||||
@ -5264,6 +5502,17 @@ void HistoryServiceMsg::setMessageByAction(const MTPmessageAction &action) {
|
||||
}
|
||||
} break;
|
||||
|
||||
case mtpc_messageActionChatJoinedByLink: {
|
||||
const MTPDmessageActionChatJoinedByLink &d(action.c_messageActionChatJoinedByLink());
|
||||
if (true || App::peerFromUser(d.vinviter_id) == _from->id) {
|
||||
text = lng_action_user_joined_by_link(lt_from, from);
|
||||
//} else {
|
||||
//UserData *u = App::user(App::peerFromUser(d.vinviter_id));
|
||||
//second = TextLinkPtr(new PeerLink(u));
|
||||
//text = lng_action_user_joined_by_link_from(lt_from, from, lt_inviter, textcmdLink(2, u->name));
|
||||
}
|
||||
} break;
|
||||
|
||||
case mtpc_messageActionChatCreate: {
|
||||
const MTPDmessageActionChatCreate &d(action.c_messageActionChatCreate());
|
||||
text = lng_action_created_chat(lt_from, from, lt_title, textClean(qs(d.vtitle)));
|
||||
|
@ -670,6 +670,12 @@ public:
|
||||
bool notifyByFrom() const {
|
||||
return _flags & MTPDmessage_flag_notify_by_from;
|
||||
}
|
||||
bool isMediaUnread() const {
|
||||
return _flags & MTPDmessage_flag_media_unread;
|
||||
}
|
||||
void markMediaRead() {
|
||||
_flags &= ~MTPDmessage_flag_media_unread;
|
||||
}
|
||||
virtual bool needCheck() const {
|
||||
return true;
|
||||
}
|
||||
@ -727,7 +733,7 @@ public:
|
||||
virtual QString time() const {
|
||||
return QString();
|
||||
}
|
||||
virtual int32 timeWidth() const {
|
||||
virtual int32 timeWidth(bool forText) const {
|
||||
return 0;
|
||||
}
|
||||
virtual bool animating() const {
|
||||
@ -851,7 +857,7 @@ protected:
|
||||
class HistoryPhoto : public HistoryMedia {
|
||||
public:
|
||||
|
||||
HistoryPhoto(const MTPDphoto &photo);
|
||||
HistoryPhoto(const MTPDphoto &photo, const QString &caption, HistoryItem *parent);
|
||||
HistoryPhoto(PeerData *chat, const MTPDphoto &photo, int32 width = 0);
|
||||
|
||||
void init();
|
||||
@ -891,6 +897,7 @@ public:
|
||||
private:
|
||||
int16 pixw, pixh;
|
||||
PhotoData *data;
|
||||
Text _caption;
|
||||
TextLinkPtr openl;
|
||||
|
||||
};
|
||||
@ -900,7 +907,7 @@ QString formatSizeText(qint64 size);
|
||||
class HistoryVideo : public HistoryMedia {
|
||||
public:
|
||||
|
||||
HistoryVideo(const MTPDvideo &video);
|
||||
HistoryVideo(const MTPDvideo &video, const QString &caption, HistoryItem *parent);
|
||||
void initDimensions(const HistoryItem *parent);
|
||||
|
||||
void draw(QPainter &p, const HistoryItem *parent, bool selected, int32 width = -1) const;
|
||||
@ -928,6 +935,8 @@ private:
|
||||
VideoData *data;
|
||||
TextLinkPtr _openl, _savel, _cancell;
|
||||
|
||||
Text _caption;
|
||||
|
||||
QString _size;
|
||||
int32 _thumbw, _thumbx, _thumby;
|
||||
|
||||
@ -1172,7 +1181,7 @@ private:
|
||||
class HistoryImageLink : public HistoryMedia {
|
||||
public:
|
||||
|
||||
HistoryImageLink(const QString &url);
|
||||
HistoryImageLink(const QString &url, const QString &title = QString(), const QString &description = QString());
|
||||
int32 fullWidth() const;
|
||||
int32 fullHeight() const;
|
||||
void initDimensions(const HistoryItem *parent);
|
||||
@ -1194,6 +1203,7 @@ public:
|
||||
|
||||
private:
|
||||
ImageLinkData *data;
|
||||
Text _title, _description;
|
||||
TextLinkPtr link;
|
||||
|
||||
};
|
||||
@ -1206,6 +1216,7 @@ public:
|
||||
HistoryMessage(History *history, HistoryBlock *block, MsgId msgId, int32 flags, QDateTime date, int32 from, const QString &msg, HistoryMedia *media);
|
||||
HistoryMessage(History *history, HistoryBlock *block, MsgId msgId, int32 flags, QDateTime date, int32 from, DocumentData *doc);
|
||||
|
||||
void initTime();
|
||||
void initMedia(const MTPMessageMedia &media, QString ¤tText);
|
||||
void initMediaFromText(QString ¤tText);
|
||||
void initMediaFromDocument(DocumentData *doc);
|
||||
@ -1247,8 +1258,8 @@ public:
|
||||
QString time() const {
|
||||
return _time;
|
||||
}
|
||||
int32 timeWidth() const {
|
||||
return _timeWidth;
|
||||
int32 timeWidth(bool forText) const {
|
||||
return _timeWidth + (forText ? (st::msgDateSpace + (out() ? st::msgDateCheckSpace + st::msgCheckRect.pxWidth() : 0) - st::msgDateDelta.x()) : 0);
|
||||
}
|
||||
virtual bool animating() const {
|
||||
return _media ? _media->animating() : false;
|
||||
|
@ -3214,7 +3214,7 @@ void HistoryWidget::confirmSendImage(const ReadyLocalMedia &img) {
|
||||
h->loadAround(0);
|
||||
int32 flags = (h->peer->input.type() == mtpc_inputPeerSelf) ? 0 : (MTPDmessage_flag_unread | MTPDmessage_flag_out); // unread, out
|
||||
if (img.replyTo) flags |= MTPDmessage::flag_reply_to_msg_id;
|
||||
h->addToBack(MTP_message(MTP_int(flags), MTP_int(newId), MTP_int(MTP::authedId()), App::peerToMTP(img.peer), MTPint(), MTPint(), MTP_int(img.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaPhoto(img.photo)));
|
||||
h->addToBack(MTP_message(MTP_int(flags), MTP_int(newId), MTP_int(MTP::authedId()), App::peerToMTP(img.peer), MTPint(), MTPint(), MTP_int(img.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaPhoto(img.photo, MTP_string(""))));
|
||||
} else if (img.type == ToPrepareDocument) {
|
||||
h->loadAround(0);
|
||||
int32 flags = (h->peer->input.type() == mtpc_inputPeerSelf) ? 0 : (MTPDmessage_flag_unread | MTPDmessage_flag_out); // unread, out
|
||||
@ -3250,7 +3250,7 @@ void HistoryWidget::onPhotoUploaded(MsgId newId, const MTPInputFile &file) {
|
||||
if (replyTo) {
|
||||
sendFlags |= MTPmessages_SendMedia::flag_reply_to_msg_id;
|
||||
}
|
||||
hist->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_int(sendFlags), item->history()->peer->input, MTP_int(replyTo), MTP_inputMediaUploadedPhoto(file), MTP_long(randomId)), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendPhotoFailed, randomId), 0, 0, hist->sendRequestId);
|
||||
hist->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_int(sendFlags), item->history()->peer->input, MTP_int(replyTo), MTP_inputMediaUploadedPhoto(file, MTP_string("")), MTP_long(randomId)), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendPhotoFailed, randomId), 0, 0, hist->sendRequestId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3424,6 +3424,7 @@ void HistoryWidget::updateListSize(int32 addToY, bool initial, bool loadedDown,
|
||||
|
||||
if (!isVisible()) {
|
||||
if (initial) _histInited = false;
|
||||
if (resizedItem) _list->recountHeight(true);
|
||||
return; // scrollTopMax etc are not working after recountHeight()
|
||||
}
|
||||
|
||||
@ -3745,6 +3746,7 @@ void HistoryWidget::gotPreview(QString links, const MTPMessageMedia &result, mtp
|
||||
_previewData = (data->id && data->pendingTill >= 0) ? data : 0;
|
||||
updatePreview();
|
||||
}
|
||||
if (App::main()) App::main()->webPagesUpdate();
|
||||
} else if (result.type() == mtpc_messageMediaEmpty) {
|
||||
_previewCache.insert(links, 0);
|
||||
if (links == _previewLinks && !_previewCancelled) {
|
||||
|
@ -178,7 +178,7 @@ void LocalImageLoaderPrivate::prepareImages() {
|
||||
}
|
||||
if (!filesize) filesize = jpeg.size();
|
||||
|
||||
photo = MTP_photo(MTP_long(id), MTP_long(0), MTP_int(user), MTP_int(unixtime()), MTP_string(""), MTP_geoPointEmpty(), MTP_vector<MTPPhotoSize>(photoSizes));
|
||||
photo = MTP_photo(MTP_long(id), MTP_long(0), MTP_int(user), MTP_int(unixtime()), MTP_geoPointEmpty(), MTP_vector<MTPPhotoSize>(photoSizes));
|
||||
|
||||
thumbId = id;
|
||||
} else if ((type == ToPrepareVideo || type == ToPrepareDocument) && !img.isNull()) {
|
||||
|
@ -376,6 +376,7 @@ _failDifferenceTimeout(1), _lastUpdateTime(0), _cachedX(0), _cachedY(0), _backgr
|
||||
connect(audioVoice(), SIGNAL(updated(AudioData*)), this, SLOT(audioPlayProgress(AudioData*)));
|
||||
connect(audioVoice(), SIGNAL(stopped(AudioData*)), this, SLOT(audioPlayProgress(AudioData*)));
|
||||
}
|
||||
connect(&_updateMutedTimer, SIGNAL(timeout()), this, SLOT(onUpdateMuted()));
|
||||
|
||||
_webPageUpdater.setSingleShot(true);
|
||||
connect(&_webPageUpdater, SIGNAL(timeout()), this, SLOT(webPagesUpdate()));
|
||||
@ -525,6 +526,9 @@ void MainWidget::webPageUpdated(WebPageData *data) {
|
||||
}
|
||||
|
||||
void MainWidget::webPagesUpdate() {
|
||||
if (_webPagesUpdated.isEmpty()) return;
|
||||
|
||||
_webPageUpdater.stop();
|
||||
const WebPageItems &items(App::webPageItems());
|
||||
for (QMap<WebPageId, bool>::const_iterator i = _webPagesUpdated.cbegin(), e = _webPagesUpdated.cend(); i != e; ++i) {
|
||||
WebPageItems::const_iterator j = items.constFind(App::webPage(i.key()));
|
||||
@ -538,6 +542,17 @@ void MainWidget::webPagesUpdate() {
|
||||
_webPagesUpdated.clear();
|
||||
}
|
||||
|
||||
void MainWidget::updateMutedIn(int32 seconds) {
|
||||
if (seconds > 86400) seconds = 86400;
|
||||
int32 ms = seconds * 1000;
|
||||
if (_updateMutedTimer.isActive() && _updateMutedTimer.remainingTime() <= ms) return;
|
||||
_updateMutedTimer.start(ms);
|
||||
}
|
||||
|
||||
void MainWidget::onUpdateMuted() {
|
||||
App::updateMuted();
|
||||
}
|
||||
|
||||
void MainWidget::onShareContact(const PeerId &peer, UserData *contact) {
|
||||
history.onShareContact(peer, contact);
|
||||
}
|
||||
@ -705,7 +720,7 @@ void MainWidget::deleteHistoryPart(PeerData *peer, const MTPmessages_AffectedHis
|
||||
}
|
||||
|
||||
void MainWidget::deleteMessages(const QVector<MTPint> &ids) {
|
||||
MTP::send(MTPmessages_DeleteMessages(MTP_vector<MTPint>(ids)), rpcDone(&MainWidget::msgsWereDeleted));
|
||||
MTP::send(MTPmessages_DeleteMessages(MTP_vector<MTPint>(ids)), rpcDone(&MainWidget::messagesAffected));
|
||||
}
|
||||
|
||||
void MainWidget::deletedContact(UserData *user, const MTPcontacts_Link &result) {
|
||||
@ -1277,7 +1292,7 @@ void MainWidget::partWasRead(PeerData *peer, const MTPmessages_AffectedHistory &
|
||||
}
|
||||
}
|
||||
|
||||
void MainWidget::msgsWereDeleted(const MTPmessages_AffectedMessages &result) {
|
||||
void MainWidget::messagesAffected(const MTPmessages_AffectedMessages &result) {
|
||||
const MTPDmessages_affectedMessages &d(result.c_messages_affectedMessages());
|
||||
updPtsUpdated(d.vpts.v, d.vpts_count.v);
|
||||
}
|
||||
@ -1449,6 +1464,38 @@ void MainWidget::documentLoadRetry() {
|
||||
if (document) document->save(failedFileName);
|
||||
}
|
||||
|
||||
void MainWidget::audioMarkRead(AudioData *data) {
|
||||
const AudioItems &items(App::audioItems());
|
||||
AudioItems::const_iterator i = items.constFind(data);
|
||||
if (i != items.cend()) {
|
||||
mediaMarkRead(i.value());
|
||||
}
|
||||
}
|
||||
|
||||
void MainWidget::videoMarkRead(VideoData *data) {
|
||||
const VideoItems &items(App::videoItems());
|
||||
VideoItems::const_iterator i = items.constFind(data);
|
||||
if (i != items.cend()) {
|
||||
mediaMarkRead(i.value());
|
||||
}
|
||||
}
|
||||
|
||||
void MainWidget::mediaMarkRead(const HistoryItemsMap &items) {
|
||||
QVector<MTPint> markedIds;
|
||||
markedIds.reserve(items.size());
|
||||
for (HistoryItemsMap::const_iterator j = items.cbegin(), e = items.cend(); j != e; ++j) {
|
||||
if (!j.key()->out() && j.key()->isMediaUnread()) {
|
||||
j.key()->markMediaRead();
|
||||
if (j.key()->id > 0) {
|
||||
markedIds.push_back(MTP_int(j.key()->id));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!markedIds.isEmpty()) {
|
||||
MTP::send(MTPmessages_ReadMessageContents(MTP_vector<MTPint>(markedIds)), rpcDone(&MainWidget::messagesAffected));
|
||||
}
|
||||
}
|
||||
|
||||
void MainWidget::onParentResize(const QSize &newSize) {
|
||||
resize(newSize);
|
||||
}
|
||||
@ -2300,7 +2347,7 @@ void MainWidget::gotDifference(const MTPupdates_Difference &diff) {
|
||||
|
||||
updInited = true;
|
||||
|
||||
MTP_LOG(0, ("getDifference { good - after a slice of difference was received }"));
|
||||
MTP_LOG(0, ("getDifference { good - after a slice of difference was received }%1").arg(cTestMode() ? " TESTMODE" : ""));
|
||||
getDifference();
|
||||
} break;
|
||||
case mtpc_updates_difference: {
|
||||
@ -2378,7 +2425,7 @@ bool MainWidget::failDifference(const RPCError &error) {
|
||||
void MainWidget::getDifferenceForce() {
|
||||
if (MTP::authedId()) {
|
||||
updInited = true;
|
||||
MTP_LOG(0, ("getDifference { force - after get difference failed }"));
|
||||
MTP_LOG(0, ("getDifference { force - after get difference failed }%1").arg(cTestMode() ? " TESTMODE" : ""));
|
||||
getDifference();
|
||||
}
|
||||
}
|
||||
@ -2444,6 +2491,7 @@ void MainWidget::openLocalUrl(const QString &url) {
|
||||
} else if (u.startsWith(QLatin1String("tg://join"), Qt::CaseInsensitive)) {
|
||||
QRegularExpressionMatch m = QRegularExpression(qsl("^tg://join/?\\?invite=([a-zA-Z0-9\\.\\_]+)$"), QRegularExpression::CaseInsensitiveOption).match(u);
|
||||
if (m.hasMatch()) {
|
||||
joinGroupByHash(m.captured(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2461,6 +2509,10 @@ void MainWidget::openUserByName(const QString &username, bool toProfile) {
|
||||
}
|
||||
}
|
||||
|
||||
void MainWidget::joinGroupByHash(const QString &hash) {
|
||||
MTP::send(MTPmessages_CheckChatInvite(MTP_string(hash)), rpcDone(&MainWidget::inviteCheckDone, hash), rpcFail(&MainWidget::inviteCheckFail));
|
||||
}
|
||||
|
||||
void MainWidget::usernameResolveDone(bool toProfile, const MTPUser &user) {
|
||||
App::wnd()->hideLayer();
|
||||
UserData *u = App::feedUsers(MTP_vector<MTPUser>(1, user));
|
||||
@ -2480,6 +2532,83 @@ bool MainWidget::usernameResolveFail(QString name, const RPCError &error) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void MainWidget::inviteCheckDone(QString hash, const MTPChatInvite &invite) {
|
||||
switch (invite.type()) {
|
||||
case mtpc_chatInvite: {
|
||||
const MTPDchatInvite &d(invite.c_chatInvite());
|
||||
ConfirmBox *box = new ConfirmBox(lng_group_invite_want_join(lt_title, qs(d.vtitle)), lang(lng_group_invite_join));
|
||||
_inviteHash = hash;
|
||||
connect(box, SIGNAL(confirmed()), this, SLOT(onInviteImport()));
|
||||
App::wnd()->showLayer(box);
|
||||
} break;
|
||||
|
||||
case mtpc_chatInviteAlready: {
|
||||
const MTPDchatInviteAlready &d(invite.c_chatInviteAlready());
|
||||
ChatData *chat = App::feedChats(MTP_vector<MTPChat>(1, d.vchat));
|
||||
if (chat) {
|
||||
if (chat->left) {
|
||||
ConfirmBox *box = new ConfirmBox(lng_group_invite_want_join(lt_title, chat->name), lang(lng_group_invite_join));
|
||||
_inviteHash = '/' + QString::number(chat->id);
|
||||
connect(box, SIGNAL(confirmed()), this, SLOT(onInviteImport()));
|
||||
App::wnd()->showLayer(box);
|
||||
} else {
|
||||
showPeer(chat->id, 0, false, true);
|
||||
}
|
||||
}
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
bool MainWidget::inviteCheckFail(const RPCError &error) {
|
||||
if (error.type().startsWith(qsl("FLOOD_WAIT_"))) return false;
|
||||
|
||||
if (error.code() == 400) {
|
||||
App::wnd()->showLayer(new ConfirmBox(lang(lng_group_invite_bad_link), true));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void MainWidget::onInviteImport() {
|
||||
if (_inviteHash.isEmpty()) return;
|
||||
if (_inviteHash.at(0) == '/') {
|
||||
PeerId peer = _inviteHash.midRef(1).toULongLong();
|
||||
MTP::send(MTPmessages_AddChatUser(MTP_int(peer & 0xFFFFFFFF), App::self()->inputUser, MTP_int(ForwardOnAdd)), rpcDone(&MainWidget::inviteImportDone), rpcFail(&MainWidget::inviteImportFail), 0, 5);
|
||||
} else {
|
||||
MTP::send(MTPmessages_ImportChatInvite(MTP_string(_inviteHash)), rpcDone(&MainWidget::inviteImportDone), rpcFail(&MainWidget::inviteImportFail));
|
||||
}
|
||||
}
|
||||
|
||||
void MainWidget::inviteImportDone(const MTPUpdates &updates) {
|
||||
App::main()->sentUpdatesReceived(updates);
|
||||
|
||||
App::wnd()->hideLayer();
|
||||
const QVector<MTPChat> *v = 0;
|
||||
switch (updates.type()) {
|
||||
case mtpc_updates: v = &updates.c_updates().vchats.c_vector().v; break;
|
||||
case mtpc_updatesCombined: v = &updates.c_updatesCombined().vchats.c_vector().v; break;
|
||||
case mtpc_updateShort: {
|
||||
} break;
|
||||
case mtpc_updateShortMessage: {
|
||||
} break;
|
||||
case mtpc_updateShortChatMessage: {
|
||||
} break;
|
||||
case mtpc_updatesTooLong: {
|
||||
} break;
|
||||
}
|
||||
if (v && !v->isEmpty() && v->front().type() == mtpc_chat) {
|
||||
App::main()->showPeer(App::peerFromChat(v->front().c_chat().vid.v));
|
||||
}
|
||||
}
|
||||
|
||||
bool MainWidget::inviteImportFail(const RPCError &error) {
|
||||
if (error.type().startsWith(qsl("FLOOD_WAIT_"))) return false;
|
||||
|
||||
if (error.code() == 400) {
|
||||
App::wnd()->showLayer(new ConfirmBox(lang(error.type() == qsl("USERS_TOO_MUCH") ? lng_group_invite_no_room : lng_group_invite_bad_link), true), App::wnd()->layerShown());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void MainWidget::startFull(const MTPVector<MTPUser> &users) {
|
||||
const QVector<MTPUser> &v(users.c_vector().v);
|
||||
if (v.isEmpty() || v[0].type() != mtpc_userSelf) { // wtf?..
|
||||
@ -2502,7 +2631,9 @@ void MainWidget::applyNotifySetting(const MTPNotifyPeer &peer, const MTPPeerNoti
|
||||
delete data->notify;
|
||||
}
|
||||
data->notify = EmptyNotifySettings;
|
||||
App::history(data->id)->setMute(false);
|
||||
App::unregMuted(data);
|
||||
History *h = App::history(data->id);
|
||||
h->setMute(false);
|
||||
}
|
||||
} break;
|
||||
}
|
||||
@ -2510,16 +2641,15 @@ void MainWidget::applyNotifySetting(const MTPNotifyPeer &peer, const MTPPeerNoti
|
||||
case mtpc_peerNotifySettings: {
|
||||
const MTPDpeerNotifySettings &d(settings.c_peerNotifySettings());
|
||||
NotifySettingsPtr setTo = UnknownNotifySettings;
|
||||
PeerId peerId = 0;
|
||||
PeerData *data = 0;
|
||||
switch (peer.type()) {
|
||||
case mtpc_notifyAll: setTo = globalNotifyAllPtr = &globalNotifyAll; break;
|
||||
case mtpc_notifyUsers: setTo = globalNotifyUsersPtr = &globalNotifyUsers; break;
|
||||
case mtpc_notifyChats: setTo = globalNotifyChatsPtr = &globalNotifyChats; break;
|
||||
case mtpc_notifyPeer: {
|
||||
PeerData *data = App::peerLoaded(App::peerFromMTP(peer.c_notifyPeer().vpeer));
|
||||
data = App::peerLoaded(App::peerFromMTP(peer.c_notifyPeer().vpeer));
|
||||
if (!data) break;
|
||||
|
||||
peerId = data->id;
|
||||
if (data->notify == UnknownNotifySettings || data->notify == EmptyNotifySettings) {
|
||||
data->notify = new NotifySettings();
|
||||
}
|
||||
@ -2532,11 +2662,13 @@ void MainWidget::applyNotifySetting(const MTPNotifyPeer &peer, const MTPPeerNoti
|
||||
setTo->sound = d.vsound.c_string().v;
|
||||
setTo->previews = d.vshow_previews.v;
|
||||
setTo->events = d.vevents_mask.v;
|
||||
if (peerId) {
|
||||
if (!history) history = App::history(peerId);
|
||||
if (isNotifyMuted(setTo)) {
|
||||
if (data) {
|
||||
if (!history) history = App::history(data->id);
|
||||
int32 changeIn = 0;
|
||||
if (isNotifyMuted(setTo, &changeIn)) {
|
||||
App::wnd()->notifyClear(history);
|
||||
history->setMute(true);
|
||||
App::regMuted(data, changeIn);
|
||||
} else {
|
||||
history->setMute(false);
|
||||
}
|
||||
@ -2577,18 +2709,24 @@ bool MainWidget::failNotifySetting(MTPInputNotifyPeer peer, const RPCError &erro
|
||||
|
||||
void MainWidget::updateNotifySetting(PeerData *peer, bool enabled) {
|
||||
updateNotifySettingPeers.insert(peer);
|
||||
int32 muteFor = 86400 * 365;
|
||||
if (peer->notify == EmptyNotifySettings) {
|
||||
if (!enabled) {
|
||||
peer->notify = new NotifySettings();
|
||||
peer->notify->sound = "";
|
||||
peer->notify->mute = unixtime() + 86400 * 365;
|
||||
peer->notify->mute = unixtime() + muteFor;
|
||||
}
|
||||
} else {
|
||||
if (peer->notify == UnknownNotifySettings) {
|
||||
peer->notify = new NotifySettings();
|
||||
}
|
||||
peer->notify->sound = enabled ? "default" : "";
|
||||
peer->notify->mute = enabled ? 0 : (unixtime() + 86400 * 365);
|
||||
peer->notify->mute = enabled ? 0 : (unixtime() + muteFor);
|
||||
}
|
||||
if (!enabled) {
|
||||
App::regMuted(peer, muteFor + 1);
|
||||
} else {
|
||||
App::unregMuted(peer);
|
||||
}
|
||||
App::history(peer->id)->setMute(!enabled);
|
||||
updateNotifySettingTimer.start(NotifySettingSaveTimeout);
|
||||
@ -2760,7 +2898,7 @@ void MainWidget::updateReceived(const mtpPrime *from, const mtpPrime *end) {
|
||||
if (mtpTypeId(*from) == mtpc_new_session_created) {
|
||||
MTPNewSession newSession(from, end);
|
||||
updSeq = 0;
|
||||
MTP_LOG(0, ("getDifference { after new_session_created }"));
|
||||
MTP_LOG(0, ("getDifference { after new_session_created }%1").arg(cTestMode() ? " TESTMODE" : ""));
|
||||
return getDifference();
|
||||
} else {
|
||||
try {
|
||||
@ -2823,7 +2961,7 @@ void MainWidget::handleUpdates(const MTPUpdates &updates) {
|
||||
case mtpc_updateShortMessage: {
|
||||
const MTPDupdateShortMessage &d(updates.c_updateShortMessage());
|
||||
if (!App::userLoaded(d.vuser_id.v) || (d.has_fwd_from_id() && !App::userLoaded(d.vfwd_from_id.v))) {
|
||||
MTP_LOG(0, ("getDifference { good - getting user for updateShortMessage }"));
|
||||
MTP_LOG(0, ("getDifference { good - getting user for updateShortMessage }%1").arg(cTestMode() ? " TESTMODE" : ""));
|
||||
return getDifference();
|
||||
}
|
||||
if (!updPtsUpdated(d.vpts.v, d.vpts_count.v)) {
|
||||
@ -2842,7 +2980,7 @@ void MainWidget::handleUpdates(const MTPUpdates &updates) {
|
||||
case mtpc_updateShortChatMessage: {
|
||||
const MTPDupdateShortChatMessage &d(updates.c_updateShortChatMessage());
|
||||
if (!App::chatLoaded(d.vchat_id.v) || !App::userLoaded(d.vfrom_id.v) || (d.has_fwd_from_id() && !App::userLoaded(d.vfwd_from_id.v))) {
|
||||
MTP_LOG(0, ("getDifference { good - getting user for updateShortChatMessage }"));
|
||||
MTP_LOG(0, ("getDifference { good - getting user for updateShortChatMessage }%1").arg(cTestMode() ? " TESTMODE" : ""));
|
||||
return getDifference();
|
||||
}
|
||||
if (!updPtsUpdated(d.vpts.v, d.vpts_count.v)) {
|
||||
@ -2858,7 +2996,7 @@ void MainWidget::handleUpdates(const MTPUpdates &updates) {
|
||||
} break;
|
||||
|
||||
case mtpc_updatesTooLong: {
|
||||
MTP_LOG(0, ("getDifference { good - updatesTooLong received }"));
|
||||
MTP_LOG(0, ("getDifference { good - updatesTooLong received }%1").arg(cTestMode() ? " TESTMODE" : ""));
|
||||
return getDifference();
|
||||
} break;
|
||||
}
|
||||
@ -2916,13 +3054,21 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
|
||||
}
|
||||
} break;
|
||||
|
||||
case mtpc_updateReadMessages: {
|
||||
const MTPDupdateReadMessages &d(update.c_updateReadMessages());
|
||||
case mtpc_updateReadMessagesContents: {
|
||||
const MTPDupdateReadMessagesContents &d(update.c_updateReadMessagesContents());
|
||||
if (!updPtsUpdated(d.vpts.v, d.vpts_count.v)) {
|
||||
_byPtsUpdate.insert(ptsKey(SkippedUpdate), update);
|
||||
return;
|
||||
}
|
||||
App::feedWereRead(d.vmessages.c_vector().v);
|
||||
const QVector<MTPint> &v(d.vmessages.c_vector().v);
|
||||
for (int32 i = 0, l = v.size(); i < l; ++i) {
|
||||
if (HistoryItem *item = App::histItemById(v.at(i).v)) {
|
||||
if (item->isMediaUnread()) {
|
||||
item->markMediaRead();
|
||||
msgUpdated(item->history()->peer->id, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
||||
case mtpc_updateReadHistoryInbox: {
|
||||
@ -2949,6 +3095,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
|
||||
const MTPDupdateWebPage &d(update.c_updateWebPage());
|
||||
App::feedWebPage(d.vwebpage);
|
||||
history.updatePreview();
|
||||
webPagesUpdate();
|
||||
} break;
|
||||
|
||||
case mtpc_updateDeleteMessages: {
|
||||
|
@ -187,6 +187,7 @@ public:
|
||||
void start(const MTPUser &user);
|
||||
void openLocalUrl(const QString &str);
|
||||
void openUserByName(const QString &name, bool toProfile = false);
|
||||
void joinGroupByHash(const QString &hash);
|
||||
void startFull(const MTPVector<MTPUser> &users);
|
||||
bool started();
|
||||
void applyNotifySetting(const MTPNotifyPeer &peer, const MTPPeerNotifySettings &settings, History *history = 0);
|
||||
@ -333,7 +334,12 @@ public:
|
||||
void cancelForwarding();
|
||||
void finishForwarding(History *hist); // send them
|
||||
|
||||
void audioMarkRead(AudioData *data);
|
||||
void videoMarkRead(VideoData *data);
|
||||
void mediaMarkRead(const HistoryItemsMap &items);
|
||||
|
||||
void webPageUpdated(WebPageData *page);
|
||||
void updateMutedIn(int32 seconds);
|
||||
|
||||
~MainWidget();
|
||||
|
||||
@ -392,10 +398,14 @@ public slots:
|
||||
|
||||
void onCacheBackground();
|
||||
|
||||
void onInviteImport();
|
||||
|
||||
void onUpdateMuted();
|
||||
|
||||
private:
|
||||
|
||||
void partWasRead(PeerData *peer, const MTPmessages_AffectedHistory &result);
|
||||
void msgsWereDeleted(const MTPmessages_AffectedMessages &result);
|
||||
void messagesAffected(const MTPmessages_AffectedMessages &result);
|
||||
void photosLoaded(History *h, const MTPmessages_Messages &msgs, mtpRequestId req);
|
||||
|
||||
bool _started;
|
||||
@ -413,6 +423,8 @@ private:
|
||||
QMap<WebPageId, bool> _webPagesUpdated;
|
||||
QTimer _webPageUpdater;
|
||||
|
||||
SingleTimer _updateMutedTimer;
|
||||
|
||||
void gotDifference(const MTPupdates_Difference &diff);
|
||||
bool failDifference(const RPCError &e);
|
||||
void feedDifference(const MTPVector<MTPUser> &users, const MTPVector<MTPChat> &chats, const MTPVector<MTPMessage> &msgs, const MTPVector<MTPUpdate> &other);
|
||||
@ -430,6 +442,12 @@ private:
|
||||
void usernameResolveDone(bool toProfile, const MTPUser &user);
|
||||
bool usernameResolveFail(QString name, const RPCError &error);
|
||||
|
||||
void inviteCheckDone(QString hash, const MTPChatInvite &invite);
|
||||
bool inviteCheckFail(const RPCError &error);
|
||||
QString _inviteHash;
|
||||
void inviteImportDone(const MTPUpdates &result);
|
||||
bool inviteImportFail(const RPCError &error);
|
||||
|
||||
void hideAll();
|
||||
void showAll();
|
||||
|
||||
|
@ -24,6 +24,7 @@ enum {
|
||||
MTPDmessage_flag_unread = (1 << 0),
|
||||
MTPDmessage_flag_out = (1 << 1),
|
||||
MTPDmessage_flag_notify_by_from = (1 << 4),
|
||||
MTPDmessage_flag_media_unread = (1 << 5),
|
||||
MTPmessages_SendMessage_flag_skipWebPage = (1 << 1),
|
||||
};
|
||||
|
||||
|
@ -366,7 +366,7 @@ static const mtpTypeId mtpLayers[] = {
|
||||
mtpc_invokeWithLayer17,
|
||||
mtpc_invokeWithLayer18,
|
||||
}, mtpLayerMaxSingle = sizeof(mtpLayers) / sizeof(mtpLayers[0]);
|
||||
static const mtpPrime mtpCurrentLayer = 27;
|
||||
static const mtpPrime mtpCurrentLayer = 28;
|
||||
|
||||
template <typename bareT>
|
||||
class MTPBoxed : public bareT {
|
||||
|
@ -622,6 +622,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
}
|
||||
switch (stage) {
|
||||
case 0: to.add(" file: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 1: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
@ -635,6 +636,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
}
|
||||
switch (stage) {
|
||||
case 0: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 1: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
@ -679,7 +681,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
case 1: to.add(" duration: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 2: to.add(" w: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 3: to.add(" h: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 4: to.add(" mime_type: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 4: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
@ -697,7 +699,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
case 2: to.add(" duration: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 3: to.add(" w: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 4: to.add(" h: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 5: to.add(" mime_type: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 5: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
@ -711,6 +713,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
}
|
||||
switch (stage) {
|
||||
case 0: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 1: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
@ -787,6 +790,23 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
}
|
||||
break;
|
||||
|
||||
case mtpc_inputMediaVenue:
|
||||
if (stage) {
|
||||
to.add(",\n").addSpaces(lev);
|
||||
} else {
|
||||
to.add("{ inputMediaVenue");
|
||||
to.add("\n").addSpaces(lev);
|
||||
}
|
||||
switch (stage) {
|
||||
case 0: to.add(" geo_point: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 1: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 2: to.add(" address: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 3: to.add(" provider: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 4: to.add(" venue_id: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
|
||||
case mtpc_inputChatPhotoEmpty:
|
||||
to.add("{ inputChatPhotoEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back();
|
||||
break;
|
||||
@ -1326,6 +1346,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
case 1: to.add(" participants: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 2: to.add(" chat_photo: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 3: to.add(" notify_settings: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 4: to.add(" exported_invite: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
@ -1458,6 +1479,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
}
|
||||
switch (stage) {
|
||||
case 0: to.add(" photo: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 1: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
@ -1471,6 +1493,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
}
|
||||
switch (stage) {
|
||||
case 0: to.add(" video: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 1: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
@ -1547,6 +1570,23 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
}
|
||||
break;
|
||||
|
||||
case mtpc_messageMediaVenue:
|
||||
if (stage) {
|
||||
to.add(",\n").addSpaces(lev);
|
||||
} else {
|
||||
to.add("{ messageMediaVenue");
|
||||
to.add("\n").addSpaces(lev);
|
||||
}
|
||||
switch (stage) {
|
||||
case 0: to.add(" geo: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 1: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 2: to.add(" address: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 3: to.add(" provider: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 4: to.add(" venue_id: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
|
||||
case mtpc_messageActionEmpty:
|
||||
to.add("{ messageActionEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back();
|
||||
break;
|
||||
@ -1639,6 +1679,19 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
to.add("{ messageActionGeoChatCheckin }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back();
|
||||
break;
|
||||
|
||||
case mtpc_messageActionChatJoinedByLink:
|
||||
if (stage) {
|
||||
to.add(",\n").addSpaces(lev);
|
||||
} else {
|
||||
to.add("{ messageActionChatJoinedByLink");
|
||||
to.add("\n").addSpaces(lev);
|
||||
}
|
||||
switch (stage) {
|
||||
case 0: to.add(" inviter_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
|
||||
case mtpc_dialog:
|
||||
if (stage) {
|
||||
to.add(",\n").addSpaces(lev);
|
||||
@ -1681,9 +1734,8 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 2: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 3: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 4: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 5: to.add(" geo: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 6: to.add(" sizes: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 4: to.add(" geo: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 5: to.add(" sizes: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
@ -1760,14 +1812,12 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 2: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 3: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 4: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 5: to.add(" duration: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 6: to.add(" mime_type: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 7: to.add(" size: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 8: to.add(" thumb: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 9: to.add(" dc_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 10: to.add(" w: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 11: to.add(" h: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 4: to.add(" duration: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 5: to.add(" size: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 6: to.add(" thumb: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 7: to.add(" dc_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 8: to.add(" w: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 9: to.add(" h: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
@ -2383,21 +2433,6 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
}
|
||||
break;
|
||||
|
||||
case mtpc_updateReadMessages:
|
||||
if (stage) {
|
||||
to.add(",\n").addSpaces(lev);
|
||||
} else {
|
||||
to.add("{ updateReadMessages");
|
||||
to.add("\n").addSpaces(lev);
|
||||
}
|
||||
switch (stage) {
|
||||
case 0: to.add(" messages: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); stages.push_back(0); flags.push_back(0); break;
|
||||
case 1: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 2: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
|
||||
case mtpc_updateDeleteMessages:
|
||||
if (stage) {
|
||||
to.add(",\n").addSpaces(lev);
|
||||
@ -2776,6 +2811,21 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
}
|
||||
break;
|
||||
|
||||
case mtpc_updateReadMessagesContents:
|
||||
if (stage) {
|
||||
to.add(",\n").addSpaces(lev);
|
||||
} else {
|
||||
to.add("{ updateReadMessagesContents");
|
||||
to.add("\n").addSpaces(lev);
|
||||
}
|
||||
switch (stage) {
|
||||
case 0: to.add(" messages: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); stages.push_back(0); flags.push_back(0); break;
|
||||
case 1: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 2: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
|
||||
case mtpc_updates_state:
|
||||
if (stage) {
|
||||
to.add(",\n").addSpaces(lev);
|
||||
@ -3038,7 +3088,9 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
case 12: to.add(" notify_cloud_delay_ms: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 13: to.add(" notify_default_delay_ms: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 14: to.add(" chat_big_size: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 15: to.add(" disabled_features: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 15: to.add(" push_chat_period_ms: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 16: to.add(" push_chat_limit: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 17: to.add(" disabled_features: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
@ -3624,7 +3676,16 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
break;
|
||||
|
||||
case mtpc_sendMessageUploadVideoAction:
|
||||
to.add("{ sendMessageUploadVideoAction }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back();
|
||||
if (stage) {
|
||||
to.add(",\n").addSpaces(lev);
|
||||
} else {
|
||||
to.add("{ sendMessageUploadVideoAction");
|
||||
to.add("\n").addSpaces(lev);
|
||||
}
|
||||
switch (stage) {
|
||||
case 0: to.add(" progress: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
|
||||
case mtpc_sendMessageRecordAudioAction:
|
||||
@ -3632,15 +3693,42 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
break;
|
||||
|
||||
case mtpc_sendMessageUploadAudioAction:
|
||||
to.add("{ sendMessageUploadAudioAction }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back();
|
||||
if (stage) {
|
||||
to.add(",\n").addSpaces(lev);
|
||||
} else {
|
||||
to.add("{ sendMessageUploadAudioAction");
|
||||
to.add("\n").addSpaces(lev);
|
||||
}
|
||||
switch (stage) {
|
||||
case 0: to.add(" progress: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
|
||||
case mtpc_sendMessageUploadPhotoAction:
|
||||
to.add("{ sendMessageUploadPhotoAction }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back();
|
||||
if (stage) {
|
||||
to.add(",\n").addSpaces(lev);
|
||||
} else {
|
||||
to.add("{ sendMessageUploadPhotoAction");
|
||||
to.add("\n").addSpaces(lev);
|
||||
}
|
||||
switch (stage) {
|
||||
case 0: to.add(" progress: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
|
||||
case mtpc_sendMessageUploadDocumentAction:
|
||||
to.add("{ sendMessageUploadDocumentAction }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back();
|
||||
if (stage) {
|
||||
to.add(",\n").addSpaces(lev);
|
||||
} else {
|
||||
to.add("{ sendMessageUploadDocumentAction");
|
||||
to.add("\n").addSpaces(lev);
|
||||
}
|
||||
switch (stage) {
|
||||
case 0: to.add(" progress: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
|
||||
case mtpc_sendMessageGeoLocationAction:
|
||||
@ -4144,6 +4232,63 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
}
|
||||
break;
|
||||
|
||||
case mtpc_receivedNotifyMessage:
|
||||
if (stage) {
|
||||
to.add(",\n").addSpaces(lev);
|
||||
} else {
|
||||
to.add("{ receivedNotifyMessage");
|
||||
to.add("\n").addSpaces(lev);
|
||||
}
|
||||
switch (stage) {
|
||||
case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 1: to.add(" flags: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
|
||||
case mtpc_chatInviteEmpty:
|
||||
to.add("{ chatInviteEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back();
|
||||
break;
|
||||
|
||||
case mtpc_chatInviteExported:
|
||||
if (stage) {
|
||||
to.add(",\n").addSpaces(lev);
|
||||
} else {
|
||||
to.add("{ chatInviteExported");
|
||||
to.add("\n").addSpaces(lev);
|
||||
}
|
||||
switch (stage) {
|
||||
case 0: to.add(" link: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
|
||||
case mtpc_chatInviteAlready:
|
||||
if (stage) {
|
||||
to.add(",\n").addSpaces(lev);
|
||||
} else {
|
||||
to.add("{ chatInviteAlready");
|
||||
to.add("\n").addSpaces(lev);
|
||||
}
|
||||
switch (stage) {
|
||||
case 0: to.add(" chat: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
|
||||
case mtpc_chatInvite:
|
||||
if (stage) {
|
||||
to.add(",\n").addSpaces(lev);
|
||||
} else {
|
||||
to.add("{ chatInvite");
|
||||
to.add("\n").addSpaces(lev);
|
||||
}
|
||||
switch (stage) {
|
||||
case 0: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
|
||||
case mtpc_req_pq:
|
||||
if (stage) {
|
||||
to.add(",\n").addSpaces(lev);
|
||||
@ -4694,6 +4839,19 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
}
|
||||
break;
|
||||
|
||||
case mtpc_invokeWithoutUpdates:
|
||||
if (stage) {
|
||||
to.add(",\n").addSpaces(lev);
|
||||
} else {
|
||||
to.add("{ invokeWithoutUpdates");
|
||||
to.add("\n").addSpaces(lev);
|
||||
}
|
||||
switch (stage) {
|
||||
case 0: to.add(" query: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
|
||||
case mtpc_auth_checkPhone:
|
||||
if (stage) {
|
||||
to.add(",\n").addSpaces(lev);
|
||||
@ -4995,19 +5153,6 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
to.add("{ contacts_exportCard }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back();
|
||||
break;
|
||||
|
||||
case mtpc_messages_receivedMessages:
|
||||
if (stage) {
|
||||
to.add(",\n").addSpaces(lev);
|
||||
} else {
|
||||
to.add("{ messages_receivedMessages");
|
||||
to.add("\n").addSpaces(lev);
|
||||
}
|
||||
switch (stage) {
|
||||
case 0: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
|
||||
case mtpc_messages_getMessages:
|
||||
if (stage) {
|
||||
to.add(",\n").addSpaces(lev);
|
||||
@ -5127,6 +5272,19 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
}
|
||||
break;
|
||||
|
||||
case mtpc_messages_receivedMessages:
|
||||
if (stage) {
|
||||
to.add(",\n").addSpaces(lev);
|
||||
} else {
|
||||
to.add("{ messages_receivedMessages");
|
||||
to.add("\n").addSpaces(lev);
|
||||
}
|
||||
switch (stage) {
|
||||
case 0: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
|
||||
case mtpc_messages_sendMessage:
|
||||
if (stage) {
|
||||
to.add(",\n").addSpaces(lev);
|
||||
@ -5278,6 +5436,19 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
}
|
||||
break;
|
||||
|
||||
case mtpc_messages_importChatInvite:
|
||||
if (stage) {
|
||||
to.add(",\n").addSpaces(lev);
|
||||
} else {
|
||||
to.add("{ messages_importChatInvite");
|
||||
to.add("\n").addSpaces(lev);
|
||||
}
|
||||
switch (stage) {
|
||||
case 0: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
|
||||
case mtpc_messages_getChats:
|
||||
if (stage) {
|
||||
to.add(",\n").addSpaces(lev);
|
||||
@ -5830,6 +6001,32 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
||||
to.add("{ auth_requestPasswordRecovery }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back();
|
||||
break;
|
||||
|
||||
case mtpc_messages_exportChatInvite:
|
||||
if (stage) {
|
||||
to.add(",\n").addSpaces(lev);
|
||||
} else {
|
||||
to.add("{ messages_exportChatInvite");
|
||||
to.add("\n").addSpaces(lev);
|
||||
}
|
||||
switch (stage) {
|
||||
case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
|
||||
case mtpc_messages_checkChatInvite:
|
||||
if (stage) {
|
||||
to.add(",\n").addSpaces(lev);
|
||||
} else {
|
||||
to.add("{ messages_checkChatInvite");
|
||||
to.add("\n").addSpaces(lev);
|
||||
}
|
||||
switch (stage) {
|
||||
case 0: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
break;
|
||||
|
||||
case mtpc_rpc_result:
|
||||
if (stage) {
|
||||
to.add(",\n").addSpaces(lev);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -146,13 +146,13 @@ inputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_na
|
||||
inputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile;
|
||||
|
||||
inputMediaEmpty#9664f57f = InputMedia;
|
||||
inputMediaUploadedPhoto#2dc53a7d file:InputFile = InputMedia;
|
||||
inputMediaPhoto#8f2ab2ec id:InputPhoto = InputMedia;
|
||||
inputMediaUploadedPhoto#f7aff1c0 file:InputFile caption:string = InputMedia;
|
||||
inputMediaPhoto#e9bfb4f3 id:InputPhoto caption:string = InputMedia;
|
||||
inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia;
|
||||
inputMediaContact#a6e45987 phone_number:string first_name:string last_name:string = InputMedia;
|
||||
inputMediaUploadedVideo#133ad6f6 file:InputFile duration:int w:int h:int mime_type:string = InputMedia;
|
||||
inputMediaUploadedThumbVideo#9912dabf file:InputFile thumb:InputFile duration:int w:int h:int mime_type:string = InputMedia;
|
||||
inputMediaVideo#7f023ae6 id:InputVideo = InputMedia;
|
||||
inputMediaUploadedVideo#e13fd4bc file:InputFile duration:int w:int h:int caption:string = InputMedia;
|
||||
inputMediaUploadedThumbVideo#96fb97dc file:InputFile thumb:InputFile duration:int w:int h:int caption:string = InputMedia;
|
||||
inputMediaVideo#936a4ebd id:InputVideo caption:string = InputMedia;
|
||||
|
||||
inputChatPhotoEmpty#1ca48f57 = InputChatPhoto;
|
||||
inputChatUploadedPhoto#94254732 file:InputFile crop:InputPhotoCrop = InputChatPhoto;
|
||||
@ -210,7 +210,7 @@ chatEmpty#9ba2d800 id:int = Chat;
|
||||
chat#6e9c9bc7 id:int title:string photo:ChatPhoto participants_count:int date:int left:Bool version:int = Chat;
|
||||
chatForbidden#fb0ccc41 id:int title:string date:int = Chat;
|
||||
|
||||
chatFull#630e61be id:int participants:ChatParticipants chat_photo:Photo notify_settings:PeerNotifySettings = ChatFull;
|
||||
chatFull#cade0791 id:int participants:ChatParticipants chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite = ChatFull;
|
||||
|
||||
chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant;
|
||||
|
||||
@ -225,8 +225,8 @@ message#a7ab1991 flags:# id:int from_id:int to_id:Peer fwd_from_id:flags.2?int f
|
||||
messageService#1d86f70e flags:int id:int from_id:int to_id:Peer date:int action:MessageAction = Message;
|
||||
|
||||
messageMediaEmpty#3ded6320 = MessageMedia;
|
||||
messageMediaPhoto#c8c45a2a photo:Photo = MessageMedia;
|
||||
messageMediaVideo#a2d24290 video:Video = MessageMedia;
|
||||
messageMediaPhoto#3d8ce53d photo:Photo caption:string = MessageMedia;
|
||||
messageMediaVideo#5bcf1675 video:Video caption:string = MessageMedia;
|
||||
messageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia;
|
||||
messageMediaContact#5e7d2f39 phone_number:string first_name:string last_name:string user_id:int = MessageMedia;
|
||||
messageMediaUnsupported#9f84f49e = MessageMedia;
|
||||
@ -242,14 +242,14 @@ messageActionChatDeleteUser#b2ae9b0c user_id:int = MessageAction;
|
||||
dialog#c1dd804a peer:Peer top_message:int read_inbox_max_id:int unread_count:int notify_settings:PeerNotifySettings = Dialog;
|
||||
|
||||
photoEmpty#2331b22d id:long = Photo;
|
||||
photo#22b56751 id:long access_hash:long user_id:int date:int caption:string geo:GeoPoint sizes:Vector<PhotoSize> = Photo;
|
||||
photo#c3838076 id:long access_hash:long user_id:int date:int geo:GeoPoint sizes:Vector<PhotoSize> = Photo;
|
||||
|
||||
photoSizeEmpty#e17e23c type:string = PhotoSize;
|
||||
photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize;
|
||||
photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize;
|
||||
|
||||
videoEmpty#c10658a8 id:long = Video;
|
||||
video#388fa391 id:long access_hash:long user_id:int date:int caption:string duration:int mime_type:string size:int thumb:PhotoSize dc_id:int w:int h:int = Video;
|
||||
video#ee9f4a4d id:long access_hash:long user_id:int date:int duration:int size:int thumb:PhotoSize dc_id:int w:int h:int = Video;
|
||||
|
||||
geoPointEmpty#1117dd5f = GeoPoint;
|
||||
geoPoint#2049d70c long:double lat:double = GeoPoint;
|
||||
@ -332,7 +332,6 @@ inputMessagesFilterAudio#cfc87522 = MessagesFilter;
|
||||
|
||||
updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update;
|
||||
updateMessageID#4e90bfd6 id:int random_id:long = Update;
|
||||
updateReadMessages#2e5ab668 messages:Vector<int> pts:int pts_count:int = Update;
|
||||
updateDeleteMessages#a20db0e5 messages:Vector<int> pts:int pts_count:int = Update;
|
||||
updateUserTyping#5c486927 user_id:int action:SendMessageAction = Update;
|
||||
updateChatUserTyping#9a65ea1f chat_id:int user_id:int action:SendMessageAction = Update;
|
||||
@ -366,7 +365,7 @@ upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File;
|
||||
|
||||
dcOption#2ec2a43c id:int hostname:string ip_address:string port:int = DcOption;
|
||||
|
||||
config#68bac247 date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> chat_size_max:int broadcast_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int chat_big_size:int disabled_features:Vector<DisabledFeature> = Config;
|
||||
config#4e32b894 date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> chat_size_max:int broadcast_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int chat_big_size:int push_chat_period_ms:int push_chat_limit:int disabled_features:Vector<DisabledFeature> = Config;
|
||||
|
||||
nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc;
|
||||
|
||||
@ -479,11 +478,11 @@ auth.sentAppCode#e325edcf phone_registered:Bool phone_code_hash:string send_call
|
||||
sendMessageTypingAction#16bf744e = SendMessageAction;
|
||||
sendMessageCancelAction#fd5ec8f5 = SendMessageAction;
|
||||
sendMessageRecordVideoAction#a187d66f = SendMessageAction;
|
||||
sendMessageUploadVideoAction#92042ff7 = SendMessageAction;
|
||||
sendMessageUploadVideoAction#e9763aec progress:int = SendMessageAction;
|
||||
sendMessageRecordAudioAction#d52f73f7 = SendMessageAction;
|
||||
sendMessageUploadAudioAction#e6ac8a6f = SendMessageAction;
|
||||
sendMessageUploadPhotoAction#990a3c1a = SendMessageAction;
|
||||
sendMessageUploadDocumentAction#8faee98e = SendMessageAction;
|
||||
sendMessageUploadAudioAction#f351d7ab progress:int = SendMessageAction;
|
||||
sendMessageUploadPhotoAction#d1d34a26 progress:int = SendMessageAction;
|
||||
sendMessageUploadDocumentAction#aa0cd9e4 progress:int = SendMessageAction;
|
||||
sendMessageGeoLocationAction#176f8ba1 = SendMessageAction;
|
||||
sendMessageChooseContactAction#628cbc6f = SendMessageAction;
|
||||
|
||||
@ -573,6 +572,22 @@ account.passwordInputSettings#bcfc532c flags:# new_salt:flags.0?bytes new_passwo
|
||||
|
||||
auth.passwordRecovery#137948a5 email_pattern:string = auth.PasswordRecovery;
|
||||
|
||||
inputMediaVenue#2827a81a geo_point:InputGeoPoint title:string address:string provider:string venue_id:string = InputMedia;
|
||||
|
||||
messageMediaVenue#7912b71f geo:GeoPoint title:string address:string provider:string venue_id:string = MessageMedia;
|
||||
|
||||
receivedNotifyMessage#a384b779 id:int flags:int = ReceivedNotifyMessage;
|
||||
|
||||
chatInviteEmpty#69df3769 = ExportedChatInvite;
|
||||
chatInviteExported#fc2e05bc link:string = ExportedChatInvite;
|
||||
|
||||
chatInviteAlready#5a686d7c chat:Chat = ChatInvite;
|
||||
chatInvite#ce917dcd title:string = ChatInvite;
|
||||
|
||||
messageActionChatJoinedByLink#f89cf5e8 inviter_id:int = MessageAction;
|
||||
|
||||
updateReadMessagesContents#68c13933 messages:Vector<int> pts:int pts_count:int = Update;
|
||||
|
||||
---functions---
|
||||
|
||||
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
||||
@ -622,7 +637,7 @@ messages.search#7e9f2ab peer:InputPeer q:string filter:MessagesFilter min_date:i
|
||||
messages.readHistory#b04f2510 peer:InputPeer max_id:int offset:int = messages.AffectedHistory;
|
||||
messages.deleteHistory#f4f8fb61 peer:InputPeer offset:int = messages.AffectedHistory;
|
||||
messages.deleteMessages#a5f18925 id:Vector<int> = messages.AffectedMessages;
|
||||
messages.receivedMessages#28abcb68 max_id:int = Vector<int>;
|
||||
messages.receivedMessages#5a954c0 max_id:int = Vector<ReceivedNotifyMessage>;
|
||||
messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool;
|
||||
messages.sendMessage#9add8f26 flags:# peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long = messages.SentMessage;
|
||||
messages.sendMedia#2d7923b1 flags:# peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia random_id:long = Updates;
|
||||
@ -723,4 +738,10 @@ account.updatePasswordSettings#fa7c4b86 current_password_hash:bytes new_settings
|
||||
|
||||
auth.checkPassword#a63011e password_hash:bytes = auth.Authorization;
|
||||
auth.requestPasswordRecovery#d897bc66 = auth.PasswordRecovery;
|
||||
auth.recoverPassword#4ea56e92 code:string = auth.Authorization;
|
||||
auth.recoverPassword#4ea56e92 code:string = auth.Authorization;
|
||||
|
||||
invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X;
|
||||
|
||||
messages.exportChatInvite#7d885289 chat_id:int = ExportedChatInvite;
|
||||
messages.checkChatInvite#3eadb1bb hash:string = ChatInvite;
|
||||
messages.importChatInvite#6c50051c hash:string = Updates;
|
@ -40,6 +40,8 @@ ProfileInner::ProfileInner(ProfileWidget *profile, ScrollArea *scroll, const Pee
|
||||
_sendMessage(this, lang(lng_profile_send_message), st::btnShareContact),
|
||||
_shareContact(this, lang(lng_profile_share_contact), st::btnShareContact),
|
||||
_cancelPhoto(this, lang(lng_cancel)),
|
||||
_createInvitationLink(this, lang(lng_group_invite_create)),
|
||||
_invitationLink(this, qsl("telegram.me/joinchat/")),
|
||||
|
||||
a_photo(0),
|
||||
_photoOver(false),
|
||||
@ -62,18 +64,20 @@ ProfileInner::ProfileInner(ProfileWidget *profile, ScrollArea *scroll, const Pee
|
||||
_selectedRow(-1), _lastPreload(0), _contactId(0),
|
||||
_kickOver(0), _kickDown(0), _kickConfirm(0),
|
||||
|
||||
_loadingId(0), _menu(0) {
|
||||
_menu(0) {
|
||||
|
||||
connect(App::api(), SIGNAL(fullPeerLoaded(PeerData*)), this, SLOT(onFullPeerLoaded(PeerData*)));
|
||||
|
||||
if (_peerUser) {
|
||||
_phoneText = _peerUser->phone.isEmpty() ? QString() : App::formatPhone(_peerUser->phone);
|
||||
_loadingId = MTP::send(MTPusers_GetFullUser(_peerUser->inputUser), rpcDone(&ProfileInner::gotFullUser));
|
||||
App::api()->requestFullPeer(_peer);
|
||||
} else if (_peerChat->photoId) {
|
||||
PhotoData *ph = App::photo(_peerChat->photoId);
|
||||
if (ph->date) {
|
||||
_photoLink = TextLinkPtr(new PhotoLink(ph, _peer));
|
||||
}
|
||||
} else {
|
||||
_loadingId = MTP::send(MTPmessages_GetFullChat(App::peerToMTP(_peerChat->id).c_peerChat().vchat_id), rpcDone(&ProfileInner::gotFullChat));
|
||||
App::api()->requestFullPeer(_peer);
|
||||
}
|
||||
|
||||
// profile
|
||||
@ -84,6 +88,10 @@ ProfileInner::ProfileInner(ProfileWidget *profile, ScrollArea *scroll, const Pee
|
||||
connect(&_sendMessage, SIGNAL(clicked()), this, SLOT(onSendMessage()));
|
||||
connect(&_shareContact, SIGNAL(clicked()), this, SLOT(onShareContact()));
|
||||
connect(&_cancelPhoto, SIGNAL(clicked()), this, SLOT(onUpdatePhotoCancel()));
|
||||
connect(&_createInvitationLink, SIGNAL(clicked()), this, SLOT(onCreateInvitationLink()));
|
||||
connect(&_invitationLink, SIGNAL(clicked()), this, SLOT(onInvitationLink()));
|
||||
_invitationLink.setAcceptBoth(true);
|
||||
updateInvitationLink();
|
||||
|
||||
connect(App::app(), SIGNAL(peerPhotoDone(PeerId)), this, SLOT(onPhotoUpdateDone(PeerId)));
|
||||
connect(App::app(), SIGNAL(peerPhotoFail(PeerId)), this, SLOT(onPhotoUpdateFail(PeerId)));
|
||||
@ -247,38 +255,43 @@ void ProfileInner::onMediaAudios() {
|
||||
App::main()->showMediaOverview(_peer, OverviewAudios);
|
||||
}
|
||||
|
||||
void ProfileInner::gotFullUser(const MTPUserFull &user) {
|
||||
_loadingId = 0;
|
||||
const MTPDuserFull &d(user.c_userFull());
|
||||
App::feedPhoto(d.vprofile_photo);
|
||||
App::feedUsers(MTP_vector<MTPUser>(1, d.vuser));
|
||||
PhotoData *userPhoto = _peerUser->photoId ? App::photo(_peerUser->photoId) : 0;
|
||||
if (userPhoto && userPhoto->date) {
|
||||
_photoLink = TextLinkPtr(new PhotoLink(userPhoto, _peer));
|
||||
} else {
|
||||
_photoLink = TextLinkPtr();
|
||||
}
|
||||
App::main()->gotNotifySetting(MTP_inputNotifyPeer(_peer->input), d.vnotify_settings);
|
||||
App::feedUserLink(MTP_int(_peerUser->id), d.vlink.c_contacts_link().vmy_link, d.vlink.c_contacts_link().vforeign_link);
|
||||
void ProfileInner::onInvitationLink() {
|
||||
QApplication::clipboard()->setText(_peerChat->invitationUrl);
|
||||
App::wnd()->showLayer(new ConfirmBox(lang(lng_group_invite_copied), true));
|
||||
}
|
||||
|
||||
void ProfileInner::gotFullChat(const MTPmessages_ChatFull &res) {
|
||||
_loadingId = 0;
|
||||
const MTPDmessages_chatFull &d(res.c_messages_chatFull());
|
||||
PeerId peerId = App::peerFromChat(d.vfull_chat.c_chatFull().vid);
|
||||
App::feedUsers(d.vusers);
|
||||
App::feedChats(d.vchats);
|
||||
App::feedParticipants(d.vfull_chat.c_chatFull().vparticipants);
|
||||
App::main()->gotNotifySetting(MTP_inputNotifyPeer(_peer->input), d.vfull_chat.c_chatFull().vnotify_settings);
|
||||
PhotoData *photo = App::feedPhoto(d.vfull_chat.c_chatFull().vchat_photo);
|
||||
if (photo) {
|
||||
ChatData *chat = App::peer(peerId)->asChat();
|
||||
if (chat) {
|
||||
chat->photoId = photo->id;
|
||||
photo->chat = chat;
|
||||
void ProfileInner::onCreateInvitationLink() {
|
||||
ConfirmBox *box = new ConfirmBox(lang(_peerChat->invitationUrl.isEmpty() ? lng_group_invite_about : lng_group_invite_about_new));
|
||||
connect(box, SIGNAL(confirmed()), this, SLOT(onCreateInvitationLinkSure()));
|
||||
App::wnd()->showLayer(box);
|
||||
}
|
||||
|
||||
void ProfileInner::onCreateInvitationLinkSure() {
|
||||
MTP::send(MTPmessages_ExportChatInvite(App::peerToMTP(_peerChat->id).c_peerChat().vchat_id), rpcDone(&ProfileInner::chatInviteDone));
|
||||
}
|
||||
|
||||
void ProfileInner::chatInviteDone(const MTPExportedChatInvite &result) {
|
||||
_peerChat->invitationUrl = (result.type() == mtpc_chatInviteExported) ? qs(result.c_chatInviteExported().vlink) : QString();
|
||||
updateInvitationLink();
|
||||
showAll();
|
||||
resizeEvent(0);
|
||||
App::wnd()->hideLayer();
|
||||
}
|
||||
|
||||
void ProfileInner::onFullPeerLoaded(PeerData *peer) {
|
||||
if (peer != _peer) return;
|
||||
if (_peerUser) {
|
||||
PhotoData *userPhoto = _peerUser->photoId ? App::photo(_peerUser->photoId) : 0;
|
||||
if (userPhoto && userPhoto->date) {
|
||||
_photoLink = TextLinkPtr(new PhotoLink(userPhoto, _peer));
|
||||
} else {
|
||||
_photoLink = TextLinkPtr();
|
||||
}
|
||||
} else if (_peerChat) {
|
||||
updateInvitationLink();
|
||||
showAll();
|
||||
resizeEvent(0);
|
||||
}
|
||||
emit App::main()->peerUpdated(_peer);
|
||||
}
|
||||
|
||||
void ProfileInner::peerUpdated(PeerData *data) {
|
||||
@ -356,8 +369,8 @@ void ProfileInner::reorderParticipants() {
|
||||
++onlineCount;
|
||||
}
|
||||
}
|
||||
if (_peerChat->count > 0 && _participants.isEmpty() && !_loadingId) {
|
||||
_loadingId = MTP::send(MTPmessages_GetFullChat(App::peerToMTP(_peerChat->id).c_peerChat().vchat_id), rpcDone(&ProfileInner::gotFullChat));
|
||||
if (_peerChat->count > 0 && _participants.isEmpty()) {
|
||||
App::api()->requestFullPeer(_peer);
|
||||
if (_onlineText.isEmpty()) _onlineText = lng_chat_status_members(lt_count, _peerChat->count);
|
||||
} else if (onlineCount && !onlyMe) {
|
||||
_onlineText = lng_chat_status_members_online(lt_count, _participants.size(), lt_count_online, onlineCount);
|
||||
@ -420,7 +433,12 @@ void ProfileInner::paintEvent(QPaintEvent *e) {
|
||||
}
|
||||
p.setPen((_peerUser && App::onlineColorUse(_peerUser->onlineTill, l_time) ? st::profileOnlineColor : st::profileOfflineColor)->p);
|
||||
p.drawText(_left + st::profilePhotoSize + st::profileStatusLeft, top + addbyname + st::profileStatusTop + st::linkFont->ascent, _onlineText);
|
||||
if (_chatAdmin && !_peerChat->invitationUrl.isEmpty()) {
|
||||
p.setPen(st::black->p);
|
||||
p.drawText(_left + st::profilePhotoSize + st::profilePhoneLeft, _createInvitationLink.y() + st::linkFont->ascent, lang(lng_group_invite_link));
|
||||
}
|
||||
if (!_cancelPhoto.isHidden()) {
|
||||
p.setPen(st::profileOfflineColor->p);
|
||||
p.drawText(_left + st::profilePhotoSize + st::profilePhoneLeft, _cancelPhoto.y() + addbyname + st::linkFont->ascent, lang(lng_settings_uploading_photo));
|
||||
}
|
||||
|
||||
@ -665,7 +683,20 @@ void ProfileInner::resizeEvent(QResizeEvent *e) {
|
||||
|
||||
// profile
|
||||
top += st::profilePadding.top();
|
||||
_cancelPhoto.move(_left + _width - _cancelPhoto.width(), top + st::profilePhoneTop);
|
||||
if (_chatAdmin) {
|
||||
if (_peerChat->invitationUrl.isEmpty()) {
|
||||
_createInvitationLink.move(_left + st::profilePhotoSize + st::profilePhoneLeft, top + st::profilePhoneTop);
|
||||
} else {
|
||||
_createInvitationLink.move(_left + _width - _createInvitationLink.width(), top + st::profilePhoneTop);
|
||||
}
|
||||
if (!_invitationText.isEmpty()) {
|
||||
_invitationLink.setText(st::linkFont->m.elidedText(_invitationText, Qt::ElideRight, _width - st::profilePhotoSize - st::profilePhoneLeft));
|
||||
}
|
||||
_invitationLink.move(_left + st::profilePhotoSize + st::profilePhoneLeft, top + st::profilePhoneTop + st::linkFont->height * 1.2);
|
||||
_cancelPhoto.move(_left + _width - _cancelPhoto.width(), top + st::profilePhotoSize - st::linkFont->height);
|
||||
} else {
|
||||
_cancelPhoto.move(_left + _width - _cancelPhoto.width(), top + st::profilePhoneTop);
|
||||
}
|
||||
top += st::profilePhotoSize;
|
||||
|
||||
top += st::profileButtonTop;
|
||||
@ -799,6 +830,8 @@ void ProfileInner::showAll() {
|
||||
_uploadPhoto.hide();
|
||||
_cancelPhoto.hide();
|
||||
_addParticipant.hide();
|
||||
_createInvitationLink.hide();
|
||||
_invitationLink.hide();
|
||||
} else {
|
||||
if (App::app()->isPhotoUpdating(_peer->id)) {
|
||||
_uploadPhoto.hide();
|
||||
@ -807,6 +840,17 @@ void ProfileInner::showAll() {
|
||||
_uploadPhoto.show();
|
||||
_cancelPhoto.hide();
|
||||
}
|
||||
if (_chatAdmin) {
|
||||
_createInvitationLink.show();
|
||||
if (_peerChat->invitationUrl.isEmpty()) {
|
||||
_invitationLink.hide();
|
||||
} else {
|
||||
_invitationLink.show();
|
||||
}
|
||||
} else {
|
||||
_createInvitationLink.hide();
|
||||
_invitationLink.hide();
|
||||
}
|
||||
if (_peerChat->count < cMaxGroupCount()) {
|
||||
_addParticipant.show();
|
||||
} else {
|
||||
@ -819,6 +863,8 @@ void ProfileInner::showAll() {
|
||||
_uploadPhoto.hide();
|
||||
_cancelPhoto.hide();
|
||||
_addParticipant.hide();
|
||||
_createInvitationLink.hide();
|
||||
_invitationLink.hide();
|
||||
_sendMessage.show();
|
||||
if (_peerUser->phone.isEmpty()) {
|
||||
_shareContact.hide();
|
||||
@ -880,6 +926,21 @@ void ProfileInner::showAll() {
|
||||
resize(width(), h);
|
||||
}
|
||||
|
||||
void ProfileInner::updateInvitationLink() {
|
||||
if (!_peerChat) return;
|
||||
if (_peerChat->invitationUrl.isEmpty()) {
|
||||
_createInvitationLink.setText(lang(lng_group_invite_create));
|
||||
} else {
|
||||
_createInvitationLink.setText(lang(lng_group_invite_create_new));
|
||||
_invitationText = _peerChat->invitationUrl;
|
||||
if (_invitationText.startsWith(QLatin1String("http://"), Qt::CaseInsensitive)) {
|
||||
_invitationText = _invitationText.mid(7);
|
||||
} else if (_invitationText.startsWith(QLatin1String("https://"), Qt::CaseInsensitive)) {
|
||||
_invitationText = _invitationText.mid(8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString ProfileInner::overviewLinkText(int32 type, int32 count) {
|
||||
switch (type) {
|
||||
case OverviewPhotos: return lng_profile_photos(lt_count, count);
|
||||
|
@ -42,9 +42,6 @@ public:
|
||||
PeerData *peer() const;
|
||||
bool allMediaShown() const;
|
||||
|
||||
void gotFullUser(const MTPUserFull &user);
|
||||
void gotFullChat(const MTPmessages_ChatFull &res);
|
||||
|
||||
void updateOnlineDisplay();
|
||||
void updateOnlineDisplayTimer();
|
||||
void reorderParticipants();
|
||||
@ -93,9 +90,18 @@ public slots:
|
||||
void onCopyPhone();
|
||||
void onCopyUsername();
|
||||
|
||||
void onInvitationLink();
|
||||
void onCreateInvitationLink();
|
||||
void onCreateInvitationLinkSure();
|
||||
|
||||
void onFullPeerLoaded(PeerData *peer);
|
||||
|
||||
private:
|
||||
|
||||
void showAll();
|
||||
void updateInvitationLink();
|
||||
|
||||
void chatInviteDone(const MTPExportedChatInvite &result);
|
||||
|
||||
ProfileWidget *_profile;
|
||||
ScrollArea *_scroll;
|
||||
@ -115,7 +121,8 @@ private:
|
||||
TextLinkPtr _photoLink;
|
||||
FlatButton _uploadPhoto, _addParticipant;
|
||||
FlatButton _sendMessage, _shareContact;
|
||||
LinkButton _cancelPhoto;
|
||||
LinkButton _cancelPhoto, _createInvitationLink, _invitationLink;
|
||||
QString _invitationText;
|
||||
|
||||
anim::fvalue a_photo;
|
||||
bool _photoOver;
|
||||
@ -148,8 +155,6 @@ private:
|
||||
typedef QVector<ParticipantData*> ParticipantsData;
|
||||
ParticipantsData _participantsData;
|
||||
|
||||
mtpRequestId _loadingId;
|
||||
|
||||
QPoint _lastPos;
|
||||
|
||||
QString _onlineText;
|
||||
|
@ -294,6 +294,7 @@ void VideoOpenLink::onClick(Qt::MouseButton button) const {
|
||||
QString already = data->already(true);
|
||||
if (!already.isEmpty()) {
|
||||
psOpenFile(already);
|
||||
if (App::main()) App::main()->videoMarkRead(data);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -381,9 +382,11 @@ void AudioOpenLink::onClick(Qt::MouseButton button) const {
|
||||
audioVoice()->pauseresume();
|
||||
} else {
|
||||
audioVoice()->play(data);
|
||||
if (App::main()) App::main()->audioMarkRead(data);
|
||||
}
|
||||
} else {
|
||||
psOpenFile(already);
|
||||
if (App::main()) App::main()->audioMarkRead(data);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -40,11 +40,16 @@ static const NotifySettingsPtr EmptyNotifySettings = NotifySettingsPtr(1);
|
||||
extern NotifySettings globalNotifyAll, globalNotifyUsers, globalNotifyChats;
|
||||
extern NotifySettingsPtr globalNotifyAllPtr, globalNotifyUsersPtr, globalNotifyChatsPtr;
|
||||
|
||||
inline bool isNotifyMuted(NotifySettingsPtr settings) {
|
||||
if (settings == UnknownNotifySettings || settings == EmptyNotifySettings) {
|
||||
return false;
|
||||
inline bool isNotifyMuted(NotifySettingsPtr settings, int32 *changeIn = 0) {
|
||||
if (settings != UnknownNotifySettings && settings != EmptyNotifySettings) {
|
||||
int32 t = unixtime();
|
||||
if (settings->mute > t) {
|
||||
if (changeIn) *changeIn = settings->mute - t + 1;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return (settings->mute > unixtime());
|
||||
if (changeIn) *changeIn = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
style::color peerColor(int32 index);
|
||||
@ -155,6 +160,7 @@ struct ChatData : public PeerData {
|
||||
LastAuthors lastAuthors;
|
||||
ImagePtr photoFull;
|
||||
PhotoId photoId;
|
||||
QString invitationUrl;
|
||||
// geo
|
||||
};
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.8.7</string>
|
||||
<string>0.8.8</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleURLTypes</key>
|
||||
|
Binary file not shown.
@ -1671,7 +1671,7 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 0.8.7;
|
||||
CURRENT_PROJECT_VERSION = 0.8.8;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
@ -1689,7 +1689,7 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
COPY_PHASE_STRIP = YES;
|
||||
CURRENT_PROJECT_VERSION = 0.8.7;
|
||||
CURRENT_PROJECT_VERSION = 0.8.8;
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = fast;
|
||||
GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h;
|
||||
@ -1715,10 +1715,10 @@
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 0.8.7;
|
||||
CURRENT_PROJECT_VERSION = 0.8.8;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DYLIB_COMPATIBILITY_VERSION = 0.8;
|
||||
DYLIB_CURRENT_VERSION = 0.8.7;
|
||||
DYLIB_CURRENT_VERSION = 0.8.8;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = "";
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||
@ -1857,10 +1857,10 @@
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 0.8.7;
|
||||
CURRENT_PROJECT_VERSION = 0.8.8;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DYLIB_COMPATIBILITY_VERSION = 0.8;
|
||||
DYLIB_CURRENT_VERSION = 0.8.7;
|
||||
DYLIB_CURRENT_VERSION = 0.8.8;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = "";
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||
|
@ -1,2 +1,2 @@
|
||||
echo 8007 0.8.7 0
|
||||
echo 8008 0.8.8 1
|
||||
# AppVersion AppVersionStr DevChannel
|
||||
|
Loading…
Reference in New Issue
Block a user