summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-04-21 09:02:07 (GMT)
committerKevin Smith <kevin.smith@isode.com>2016-11-10 11:09:16 (GMT)
commitd2ba1ab8a36333523bf794c23226bd044e1717c2 (patch)
tree737ac14bc1dfcec4b80192ea23e7b0e860a2f8d3 /Swiften/Elements
parent41c771ec02682c2b344263d29f68eb6452c42dbe (diff)
downloadswift-d2ba1ab8a36333523bf794c23226bd044e1717c2.zip
swift-d2ba1ab8a36333523bf794c23226bd044e1717c2.tar.bz2
Use FeatureOracle to detect file-transfer support in roster
The FeatureOracle provides tri-state feature lookup functionality for bare JIDs. It returns Yes if a feature is supported by all resources of the bare JID, Maybe if some support it, and No if none of the resources support it. If passed a full JID, it returns the specific features supported by that end-point. Sending a file to a bare JID, will send a file to the resource of the bare JID with the highest availability by presence, show status and priority and which supports the features required for a Jingle file-transfer. Test-Information: Added unit test verifying new behavior. All tests pass on OS X 10.11.6. Added new unit tests for FeatureOracle. Manually verified that the roster and chat window both use the same mechanism to detect support for file-transfers. Manually verified that file-transfers via the contact list goes to already bound full JIDs if there is an existing ChatController. Change-Id: I0175ac42ecb73f1d54f9c96ffbba773eb5e24296
Diffstat (limited to 'Swiften/Elements')
-rw-r--r--Swiften/Elements/Stanza.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/Swiften/Elements/Stanza.h b/Swiften/Elements/Stanza.h
index 9a69696..9284bc3 100644
--- a/Swiften/Elements/Stanza.h
+++ b/Swiften/Elements/Stanza.h
@@ -41,56 +41,61 @@ namespace Swift {
}
return std::shared_ptr<T>();
}
template<typename T>
std::vector< std::shared_ptr<T> > getPayloads() const {
std::vector< std::shared_ptr<T> > results;
for (const auto& payload : payloads_) {
std::shared_ptr<T> result(std::dynamic_pointer_cast<T>(payload));
if (result) {
results.push_back(result);
}
}
return results;
}
const std::vector< std::shared_ptr<Payload> >& getPayloads() const {
return payloads_;
}
void addPayload(std::shared_ptr<Payload> payload) {
payloads_.push_back(payload);
}
template<typename InputIterator>
void addPayloads(InputIterator begin, InputIterator end) {
payloads_.insert(payloads_.end(), begin, end);
}
+ template<typename Container>
+ void addPayloads(const Container& container) {
+ payloads_.insert(payloads_.end(), std::begin(container), std::end(container));
+ }
+
void updatePayload(std::shared_ptr<Payload> payload);
void removePayloadOfSameType(std::shared_ptr<Payload>);
std::shared_ptr<Payload> getPayloadOfSameType(std::shared_ptr<Payload>) const;
const JID& getFrom() const { return from_; }
void setFrom(const JID& from) { from_ = from; }
const JID& getTo() const { return to_; }
void setTo(const JID& to) { to_ = to; }
const std::string& getID() const { return id_; }
void setID(const std::string& id) { id_ = id; }
boost::optional<boost::posix_time::ptime> getTimestamp() const;
// Falls back to any timestamp if no specific timestamp for the given JID is found.
boost::optional<boost::posix_time::ptime> getTimestampFrom(const JID& jid) const;
private:
std::string id_;
JID from_;
JID to_;
std::vector< std::shared_ptr<Payload> > payloads_;
};
}