diff options
| author | Tobias Markmann <tm@ayena.de> | 2015-10-27 16:20:09 (GMT) |
|---|---|---|
| committer | Tobias Markmann <tm@ayena.de> | 2015-10-30 12:34:52 (GMT) |
| commit | 0f5ef716a50c8d9761cafda12aacf818cdfd6353 (patch) | |
| tree | 4ed80dedc2fa8b04036eb7567282094ea8fe07f1 /Swift/Controllers/Roster/ContactRosterItem.h | |
| parent | 4320235bef1b601856b295a8d6411d1898048802 (diff) | |
| download | swift-0f5ef716a50c8d9761cafda12aacf818cdfd6353.zip swift-0f5ef716a50c8d9761cafda12aacf818cdfd6353.tar.bz2 | |
Change bare JID presence lookup code to ignore priorities
Before presence handling code was handled by both, the
ContactRosterItem in Swift and the PresenceOracle in Swiften.
The ContactRosterItem also considered the presence priority
for deciding what presence to show for a bare JID.
With this code all full or bare JID presence requests are
finally handled by the PresenceOracle. For bare JIDs it is
looked up to a presence of one of the available resources of
that JID regardless of the priorities.
Test-Information:
Adjusted tests according to above description and documentation
in PresenceOracle.
Change-Id: I972a4574f476cdf4d4b5593a035eb1c25ef2f8ba
Diffstat (limited to 'Swift/Controllers/Roster/ContactRosterItem.h')
| -rw-r--r-- | Swift/Controllers/Roster/ContactRosterItem.h | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/Swift/Controllers/Roster/ContactRosterItem.h b/Swift/Controllers/Roster/ContactRosterItem.h index 54a6b60..ec04a8c 100644 --- a/Swift/Controllers/Roster/ContactRosterItem.h +++ b/Swift/Controllers/Roster/ContactRosterItem.h | |||
| @@ -1,26 +1,26 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (c) 2010-2013 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 <map> | ||
| 10 | #include <set> | 9 | #include <set> |
| 11 | #include <string> | 10 | #include <string> |
| 11 | #include <vector> | ||
| 12 | 12 | ||
| 13 | #include <boost/bind.hpp> | 13 | #include <boost/bind.hpp> |
| 14 | #include <boost/date_time/posix_time/ptime.hpp> | 14 | #include <boost/date_time/posix_time/ptime.hpp> |
| 15 | #include <boost/filesystem/path.hpp> | 15 | #include <boost/filesystem/path.hpp> |
| 16 | #include <boost/shared_ptr.hpp> | 16 | #include <boost/shared_ptr.hpp> |
| 17 | 17 | ||
| 18 | #include <Swiften/Base/boost_bsignals.h> | 18 | #include <Swiften/Base/boost_bsignals.h> |
| 19 | #include <Swiften/Elements/MUCOccupant.h> | ||
| 19 | #include <Swiften/Elements/Presence.h> | 20 | #include <Swiften/Elements/Presence.h> |
| 20 | #include <Swiften/Elements/StatusShow.h> | 21 | #include <Swiften/Elements/StatusShow.h> |
| 21 | #include <Swiften/Elements/MUCOccupant.h> | ||
| 22 | #include <Swiften/Elements/VCard.h> | 22 | #include <Swiften/Elements/VCard.h> |
| 23 | #include <Swiften/JID/JID.h> | 23 | #include <Swiften/JID/JID.h> |
| 24 | 24 | ||
| 25 | #include <Swift/Controllers/Roster/RosterItem.h> | 25 | #include <Swift/Controllers/Roster/RosterItem.h> |
| 26 | 26 | ||
| @@ -54,16 +54,15 @@ class ContactRosterItem : public RosterItem { | |||
| 54 | const boost::filesystem::path& getAvatarPath() const; | 54 | const boost::filesystem::path& getAvatarPath() const; |
| 55 | const JID& getJID() const; | 55 | const JID& getJID() const; |
| 56 | void setDisplayJID(const JID& jid); | 56 | void setDisplayJID(const JID& jid); |
| 57 | const JID& getDisplayJID() const; | 57 | const JID& getDisplayJID() const; |
| 58 | void applyPresence(const std::string& resource, boost::shared_ptr<Presence> presence); | 58 | void applyPresence(const std::string& resource, boost::shared_ptr<Presence> presence); |
| 59 | void clearPresence(); | ||
| 60 | void calculateShownPresence(); | ||
| 61 | const std::vector<std::string>& getGroups() const; | 59 | const std::vector<std::string>& getGroups() const; |
| 62 | /** Only used so a contact can know about the groups it's in*/ | 60 | /** Only used so a contact can know about the groups it's in*/ |
| 63 | void addGroup(const std::string& group); | 61 | void addGroup(const std::string& group); |
| 64 | void removeGroup(const std::string& group); | 62 | void removeGroup(const std::string& group); |
| 63 | void clearPresence(); | ||
| 65 | 64 | ||
| 66 | MUCOccupant::Role getMUCRole() const; | 65 | MUCOccupant::Role getMUCRole() const; |
| 67 | void setMUCRole(const MUCOccupant::Role& role); | 66 | void setMUCRole(const MUCOccupant::Role& role); |
| 68 | MUCOccupant::Affiliation getMUCAffiliation() const; | 67 | MUCOccupant::Affiliation getMUCAffiliation() const; |
| 69 | void setMUCAffiliation(const MUCOccupant::Affiliation& affiliation); | 68 | void setMUCAffiliation(const MUCOccupant::Affiliation& affiliation); |
| @@ -83,13 +82,11 @@ class ContactRosterItem : public RosterItem { | |||
| 83 | private: | 82 | private: |
| 84 | JID jid_; | 83 | JID jid_; |
| 85 | JID displayJID_; | 84 | JID displayJID_; |
| 86 | boost::posix_time::ptime lastAvailableTime_; | 85 | boost::posix_time::ptime lastAvailableTime_; |
| 87 | boost::filesystem::path avatarPath_; | 86 | boost::filesystem::path avatarPath_; |
| 88 | std::map<std::string, boost::shared_ptr<Presence> > presences_; | 87 | boost::shared_ptr<Presence> presence_; |
| 89 | boost::shared_ptr<Presence> offlinePresence_; | ||
| 90 | boost::shared_ptr<Presence> shownPresence_; | ||
| 91 | std::vector<std::string> groups_; | 88 | std::vector<std::string> groups_; |
| 92 | MUCOccupant::Role mucRole_; | 89 | MUCOccupant::Role mucRole_; |
| 93 | MUCOccupant::Affiliation mucAffiliation_; | 90 | MUCOccupant::Affiliation mucAffiliation_; |
| 94 | std::set<Feature> features_; | 91 | std::set<Feature> features_; |
| 95 | BlockState blockState_; | 92 | BlockState blockState_; |
Swift