summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-10-08 08:34:38 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-10-08 08:34:38 (GMT)
commit58177796fa51784da5f10298a643f972164e6d07 (patch)
tree88e063533f9410a7a57500d9212f45820cb360a2 /Swift/Controllers
parent091f554f42dcdef534718fb759eb45b622adfd4f (diff)
downloadswift-58177796fa51784da5f10298a643f972164e6d07.zip
swift-58177796fa51784da5f10298a643f972164e6d07.tar.bz2
Cancel chat state display when offline.
Release-Notes: Contacts will no longer show as 'typing' if you go offline before they've sent the message. Resolves: #561
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/Chat/ChatController.cpp5
-rw-r--r--Swift/Controllers/Chat/ChatsManager.cpp2
-rw-r--r--Swift/Controllers/Chat/ChatsManager.h2
-rw-r--r--Swift/Controllers/MainController.cpp8
-rw-r--r--Swift/Controllers/MainController.h2
5 files changed, 12 insertions, 7 deletions
diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp
index 924ca97..9046dc3 100644
--- a/Swift/Controllers/Chat/ChatController.cpp
+++ b/Swift/Controllers/Chat/ChatController.cpp
@@ -134,6 +134,11 @@ void ChatController::setEnabled(bool enabled) {
chatWindow_->setAckState(it->second, ChatWindow::Failed);
}
unackedStanzas_.clear();
+
+ Presence::ref fakeOffline(new Presence());
+ fakeOffline->setFrom(toJID_);
+ fakeOffline->setType(Presence::Unavailable);
+ chatStateTracker_->handlePresenceChange(fakeOffline);
}
ChatControllerBase::setEnabled(enabled);
}
diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp
index 8c93120..d3bc6ce 100644
--- a/Swift/Controllers/Chat/ChatsManager.cpp
+++ b/Swift/Controllers/Chat/ChatsManager.cpp
@@ -151,7 +151,7 @@ void ChatsManager::setServerDiscoInfo(boost::shared_ptr<DiscoInfo> info) {
/**
* This is to be called on connect/disconnect.
*/
-void ChatsManager::setEnabled(bool enabled) {
+void ChatsManager::setOnline(bool enabled) {
foreach (JIDChatControllerPair controllerPair, chatControllers_) {
controllerPair.second->setEnabled(enabled);
}
diff --git a/Swift/Controllers/Chat/ChatsManager.h b/Swift/Controllers/Chat/ChatsManager.h
index 1e31458..326a540 100644
--- a/Swift/Controllers/Chat/ChatsManager.h
+++ b/Swift/Controllers/Chat/ChatsManager.h
@@ -41,7 +41,7 @@ namespace Swift {
ChatsManager(JID jid, StanzaChannel* stanzaChannel, IQRouter* iqRouter, EventController* eventController, ChatWindowFactory* chatWindowFactory, NickResolver* nickResolver, PresenceOracle* presenceOracle, boost::shared_ptr<DiscoInfo> serverDiscoInfo, PresenceSender* presenceSender, UIEventStream* uiEventStream, ChatListWindowFactory* chatListWindowFactory, bool useDelayForLatency, TimerFactory* timerFactory, MUCRegistry* mucRegistry, EntityCapsManager* entityCapsManager);
virtual ~ChatsManager();
void setAvatarManager(AvatarManager* avatarManager);
- void setEnabled(bool enabled);
+ void setOnline(bool enabled);
void setServerDiscoInfo(boost::shared_ptr<DiscoInfo> info);
void handleIncomingMessage(boost::shared_ptr<Message> message);
private:
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index 37dc0a9..e3079ac 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -310,7 +310,7 @@ void MainController::handleConnected() {
vcardManager_->requestOwnVCard();
- setManagersEnabled(true);
+ setManagersOnline(true);
//Send presence last to catch all the incoming presences.
sendPresence(statusTracker_->getNextPresence());
}
@@ -521,12 +521,12 @@ void MainController::logout() {
rosterController_->getWindow()->setMyStatusType(StatusShow::None);
rosterController_->getWindow()->setMyStatusText("");
}
- setManagersEnabled(false);
+ setManagersOnline(false);
}
-void MainController::setManagersEnabled(bool enabled) {
+void MainController::setManagersOnline(bool enabled) {
if (chatsManager_) {
- chatsManager_->setEnabled(enabled);
+ chatsManager_->setOnline(enabled);
}
if (rosterController_) {
rosterController_->setEnabled(enabled);
diff --git a/Swift/Controllers/MainController.h b/Swift/Controllers/MainController.h
index d5a8406..163a260 100644
--- a/Swift/Controllers/MainController.h
+++ b/Swift/Controllers/MainController.h
@@ -118,7 +118,7 @@ namespace Swift {
void performLoginFromCachedCredentials();
void reconnectAfterError();
- void setManagersEnabled(bool enabled);
+ void setManagersOnline(bool enabled);
void handleNotificationClicked(const JID& jid);
VCardStorage* getVCardStorageForProfile(const JID& jid);