summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2011-05-02 19:00:45 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-05-02 19:01:48 (GMT)
commit68a93082f7ff8ede37112bf9c6cb34ad2986c6c8 (patch)
tree4b64a49954e5c74746a428d831b19db22f924e30 /Swift/Controllers/Chat
parent5e766d702dc0fe255732731b77018d256cdee6b0 (diff)
downloadswift-68a93082f7ff8ede37112bf9c6cb34ad2986c6c8.zip
swift-68a93082f7ff8ede37112bf9c6cb34ad2986c6c8.tar.bz2
Fix the acks when replacing messages
Diffstat (limited to 'Swift/Controllers/Chat')
-rw-r--r--Swift/Controllers/Chat/ChatController.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp
index 9767f8d..eaf3316 100644
--- a/Swift/Controllers/Chat/ChatController.cpp
+++ b/Swift/Controllers/Chat/ChatController.cpp
@@ -131,19 +131,22 @@ void ChatController::preSendMessageRequest(boost::shared_ptr<Message> message) {
}
void ChatController::postSendMessage(const std::string& body, boost::shared_ptr<Stanza> sentStanza) {
- if (stanzaChannel_->getStreamManagementEnabled() && !myLastMessageUIID_.empty()) {
- chatWindow_->setAckState(myLastMessageUIID_, ChatWindow::Pending);
- unackedStanzas_[sentStanza] = myLastMessageUIID_;
- }
boost::shared_ptr<Replace> replace = sentStanza->getPayload<Replace>();
if (replace) {
chatWindow_->replaceMessage(body, myLastMessageUIID_, boost::posix_time::microsec_clock::universal_time());
+ for (std::map<boost::shared_ptr<Stanza>, std::string>::iterator it = unackedStanzas_.begin(); it != unackedStanzas_.end(); ) {
+ if ((*it).second == myLastMessageUIID_) {
+ unackedStanzas_.erase(it++);
+ } else {
+ ++it;
+ }
+ }
} else {
myLastMessageUIID_ = addMessage(body, QT_TRANSLATE_NOOP("", "me"), true, labelsEnabled_ ? chatWindow_->getSelectedSecurityLabel().getLabel() : boost::shared_ptr<SecurityLabel>(), std::string(avatarManager_->getAvatarPath(selfJID_).string()), boost::posix_time::microsec_clock::universal_time());
- if (stanzaChannel_->getStreamManagementEnabled()) {
- chatWindow_->setAckState(myLastMessageUIID_, ChatWindow::Pending);
- unackedStanzas_[sentStanza] = myLastMessageUIID_;
- }
+ }
+ if (stanzaChannel_->getStreamManagementEnabled() && !myLastMessageUIID_.empty() ) {
+ chatWindow_->setAckState(myLastMessageUIID_, ChatWindow::Pending);
+ unackedStanzas_[sentStanza] = myLastMessageUIID_;
}
lastWasPresence_ = false;
chatStateNotifier_->userSentMessage();