2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

webpage attachs redesigned

This commit is contained in:
John Preston
2015-12-19 00:36:16 +03:00
parent 840ffa6482
commit 11da39b72d
10 changed files with 452 additions and 562 deletions

View File

@@ -5363,14 +5363,7 @@ void HistoryWidget::onDocumentUploaded(const FullMsgId &newId, const MTPInputFil
if (!MTP::authedId()) return;
HistoryMessage *item = dynamic_cast<HistoryMessage*>(App::histItemById(newId));
if (item) {
DocumentData *document = 0;
if (HistoryDocument *media = dynamic_cast<HistoryDocument*>(item->getMedia())) {
document = media->document();
} else if (HistoryGif *media = dynamic_cast<HistoryGif*>(item->getMedia())) {
document = media->document();
} else if (HistorySticker *media = dynamic_cast<HistorySticker*>(item->getMedia())) {
document = media->document();
}
DocumentData *document = item->getMedia() ? item->getMedia()->getDocument() : 0;
if (document) {
uint64 randomId = MTP::nonce<uint64>();
App::historyRegRandom(randomId, newId);
@@ -5394,14 +5387,7 @@ void HistoryWidget::onThumbDocumentUploaded(const FullMsgId &newId, const MTPInp
if (!MTP::authedId()) return;
HistoryMessage *item = dynamic_cast<HistoryMessage*>(App::histItemById(newId));
if (item) {
DocumentData *document = 0;
if (HistoryDocument *media = dynamic_cast<HistoryDocument*>(item->getMedia())) {
document = media->document();
} else if (HistoryGif *media = dynamic_cast<HistoryGif*>(item->getMedia())) {
document = media->document();
} else if (HistorySticker *media = dynamic_cast<HistorySticker*>(item->getMedia())) {
document = media->document();
}
DocumentData *document = item->getMedia() ? item->getMedia()->getDocument() : 0;
if (document) {
uint64 randomId = MTP::nonce<uint64>();
App::historyRegRandom(randomId, newId);
@@ -5463,17 +5449,7 @@ void HistoryWidget::onDocumentProgress(const FullMsgId &newId) {
if (!MTP::authedId()) return;
if (HistoryItem *item = App::histItemById(newId)) {
HistoryMedia *media = item->getMedia();
DocumentData *doc = 0;
if (media) {
HistoryMediaType type = media->type();
if (type == MediaTypeDocument) {
doc = static_cast<HistoryDocument*>(item->getMedia())->document();
} else if (type == MediaTypeGif) {
doc = static_cast<HistoryGif*>(item->getMedia())->document();
} else if (type == MediaTypeSticker) {
doc = static_cast<HistorySticker*>(item->getMedia())->document();
}
}
DocumentData *doc = media ? media->getDocument() : 0;
if (!item->fromChannel()) {
updateSendAction(item->history(), SendActionUploadFile, doc ? doc->uploadOffset : 0);
}