aboutsummaryrefslogtreecommitdiff
path: root/src/base/QXmppFileShare.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/base/QXmppFileShare.cpp')
-rw-r--r--src/base/QXmppFileShare.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/base/QXmppFileShare.cpp b/src/base/QXmppFileShare.cpp
index 9dd4b686..28276b0c 100644
--- a/src/base/QXmppFileShare.cpp
+++ b/src/base/QXmppFileShare.cpp
@@ -125,6 +125,29 @@ void QXmppFileShare::setEncryptedSourecs(const QVector<QXmppEncryptedFileSource>
}
/// \cond
+void QXmppFileShare::visitSources(std::function<bool(const std::any &)> &&visitor) const
+{
+ for (const auto &httpSource : d->httpSources) {
+ if (visitor(httpSource)) {
+ return;
+ }
+ }
+ for (const auto &encryptedSource : d->encryptedSources) {
+ if (visitor(encryptedSource)) {
+ return;
+ }
+ }
+}
+
+void QXmppFileShare::addSource(const std::any &source)
+{
+ if (source.type() == typeid(QXmppHttpFileSource)) {
+ d->httpSources.push_back(std::any_cast<QXmppHttpFileSource>(source));
+ } else if (source.type() == typeid(QXmppEncryptedFileSource)) {
+ d->encryptedSources.push_back(std::any_cast<QXmppEncryptedFileSource>(source));
+ }
+}
+
bool QXmppFileShare::parse(const QDomElement &el)
{
if (el.tagName() == "file-sharing" && el.namespaceURI() == ns_sfs) {