summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2015-09-14 15:08:39 (GMT)
committerKevin Smith <kevin.smith@isode.com>2015-10-16 14:58:03 (GMT)
commit9e6ee0f262e7dc663f4c706b16a346a268f425aa (patch)
tree5926fd9cc9dec1233f95239b259a7730f99a5a72 /Swift/Controllers/Roster/RosterController.h
parent8da6e35afab55d7232d47575faea2bde7cd44ece (diff)
downloadswift-9e6ee0f262e7dc663f4c706b16a346a268f425aa.zip
swift-9e6ee0f262e7dc663f4c706b16a346a268f425aa.tar.bz2
Mark removed contacts as unavailable in Swift
When removing a contact, a XMPP client will not receive an explicit unavailable presence stanza for the contact from the server. Because of that Swift used to show removed contacts still with their old presence in the Chats tab or the chat view. With this patch, the PresenceOracle will flush all known presence of a contact as soon as the JID is removed from the roster. An unavailable presence will stored under the removed bare JID and is emitted via the PresenceOracle::onPresenceChange signal. Test-Information: Added a unit test verifying this behavior. Tested the behavior with two scenarios: a) Account A and B adding each other and accepting the subscription request. Starting a chat between A and B. After removing B in A's account, B used to be shown as available in the chat view and the Chats tab. With this patch B is shown as unavailable. b) Account A and B adding each other and accepting the subscription request. A removing B, and B removing A. After A adds B again, B used to be shown with the old presence even before B accepted the subscription request. This behavior is also fixed with this patch, not showing B as online until B accepted the subscription request. Change-Id: Iba97d3bedd0ac962ea00b25a0d2ed6106ed55a55
Diffstat (limited to 'Swift/Controllers/Roster/RosterController.h')
-rw-r--r--Swift/Controllers/Roster/RosterController.h44
1 files changed, 23 insertions, 21 deletions
diff --git a/Swift/Controllers/Roster/RosterController.h b/Swift/Controllers/Roster/RosterController.h
index f4ae581..545abfc 100644
--- a/Swift/Controllers/Roster/RosterController.h
+++ b/Swift/Controllers/Roster/RosterController.h
@@ -1,55 +1,57 @@
1/* 1/*
2 * Copyright (c) 2010 Isode Limited. 2 * Copyright (c) 2010-2015 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
6 6
7#pragma once 7#pragma once
8 8
9#include <string>
10#include <set> 9#include <set>
10#include <string>
11 11
12#include <boost/shared_ptr.hpp> 12#include <boost/shared_ptr.hpp>
13 13
14#include <Swiften/Avatars/AvatarManager.h>
14#include <Swiften/Base/boost_bsignals.h> 15#include <Swiften/Base/boost_bsignals.h>
15#include <Swiften/JID/JID.h>
16#include <Swiften/Elements/Presence.h>
17#include <Swiften/Elements/ErrorPayload.h> 16#include <Swiften/Elements/ErrorPayload.h>
17#include <Swiften/Elements/Presence.h>
18#include <Swiften/Elements/RosterPayload.h> 18#include <Swiften/Elements/RosterPayload.h>
19#include <Swiften/Avatars/AvatarManager.h> 19#include <Swiften/Elements/VCard.h>
20#include <Swiften/VCards/VCardManager.h> 20#include <Swiften/JID/JID.h>
21 21
22#include <Swift/Controllers/Roster/ContactRosterItem.h>
22#include <Swift/Controllers/UIEvents/UIEvent.h> 23#include <Swift/Controllers/UIEvents/UIEvent.h>
23#include <Swift/Controllers/FileTransfer/FileTransferOverview.h>
24#include <Swift/Controllers/Roster/RosterGroupExpandinessPersister.h>
25 24
26namespace Swift { 25namespace Swift {
26 class AvatarManager;
27 class ClientBlockListManager;
28 class EntityCapsProvider;
29 class EventController;
30 class FileTransferManager;
31 class FileTransferOverview;
27 class IQRouter; 32 class IQRouter;
28 class Roster;
29 class XMPPRoster;
30 class XMPPRosterItem;
31 class MainWindow; 33 class MainWindow;
32 class MainWindowFactory; 34 class MainWindowFactory;
33 class OfflineRosterFilter; 35 class NickManager;
34 class NickResolver; 36 class NickResolver;
37 class OfflineRosterFilter;
35 class PresenceOracle; 38 class PresenceOracle;
39 class Roster;
40 class RosterGroupExpandinessPersister;
41 class RosterVCardProvider;
42 class SettingsProvider;
36 class SubscriptionManager; 43 class SubscriptionManager;
37 class EventController;
38 class SubscriptionRequestEvent; 44 class SubscriptionRequestEvent;
39 class UIEventStream; 45 class UIEventStream;
40 class IQRouter; 46 class VCardManager;
41 class SettingsProvider; 47 class XMPPRoster;
42 class NickManager; 48 class XMPPRosterItem;
43 class EntityCapsProvider;
44 class FileTransferManager;
45 class ClientBlockListManager;
46 class RosterVCardProvider;
47 49
48 class RosterController { 50 class RosterController {
49 public: 51 public:
50 RosterController(const JID& jid, XMPPRoster* xmppRoster, AvatarManager* avatarManager, MainWindowFactory* mainWindowFactory, NickManager* nickManager, NickResolver* nickResolver, PresenceOracle* presenceOracle, SubscriptionManager* subscriptionManager, EventController* eventController, UIEventStream* uiEventStream, IQRouter* iqRouter_, SettingsProvider* settings, EntityCapsProvider* entityCapsProvider, FileTransferOverview* fileTransferOverview, ClientBlockListManager* clientBlockListManager, VCardManager* vcardManager); 52 RosterController(const JID& jid, XMPPRoster* xmppRoster, AvatarManager* avatarManager, MainWindowFactory* mainWindowFactory, NickManager* nickManager, NickResolver* nickResolver, PresenceOracle* presenceOracle, SubscriptionManager* subscriptionManager, EventController* eventController, UIEventStream* uiEventStream, IQRouter* iqRouter, SettingsProvider* settings, EntityCapsProvider* entityCapsProvider, FileTransferOverview* fileTransferOverview, ClientBlockListManager* clientBlockListManager, VCardManager* vcardManager);
51 ~RosterController(); 53 ~RosterController();
52 void showRosterWindow(); 54 void showRosterWindow();
53 void setJID(const JID& jid) { myJID_ = jid; } 55 void setJID(const JID& jid) { myJID_ = jid; }
54 MainWindow* getWindow() {return mainWindow_;} 56 MainWindow* getWindow() {return mainWindow_;}
55 boost::signal<void (StatusShow::Type, const std::string&)> onChangeStatusRequest; 57 boost::signal<void (StatusShow::Type, const std::string&)> onChangeStatusRequest;