mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
new photo / file sending, photo always can be sent with caption
This commit is contained in:
@@ -1670,7 +1670,7 @@ bool MessageField::canInsertFromMimeData(const QMimeData *source) const {
|
||||
++files;
|
||||
}
|
||||
}
|
||||
if (files > 1) return false;
|
||||
if (files > 1) return false; // multiple confirm with "compressed" checkbox
|
||||
}
|
||||
if (source->hasImage()) return true;
|
||||
return FlatTextarea::canInsertFromMimeData(source);
|
||||
@@ -1686,17 +1686,17 @@ void MessageField::insertFromMimeData(const QMimeData *source) {
|
||||
++files;
|
||||
}
|
||||
}
|
||||
if (files > 1) return;
|
||||
if (files) {
|
||||
QString file(url.toLocalFile());
|
||||
history->uploadFile(file);
|
||||
if (files == 1) {
|
||||
history->uploadFile(url.toLocalFile(), PrepareAuto, FileLoadAlwaysConfirm);
|
||||
return;
|
||||
}
|
||||
if (files > 1) return;
|
||||
//if (files > 1) return uploadFiles(files, PrepareAuto); // multiple confirm with "compressed" checkbox
|
||||
}
|
||||
if (source->hasImage()) {
|
||||
QImage img = qvariant_cast<QImage>(source->imageData());
|
||||
if (!img.isNull()) {
|
||||
history->uploadImage(img, FileLoadAlwaysConfirm, source->text());
|
||||
history->uploadImage(img, PrepareAuto, FileLoadAlwaysConfirm, source->text());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2403,11 +2403,8 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent)
|
||||
, _attachDragDocument(this)
|
||||
, _attachDragPhoto(this)
|
||||
, _fileLoader(this, FileLoaderQueueStopTimeout)
|
||||
, _imageLoader(this)
|
||||
, _synthedTextUpdate(false)
|
||||
, _serviceImageCacheSize(0)
|
||||
, _confirmImageId(0)
|
||||
, _confirmWithText(false)
|
||||
, _confirmWithTextId(0)
|
||||
, _titlePeerTextWidth(0)
|
||||
, _a_show(animFunc(this, &HistoryWidget::animStep_show))
|
||||
@@ -2441,8 +2438,6 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent)
|
||||
connect(&_field, SIGNAL(tabbed()), this, SLOT(onFieldTabbed()));
|
||||
connect(&_field, SIGNAL(resized()), this, SLOT(onFieldResize()));
|
||||
connect(&_field, SIGNAL(focused()), this, SLOT(onFieldFocused()));
|
||||
connect(&_imageLoader, SIGNAL(imageReady()), this, SLOT(onPhotoReady()));
|
||||
connect(&_imageLoader, SIGNAL(imageFailed(quint64)), this, SLOT(onPhotoFailed(quint64)));
|
||||
connect(&_field, SIGNAL(changed()), this, SLOT(onTextChange()));
|
||||
connect(&_field, SIGNAL(spacedReturnedPasted()), this, SLOT(onPreviewParse()));
|
||||
connect(&_field, SIGNAL(linksChanged()), this, SLOT(onPreviewCheck()));
|
||||
@@ -2711,7 +2706,7 @@ void HistoryWidget::onRecordDone(QByteArray result, qint32 samples) {
|
||||
|
||||
App::wnd()->activateWindow();
|
||||
int32 duration = samples / AudioVoiceMsgFrequency;
|
||||
_imageLoader.append(result, duration, _peer->id, _broadcast.checked(), replyToId(), PrepareAudio);
|
||||
_fileLoader.addTask(new FileLoadTask(result, duration, FileLoadTo(_peer->id, _broadcast.checked(), replyToId())));
|
||||
cancelReply(lastForceReplyReplied());
|
||||
}
|
||||
|
||||
@@ -3991,7 +3986,11 @@ void HistoryWidget::onSendPaths(const PeerId &peer) {
|
||||
App::main()->showPeerHistory(peer, ShowAtTheEndMsgId);
|
||||
if (!_history) return;
|
||||
|
||||
uploadMedias(cSendPaths(), PrepareDocument);
|
||||
if (cSendPaths().size() == 1) {
|
||||
uploadFile(cSendPaths().at(0), PrepareAuto);
|
||||
} else {
|
||||
uploadFiles(cSendPaths(), PrepareDocument);
|
||||
}
|
||||
}
|
||||
|
||||
History *HistoryWidget::history() const {
|
||||
@@ -4166,14 +4165,12 @@ void HistoryWidget::onPhotoSelect() {
|
||||
QString filter(qsl("Image files (*") + imgExtensions.join(qsl(" *")) + qsl(");;Photo files (*") + photoExtensions.join(qsl(" *")) + qsl(");;All files (*.*)"));
|
||||
|
||||
QStringList files;
|
||||
QByteArray file;
|
||||
if (filedialogGetOpenFiles(files, file, lang(lng_choose_images), filter)) {
|
||||
if (!file.isEmpty()) {
|
||||
uploadMedia(file, PreparePhoto);
|
||||
//} else if (files.size() == 1) {
|
||||
// uploadWithConfirm(files.at(0), false, true);
|
||||
} else if (!files.isEmpty()) {
|
||||
uploadMedias(files, PreparePhoto);
|
||||
QByteArray content;
|
||||
if (filedialogGetOpenFiles(files, content, lang(lng_choose_images), filter)) {
|
||||
if (!content.isEmpty()) {
|
||||
uploadFileContent(content, PreparePhoto);
|
||||
} else {
|
||||
uploadFiles(files, PreparePhoto);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4196,14 +4193,12 @@ void HistoryWidget::onDocumentSelect() {
|
||||
QString filter(qsl("All files (*.*);;Image files (*") + imgExtensions.join(qsl(" *")) + qsl(");;Photo files (*") + photoExtensions.join(qsl(" *")) + qsl(")"));
|
||||
|
||||
QStringList files;
|
||||
QByteArray file;
|
||||
if (filedialogGetOpenFiles(files, file, lang(lng_choose_images), filter)) {
|
||||
if (!file.isEmpty()) {
|
||||
uploadMedia(file, PrepareDocument);
|
||||
//} else if (files.size() == 1) {
|
||||
// uploadWithConfirm(files.at(0), false, false);
|
||||
} else if (!files.isEmpty()) {
|
||||
uploadMedias(files, PrepareDocument);
|
||||
QByteArray content;
|
||||
if (filedialogGetOpenFiles(files, content, lang(lng_choose_images), filter)) {
|
||||
if (!content.isEmpty()) {
|
||||
uploadFileContent(content, PrepareDocument);
|
||||
} else {
|
||||
uploadFiles(files, PrepareDocument);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4504,16 +4499,12 @@ void HistoryWidget::onPhotoDrop(const QMimeData *data) {
|
||||
QImage image = qvariant_cast<QImage>(data->imageData());
|
||||
if (image.isNull()) return;
|
||||
|
||||
uploadImage(image, FileLoadNoForceConfirm, data->text());
|
||||
uploadImage(image, PreparePhoto, FileLoadNoForceConfirm, data->text());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
//if (files.size() == 1) {
|
||||
// uploadWithConfirm(files.at(0), false, true);
|
||||
//} else {
|
||||
uploadMedias(files, PreparePhoto);
|
||||
//}
|
||||
uploadFiles(files, PreparePhoto);
|
||||
}
|
||||
|
||||
void HistoryWidget::onDocumentDrop(const QMimeData *data) {
|
||||
@@ -4522,11 +4513,7 @@ void HistoryWidget::onDocumentDrop(const QMimeData *data) {
|
||||
QStringList files = getMediasFromMime(data);
|
||||
if (files.isEmpty()) return;
|
||||
|
||||
//if (files.size() == 1) {
|
||||
// uploadWithConfirm(files.at(0), false, false);
|
||||
//} else {
|
||||
uploadMedias(files, PrepareDocument);
|
||||
//}
|
||||
uploadFiles(files, PrepareDocument);
|
||||
}
|
||||
|
||||
void HistoryWidget::onFilesDrop(const QMimeData *data) {
|
||||
@@ -4536,16 +4523,15 @@ void HistoryWidget::onFilesDrop(const QMimeData *data) {
|
||||
QImage image = qvariant_cast<QImage>(data->imageData());
|
||||
if (image.isNull()) return;
|
||||
|
||||
uploadImage(image, FileLoadNoForceConfirm, data->text());
|
||||
uploadImage(image, PrepareAuto, FileLoadNoForceConfirm, data->text());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
//if (files.size() == 1) {
|
||||
// uploadWithConfirm(files.at(0), false, true);
|
||||
//} else {
|
||||
uploadMedias(files, PrepareAuto);
|
||||
//}
|
||||
if (files.size() == 1) {
|
||||
uploadFile(files.at(0), PrepareAuto);
|
||||
}
|
||||
// uploadFiles(files, PrepareAuto); // multiple confirm with "compressed" checkbox
|
||||
}
|
||||
|
||||
void HistoryWidget::onKbToggle(bool manual) {
|
||||
@@ -4806,176 +4792,63 @@ void HistoryWidget::onFieldCursorChanged() {
|
||||
onDraftSaveDelayed();
|
||||
}
|
||||
|
||||
void HistoryWidget::uploadImage(const QImage &img, FileLoadForceConfirmType confirm, const QString &source, bool withText) {
|
||||
void HistoryWidget::uploadImage(const QImage &img, PrepareMediaType type, FileLoadForceConfirmType confirm, const QString &source, bool withText) {
|
||||
if (!_history) return;
|
||||
|
||||
App::wnd()->activateWindow();
|
||||
FileLoadTask *task = new FileLoadTask(img, FileLoadTo(_peer->id, _broadcast.checked(), replyToId()), confirm, source);
|
||||
FileLoadTask *task = new FileLoadTask(img, type, FileLoadTo(_peer->id, _broadcast.checked(), replyToId()), confirm, source);
|
||||
if (withText) {
|
||||
_confirmWithTextId = task->fileid();
|
||||
}
|
||||
_fileLoader.addTask(task);
|
||||
}
|
||||
|
||||
void HistoryWidget::uploadFile(const QString &file, FileLoadForceConfirmType confirm, bool withText) {
|
||||
void HistoryWidget::uploadFile(const QString &file, PrepareMediaType type, FileLoadForceConfirmType confirm, bool withText) {
|
||||
if (!_history) return;
|
||||
|
||||
App::wnd()->activateWindow();
|
||||
FileLoadTask *task = new FileLoadTask(file, PrepareAuto, FileLoadTo(_peer->id, _broadcast.checked(), replyToId()), confirm);
|
||||
FileLoadTask *task = new FileLoadTask(file, type, FileLoadTo(_peer->id, _broadcast.checked(), replyToId()), confirm);
|
||||
if (withText) {
|
||||
_confirmWithTextId = task->fileid();
|
||||
}
|
||||
_fileLoader.addTask(task);
|
||||
}
|
||||
|
||||
void HistoryWidget::shareContactConfirmation(const QString &phone, const QString &fname, const QString &lname, MsgId replyTo, bool withText) {
|
||||
if (!_history || _confirmImageId) return;
|
||||
void HistoryWidget::uploadFiles(const QStringList &files, PrepareMediaType type) {
|
||||
if (!_history || files.isEmpty()) return;
|
||||
|
||||
if (files.size() == 1) return uploadFile(files.at(0), type);
|
||||
|
||||
App::wnd()->activateWindow();
|
||||
_confirmWithText = withText;
|
||||
_confirmImageId = 0xFFFFFFFFFFFFFFFFL;
|
||||
|
||||
FileLoadTo to(_peer->id, _broadcast.checked(), replyToId());
|
||||
|
||||
TasksList tasks;
|
||||
tasks.reserve(files.size());
|
||||
for (int32 i = 0, l = files.size(); i < l; ++i) {
|
||||
tasks.push_back(TaskPtr(new FileLoadTask(files.at(i), type, to, FileLoadNeverConfirm)));
|
||||
}
|
||||
_fileLoader.addTasks(tasks);
|
||||
|
||||
cancelReply(lastForceReplyReplied());
|
||||
}
|
||||
|
||||
void HistoryWidget::uploadFileContent(const QByteArray &fileContent, PrepareMediaType type) {
|
||||
if (!_history) return;
|
||||
|
||||
App::wnd()->activateWindow();
|
||||
_fileLoader.addTask(new FileLoadTask(fileContent, type, FileLoadTo(_peer->id, _broadcast.checked(), replyToId())));
|
||||
cancelReply(lastForceReplyReplied());
|
||||
}
|
||||
|
||||
void HistoryWidget::shareContactWithConfirm(const QString &phone, const QString &fname, const QString &lname, MsgId replyTo, bool withText) {
|
||||
if (!_history) return;
|
||||
|
||||
App::wnd()->activateWindow();
|
||||
_confirmWithTextId = 0xFFFFFFFFFFFFFFFFL;
|
||||
App::wnd()->showLayer(new PhotoSendBox(phone, fname, lname, replyTo));
|
||||
}
|
||||
|
||||
void HistoryWidget::uploadConfirmImageUncompressed(bool ctrlShiftEnter, MsgId replyTo) {
|
||||
if (!_history || !_confirmImageId || _confirmImage.isNull()) return;
|
||||
|
||||
App::wnd()->activateWindow();
|
||||
PeerId peerId = _peer->id;
|
||||
if (_confirmWithText) {
|
||||
onSend(ctrlShiftEnter, replyTo);
|
||||
}
|
||||
bool lastKeyboardUsed = lastForceReplyReplied(FullMsgId(_channel, replyTo));
|
||||
_imageLoader.append(_confirmImage, peerId, _broadcast.checked(), replyTo, PrepareDocument, ctrlShiftEnter);
|
||||
_confirmImageId = 0;
|
||||
_confirmWithText = false;
|
||||
_confirmImage = QImage();
|
||||
cancelReply(lastKeyboardUsed);
|
||||
}
|
||||
|
||||
void HistoryWidget::uploadMedias(const QStringList &files, PrepareMediaType type) {
|
||||
if (!_history) return;
|
||||
|
||||
App::wnd()->activateWindow();
|
||||
_imageLoader.append(files, _peer->id, _broadcast.checked(), replyToId(), type);
|
||||
cancelReply(lastForceReplyReplied());
|
||||
}
|
||||
|
||||
void HistoryWidget::uploadMedia(const QByteArray &fileContent, PrepareMediaType type, PeerId peer) {
|
||||
if (!peer && !_history) return;
|
||||
|
||||
App::wnd()->activateWindow();
|
||||
_imageLoader.append(fileContent, peer ? peer : _peer->id, _broadcast.checked(), replyToId(), type);
|
||||
cancelReply(lastForceReplyReplied());
|
||||
}
|
||||
|
||||
void HistoryWidget::onPhotoReady() {
|
||||
QMutexLocker lock(_imageLoader.readyMutex());
|
||||
ReadyLocalMedias &list(_imageLoader.readyList());
|
||||
|
||||
for (ReadyLocalMedias::const_iterator i = list.cbegin(), e = list.cend(); i != e; ++i) {
|
||||
if (i->id == _confirmImageId) {
|
||||
PhotoSendBox *box = new PhotoSendBox(*i);
|
||||
connect(box, SIGNAL(confirmed()), this, SLOT(onSendConfirmed()));
|
||||
connect(box, SIGNAL(destroyed(QObject*)), this, SLOT(onSendCancelled()));
|
||||
App::wnd()->showLayer(box);
|
||||
} else {
|
||||
confirmSendImage(*i);
|
||||
}
|
||||
}
|
||||
list.clear();
|
||||
}
|
||||
|
||||
void HistoryWidget::onSendConfirmed() {
|
||||
if (!_confirmSource.isEmpty()) _confirmSource = QString();
|
||||
}
|
||||
|
||||
void HistoryWidget::onSendCancelled() {
|
||||
if (!_confirmSource.isEmpty()) {
|
||||
_field.textCursor().insertText(_confirmSource);
|
||||
_confirmSource = QString();
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryWidget::onPhotoFailed(quint64 id) {
|
||||
}
|
||||
|
||||
void HistoryWidget::confirmShareContact(bool ctrlShiftEnter, const QString &phone, const QString &fname, const QString &lname, MsgId replyTo) {
|
||||
if (!_peer) return;
|
||||
|
||||
PeerId peerId = _peer->id;
|
||||
if (0xFFFFFFFFFFFFFFFFL == _confirmImageId) {
|
||||
if (_confirmWithText) {
|
||||
onSend(ctrlShiftEnter, replyTo);
|
||||
}
|
||||
_confirmImageId = 0;
|
||||
_confirmWithText = false;
|
||||
_confirmImage = QImage();
|
||||
}
|
||||
shareContact(peerId, phone, fname, lname, replyTo);
|
||||
}
|
||||
|
||||
void HistoryWidget::confirmSendImage(const ReadyLocalMedia &img) {
|
||||
if (img.id == _confirmImageId) {
|
||||
if (_confirmWithText) {
|
||||
onSend(img.ctrlShiftEnter, img.replyTo);
|
||||
}
|
||||
_confirmImageId = 0;
|
||||
_confirmWithText = false;
|
||||
_confirmImage = QImage();
|
||||
}
|
||||
FullMsgId newId(peerToChannel(img.peer), clientMsgId());
|
||||
|
||||
connect(App::uploader(), SIGNAL(photoReady(const FullMsgId&, const MTPInputFile&)), this, SLOT(onPhotoUploaded(const FullMsgId&, const MTPInputFile&)), Qt::UniqueConnection);
|
||||
connect(App::uploader(), SIGNAL(documentReady(const FullMsgId&, const MTPInputFile&)), this, SLOT(onDocumentUploaded(const FullMsgId&, const MTPInputFile&)), Qt::UniqueConnection);
|
||||
connect(App::uploader(), SIGNAL(thumbDocumentReady(const FullMsgId&, const MTPInputFile&, const MTPInputFile&)), this, SLOT(onThumbDocumentUploaded(const FullMsgId&, const MTPInputFile&, const MTPInputFile&)), Qt::UniqueConnection);
|
||||
connect(App::uploader(), SIGNAL(audioReady(const FullMsgId&, const MTPInputFile&)), this, SLOT(onAudioUploaded(const FullMsgId&, const MTPInputFile&)), Qt::UniqueConnection);
|
||||
connect(App::uploader(), SIGNAL(photoProgress(const FullMsgId&)), this, SLOT(onPhotoProgress(const FullMsgId&)), Qt::UniqueConnection);
|
||||
connect(App::uploader(), SIGNAL(documentProgress(const FullMsgId&)), this, SLOT(onDocumentProgress(const FullMsgId&)), Qt::UniqueConnection);
|
||||
connect(App::uploader(), SIGNAL(audioProgress(const FullMsgId&)), this, SLOT(onAudioProgress(const FullMsgId&)), Qt::UniqueConnection);
|
||||
connect(App::uploader(), SIGNAL(photoFailed(const FullMsgId&)), this, SLOT(onPhotoFailed(const FullMsgId&)), Qt::UniqueConnection);
|
||||
connect(App::uploader(), SIGNAL(documentFailed(const FullMsgId&)), this, SLOT(onDocumentFailed(const FullMsgId&)), Qt::UniqueConnection);
|
||||
connect(App::uploader(), SIGNAL(audioFailed(const FullMsgId&)), this, SLOT(onAudioFailed(const FullMsgId&)), Qt::UniqueConnection);
|
||||
|
||||
App::uploader()->uploadMedia(newId, img);
|
||||
|
||||
History *h = App::history(img.peer);
|
||||
|
||||
fastShowAtEnd(h);
|
||||
|
||||
int32 flags = newMessageFlags(h->peer) | MTPDmessage::flag_media; // unread, out
|
||||
if (img.replyTo) flags |= MTPDmessage::flag_reply_to_msg_id;
|
||||
bool fromChannelName = h->peer->isChannel() && h->peer->asChannel()->canPublish() && (h->peer->asChannel()->isBroadcast() || img.broadcast);
|
||||
if (fromChannelName) {
|
||||
flags |= MTPDmessage::flag_views;
|
||||
} else {
|
||||
flags |= MTPDmessage::flag_from_id;
|
||||
}
|
||||
if (img.type == PreparePhoto) {
|
||||
h->addNewMessage(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(fromChannelName ? 0 : MTP::authedId()), peerToMTP(img.peer), MTPPeer(), MTPint(), MTP_int(img.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaPhoto(img.photo, MTP_string(img.caption)), MTPnullMarkup, MTPnullEntities, MTP_int(1)), NewMessageUnread);
|
||||
} else if (img.type == PrepareDocument) {
|
||||
h->addNewMessage(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(fromChannelName ? 0 : MTP::authedId()), peerToMTP(img.peer), MTPPeer(), MTPint(), MTP_int(img.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaDocument(img.document), MTPnullMarkup, MTPnullEntities, MTP_int(1)), NewMessageUnread);
|
||||
} else if (img.type == PrepareAudio) {
|
||||
if (!h->peer->isChannel()) {
|
||||
flags |= MTPDmessage_flag_media_unread;
|
||||
}
|
||||
h->addNewMessage(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(fromChannelName ? 0 : MTP::authedId()), peerToMTP(img.peer), MTPPeer(), MTPint(), MTP_int(img.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaAudio(img.audio), MTPnullMarkup, MTPnullEntities, MTP_int(1)), NewMessageUnread);
|
||||
}
|
||||
|
||||
if (_peer && img.peer == _peer->id) {
|
||||
App::main()->historyToDown(_history);
|
||||
}
|
||||
App::main()->dialogsToUp();
|
||||
peerMessagesUpdated(img.peer);
|
||||
}
|
||||
|
||||
void HistoryWidget::cancelSendImage() {
|
||||
if (_confirmImageId && _confirmWithText) setFieldText(QString());
|
||||
_confirmImageId = 0;
|
||||
_confirmWithText = false;
|
||||
_confirmImage = QImage();
|
||||
}
|
||||
|
||||
void HistoryWidget::confirmSendFile(const FileLoadResultPtr &file, bool ctrlShiftEnter) {
|
||||
if (_confirmWithTextId && _confirmWithTextId == file->id) {
|
||||
onSend(ctrlShiftEnter, file->to.replyTo);
|
||||
@@ -4995,7 +4868,7 @@ void HistoryWidget::confirmSendFile(const FileLoadResultPtr &file, bool ctrlShif
|
||||
connect(App::uploader(), SIGNAL(documentFailed(const FullMsgId&)), this, SLOT(onDocumentFailed(const FullMsgId&)), Qt::UniqueConnection);
|
||||
connect(App::uploader(), SIGNAL(audioFailed(const FullMsgId&)), this, SLOT(onAudioFailed(const FullMsgId&)), Qt::UniqueConnection);
|
||||
|
||||
App::uploader()->uploadFile(newId, file);
|
||||
App::uploader()->upload(newId, file);
|
||||
|
||||
History *h = App::history(file->to.peer);
|
||||
|
||||
@@ -5037,6 +4910,23 @@ void HistoryWidget::cancelSendFile(const FileLoadResultPtr &file) {
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryWidget::confirmShareContact(const QString &phone, const QString &fname, const QString &lname, MsgId replyTo, bool ctrlShiftEnter) {
|
||||
if (!_peer) return;
|
||||
|
||||
if (_confirmWithTextId == 0xFFFFFFFFFFFFFFFFL) {
|
||||
onSend(ctrlShiftEnter, replyTo);
|
||||
_confirmWithTextId = 0;
|
||||
}
|
||||
shareContact(_peer->id, phone, fname, lname, replyTo);
|
||||
}
|
||||
|
||||
void HistoryWidget::cancelShareContact() {
|
||||
if (_confirmWithTextId == 0xFFFFFFFFFFFFFFFFL) {
|
||||
setFieldText(QString());
|
||||
_confirmWithTextId = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryWidget::onPhotoUploaded(const FullMsgId &newId, const MTPInputFile &file) {
|
||||
if (!MTP::authedId()) return;
|
||||
HistoryItem *item = App::histItemById(newId);
|
||||
@@ -5055,7 +4945,7 @@ void HistoryWidget::onPhotoUploaded(const FullMsgId &newId, const MTPInputFile &
|
||||
sendFlags |= MTPmessages_SendMessage_flag_broadcast;
|
||||
}
|
||||
QString caption = item->getMedia() ? item->getMedia()->getCaption() : QString();
|
||||
hist->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_int(sendFlags), item->history()->peer->input, MTP_int(replyTo), MTP_inputMediaUploadedPhoto(file, MTP_string(caption)), MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendPhotoFail, 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(caption)), MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, hist->sendRequestId);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user