diff options
author | Tobias Markmann <tm@ayena.de> | 2016-02-15 16:34:10 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-02-15 16:34:24 (GMT) |
commit | 21c5075cdeec10cb5334167a5687ee533fea23b1 (patch) | |
tree | 8b1f0e03ca1a7e57e5bc05e0f325a9ef5687b81b /Swift/QtUI/QtChatWindow.cpp | |
parent | 36c70097b1a42af84f9d6bf48a0c6196c560cbe0 (diff) | |
download | swift-21c5075cdeec10cb5334167a5687ee533fea23b1.zip swift-21c5075cdeec10cb5334167a5687ee533fea23b1.tar.bz2 |
Disable file-transfers to MUC PM contactsswift-3.0rc3
Currently the file-transfers to MUC PM contacts fail because
the from JID does not match the initiator JID. The
initiator JID is always the real client JID at the moment.
Disabling file-transfer for MUC PM contacts provides a better
UX for now.
Test-Information:
Tested file-transfer to normal contacts still works. Tested
file-transfers to MUC PMs do not start.
Change-Id: If5f59eb313a25ca919393f497a57fd339eb17e3e
Diffstat (limited to 'Swift/QtUI/QtChatWindow.cpp')
-rw-r--r-- | Swift/QtUI/QtChatWindow.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index caa556f..a9bc2b5 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp @@ -1,32 +1,32 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swift/QtUI/QtChatWindow.h> #include <boost/cstdint.hpp> #include <boost/lexical_cast.hpp> #include <boost/smart_ptr/make_shared.hpp> #include <QApplication> #include <QBoxLayout> #include <QCloseEvent> #include <QComboBox> #include <QCursor> #include <QDebug> #include <QFileDialog> #include <QFileInfo> #include <QInputDialog> #include <QLabel> #include <QLineEdit> #include <QMenu> #include <QMessageBox> #include <QMimeData> #include <QPoint> #include <QPushButton> #include <QSize> #include <QSplitter> #include <QString> #include <QTextDocument> @@ -47,63 +47,61 @@ #include <SwifTools/TabComplete.h> #include <Swift/QtUI/QtAddBookmarkWindow.h> #include <Swift/QtUI/QtEditBookmarkWindow.h> #include <Swift/QtUI/QtEmoticonsGrid.h> #include <Swift/QtUI/QtPlainChatView.h> #include <Swift/QtUI/QtScaledAvatarCache.h> #include <Swift/QtUI/QtSettingsProvider.h> #include <Swift/QtUI/QtTextEdit.h> #include <Swift/QtUI/QtUISettingConstants.h> #include <Swift/QtUI/QtUtilities.h> #include <Swift/QtUI/QtWebKitChatView.h> #include <Swift/QtUI/Roster/QtOccupantListWidget.h> namespace Swift { QtChatWindow::QtChatWindow(const QString& contact, QtChatTheme* theme, UIEventStream* eventStream, SettingsProvider* settings, const std::map<std::string, std::string>& emoticons) : QtTabbable(), id_(Q2PSTRING(contact)), contact_(contact), nextAlertId_(0), eventStream_(eventStream), blockingState_(BlockingUnsupported), isMUC_(false), supportsImpromptuChat_(false), roomBookmarkState_(RoomNotBookmarked) { settings_ = settings; unreadCount_ = 0; isOnline_ = true; completer_ = NULL; affiliationEditor_ = NULL; theme_ = theme; isCorrection_ = false; labelModel_ = NULL; correctionEnabled_ = Maybe; fileTransferEnabled_ = Maybe; updateTitleWithUnreadCount(); assert(settings); -#ifdef SWIFT_EXPERIMENTAL_FT setAcceptDrops(true); -#endif alertStyleSheet_ = "background: rgb(255, 255, 153); color: black"; QBoxLayout *layout = new QBoxLayout(QBoxLayout::TopToBottom, this); layout->setContentsMargins(0,0,0,0); layout->setSpacing(2); alertLayout_ = new QVBoxLayout(); layout->addLayout(alertLayout_); subjectLayout_ = new QBoxLayout(QBoxLayout::LeftToRight); subject_ = new QLineEdit(this); subjectLayout_->addWidget(subject_); setSubject(""); subject_->setReadOnly(true); QPushButton* actionButton_ = new QPushButton(this); actionButton_->setIcon(QIcon(":/icons/actions.png")); connect(actionButton_, SIGNAL(clicked()), this, SLOT(handleActionButtonClicked())); subject_->hide(); layout->addLayout(subjectLayout_); logRosterSplitter_ = new QSplitter(this); logRosterSplitter_->setAutoFillBackground(true); layout->addWidget(logRosterSplitter_); if (settings_->getSetting(QtUISettingConstants::USE_PLAIN_CHATS) || settings_->getSetting(QtUISettingConstants::USE_SCREENREADER)) { messageLog_ = new QtPlainChatView(this, eventStream_); } else { @@ -563,62 +561,61 @@ void QtChatWindow::handleCursorPositionChanged() { void QtChatWindow::show() { if (parentWidget() == NULL) { QWidget::show(); } emit windowOpening(); } bool QtChatWindow::isVisible() const { return QWidget::isVisible(); } void QtChatWindow::activate() { if (isWindow()) { QWidget::show(); } emit wantsToActivate(); input_->setFocus(); } void QtChatWindow::resizeEvent(QResizeEvent*) { emit geometryChanged(); } void QtChatWindow::moveEvent(QMoveEvent*) { emit geometryChanged(); } void QtChatWindow::dragEnterEvent(QDragEnterEvent *event) { if (isOnline_ && (blockingState_ != IsBlocked)) { if (event->mimeData()->hasUrls() && event->mimeData()->urls().size() == 1) { - // TODO: check whether contact actually supports file transfer - if (!isMUC_) { + if (!isMUC_ && fileTransferEnabled_ == Yes) { event->acceptProposedAction(); } } else if (event->mimeData()->hasFormat("application/vnd.swift.contact-jid-list")) { if (isMUC_ || supportsImpromptuChat_) { // Prevent invitations or impromptu initializations for contacts that you are already chatting to. std::vector<JID> droppedJIDs =jidListFromQByteArray(event->mimeData()->data("application/vnd.swift.contact-jid-list")); std::set<JID> conversationJIDs; if (isMUC_) { conversationJIDs = treeWidget_->getRoster()->getJIDs(); } for (std::vector<JID>::iterator i = droppedJIDs.begin(); i != droppedJIDs.end(); ) { const JID& droppedJID = *i; if (conversationJIDs.find(droppedJID) != conversationJIDs.end()) { i = droppedJIDs.erase(i); } else { ++i; } } if (droppedJIDs.empty()) { event->ignore(); } else { event->acceptProposedAction(); } } } |