summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-02-15 16:34:10 (GMT)
committerTobias Markmann <tm@ayena.de>2016-02-15 16:34:24 (GMT)
commit21c5075cdeec10cb5334167a5687ee533fea23b1 (patch)
tree8b1f0e03ca1a7e57e5bc05e0f325a9ef5687b81b
parent36c70097b1a42af84f9d6bf48a0c6196c560cbe0 (diff)
downloadswift-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
-rw-r--r--Swift/Controllers/Chat/ChatController.cpp2
-rw-r--r--Swift/QtUI/QtChatWindow.cpp7
2 files changed, 3 insertions, 6 deletions
diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp
index 6e540eb..a80eee5 100644
--- a/Swift/Controllers/Chat/ChatController.cpp
+++ b/Swift/Controllers/Chat/ChatController.cpp
@@ -101,61 +101,61 @@ ChatController::ChatController(const JID& self, StanzaChannel* stanzaChannel, IQ
settings_->onSettingChanged.connect(boost::bind(&ChatController::handleSettingChanged, this, _1));
eventStream_->onUIEvent.connect(boost::bind(&ChatController::handleUIEvent, this, _1));
}
void ChatController::handleContactNickChanged(const JID& jid, const std::string& /*oldNick*/) {
if (jid.toBare() == toJID_.toBare()) {
chatWindow_->setName(nickResolver_->jidToNick(toJID_));
}
}
ChatController::~ChatController() {
eventStream_->onUIEvent.disconnect(boost::bind(&ChatController::handleUIEvent, this, _1));
settings_->onSettingChanged.disconnect(boost::bind(&ChatController::handleSettingChanged, this, _1));
nickResolver_->onNickChanged.disconnect(boost::bind(&ChatController::handleContactNickChanged, this, _1, _2));
delete chatStateNotifier_;
delete chatStateTracker_;
}
JID ChatController::getBaseJID() {
return isInMUC_ ? toJID_ : ChatControllerBase::getBaseJID();
}
void ChatController::cancelReplaces() {
lastWasPresence_ = false;
}
void ChatController::handleBareJIDCapsChanged(const JID& /*jid*/) {
FeatureOracle featureOracle(entityCapsProvider_, presenceOracle_);
chatWindow_->setCorrectionEnabled(featureOracle.isMessageCorrectionSupported(toJID_));
- chatWindow_->setFileTransferEnabled(featureOracle.isFileTransferSupported(toJID_));
+ chatWindow_->setFileTransferEnabled(isInMUC_ ? No : featureOracle.isFileTransferSupported(toJID_));
contactSupportsReceipts_ = featureOracle.isMessageReceiptsSupported(toJID_);
checkForDisplayingDisplayReceiptsAlert();
}
void ChatController::setToJID(const JID& jid) {
chatStateNotifier_->setContact(jid);
ChatControllerBase::setToJID(jid);
Presence::ref presence;
if (isInMUC_) {
presence = presenceOracle_->getLastPresence(jid);
} else {
presence = jid.isBare() ? presenceOracle_->getAccountPresence(jid.toBare()) : presenceOracle_->getLastPresence(jid);
}
chatStateNotifier_->setContactIsOnline(presence && presence->getType() == Presence::Available);
handleBareJIDCapsChanged(toJID_);
}
void ChatController::setAvailableServerFeatures(boost::shared_ptr<DiscoInfo> info) {
ChatControllerBase::setAvailableServerFeatures(info);
if (iqRouter_->isAvailable() && info->hasFeature(DiscoInfo::BlockingCommandFeature)) {
boost::shared_ptr<BlockList> blockList = clientBlockListManager_->getBlockList();
blockingOnStateChangedConnection_ = blockList->onStateChanged.connect(boost::bind(&ChatController::handleBlockingStateChanged, this));
blockingOnItemAddedConnection_ = blockList->onItemAdded.connect(boost::bind(&ChatController::handleBlockingStateChanged, this));
blockingOnItemRemovedConnection_ = blockList->onItemRemoved.connect(boost::bind(&ChatController::handleBlockingStateChanged, this));
handleBlockingStateChanged();
}
}
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();
}
}
}