summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Maudsley <richard.maudsley@isode.com>2014-08-01 09:23:34 (GMT)
committerSwift Review <review@swift.im>2014-10-08 07:32:25 (GMT)
commitb67aba2e28e5fd716c18bef9c2826b482ef832ad (patch)
tree235ad98446de8b91ef2eb725c148896527106386 /Swift/Controllers/Chat
parent138aa844b47b32ba1d3651e041ca11d8e3a12d6c (diff)
downloadswift-b67aba2e28e5fd716c18bef9c2826b482ef832ad.zip
swift-b67aba2e28e5fd716c18bef9c2826b482ef832ad.tar.bz2
Prevent multiple chat window alerts being shown with the same message.
Test-Information: Enable message delivery receipts, check that only a single alert is displayed for repeated messages. Change-Id: Ifb9f8bd74e592147745f95678f94c21563d301a5
Diffstat (limited to 'Swift/Controllers/Chat')
-rw-r--r--Swift/Controllers/Chat/ChatController.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp
index 50d85a3..0b34681 100644
--- a/Swift/Controllers/Chat/ChatController.cpp
+++ b/Swift/Controllers/Chat/ChatController.cpp
@@ -247,23 +247,32 @@ void ChatController::handleSettingChanged(const std::string& settingPath) {
}
void ChatController::checkForDisplayingDisplayReceiptsAlert() {
+ boost::optional<ChatWindow::AlertID> newDeliverReceiptAlert;
if (userWantsReceipts_ && (contactSupportsReceipts_ == ChatWindow::No)) {
- deliveryReceiptAlert_ = chatWindow_->addAlert(QT_TRANSLATE_NOOP("", "This chat doesn't support delivery receipts."));
+ newDeliverReceiptAlert = chatWindow_->addAlert(QT_TRANSLATE_NOOP("", "This chat doesn't support delivery receipts."));
} else if (userWantsReceipts_ && (contactSupportsReceipts_ == ChatWindow::Maybe)) {
- deliveryReceiptAlert_ = chatWindow_->addAlert(QT_TRANSLATE_NOOP("", "This chat may not support delivery receipts. You might not receive delivery receipts for the messages you sent."));
+ newDeliverReceiptAlert = chatWindow_->addAlert(QT_TRANSLATE_NOOP("", "This chat may not support delivery receipts. You might not receive delivery receipts for the messages you sent."));
} else {
if (deliveryReceiptAlert_) {
chatWindow_->removeAlert(*deliveryReceiptAlert_);
deliveryReceiptAlert_.reset();
}
}
+ if (newDeliverReceiptAlert) {
+ if (deliveryReceiptAlert_) {
+ chatWindow_->removeAlert(*deliveryReceiptAlert_);
+ }
+ deliveryReceiptAlert_ = newDeliverReceiptAlert;
+ }
}
void ChatController::handleBlockingStateChanged() {
boost::shared_ptr<BlockList> blockList = clientBlockListManager_->getBlockList();
if (blockList->getState() == BlockList::Available) {
if (isInMUC_ ? blockList->isBlocked(toJID_) : blockList->isBlocked(toJID_.toBare())) {
- blockedContactAlert_ = chatWindow_->addAlert(QT_TRANSLATE_NOOP("", "You've currently blocked this contact. To continue your conversation you have to unblock the contact first."));
+ if (!blockedContactAlert_) {
+ blockedContactAlert_ = chatWindow_->addAlert(QT_TRANSLATE_NOOP("", "You've currently blocked this contact. To continue your conversation you have to unblock the contact first."));
+ }
chatWindow_->setInputEnabled(false);
chatWindow_->setBlockingState(ChatWindow::IsBlocked);