summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2014-02-19 15:34:52 (GMT)
committerSwift Review <review@swift.im>2014-02-22 17:50:30 (GMT)
commitc54f38cabcf6db20b933a447135e73866156b871 (patch)
tree19f7881a6cd4330c8591b7c43ba6c9f4be9b54b4 /Swift/Controllers/Chat
parentf437c387a2bb31e4bf79869dfe40a541cda4f6c6 (diff)
downloadswift-contrib-c54f38cabcf6db20b933a447135e73866156b871.zip
swift-contrib-c54f38cabcf6db20b933a447135e73866156b871.tar.bz2
Handle error responses to XEP-0184 receipt requests.
Change-Id: I23d77168c1c387342164d857a3eb5577bff65fb9 License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Diffstat (limited to 'Swift/Controllers/Chat')
-rw-r--r--Swift/Controllers/Chat/ChatController.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp
index 13fd22b..fd6da94 100644
--- a/Swift/Controllers/Chat/ChatController.cpp
+++ b/Swift/Controllers/Chat/ChatController.cpp
@@ -188,12 +188,21 @@ void ChatController::preHandleIncomingMessage(boost::shared_ptr<MessageEvent> me
chatStateTracker_->handleMessageReceived(message);
chatStateNotifier_->receivedMessageFromContact(message->getPayload<ChatState>());
+ // handle XEP-0184 Message Receipts
+ // incomming receipts
if (boost::shared_ptr<DeliveryReceipt> receipt = message->getPayload<DeliveryReceipt>()) {
SWIFT_LOG(debug) << "received receipt for id: " << receipt->getReceivedID() << std::endl;
if (requestedReceipts_.find(receipt->getReceivedID()) != requestedReceipts_.end()) {
chatWindow_->setMessageReceiptState(requestedReceipts_[receipt->getReceivedID()], ChatWindow::ReceiptReceived);
requestedReceipts_.erase(receipt->getReceivedID());
}
+ // incomming errors in response to send out receipts
+ } else if (message->getPayload<DeliveryReceiptRequest>() && (message->getType() == Message::Error)) {
+ if (requestedReceipts_.find(message->getID()) != requestedReceipts_.end()) {
+ chatWindow_->setMessageReceiptState(requestedReceipts_[message->getID()], ChatWindow::ReceiptFailed);
+ requestedReceipts_.erase(message->getID());
+ }
+ // incoming receipt requests
} else if (message->getPayload<DeliveryReceiptRequest>()) {
if (receivingPresenceFromUs_) {
boost::shared_ptr<Message> receiptMessage = boost::make_shared<Message>();