mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
Add file provider socket state provider method in socket server
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
fd7f1ce0fc
commit
034fbb8245
@ -17,6 +17,8 @@
|
||||
#include <QLocalSocket>
|
||||
#include <QLoggingCategory>
|
||||
|
||||
#include "libsync/account.h"
|
||||
|
||||
#include "fileprovidersocketcontroller.h"
|
||||
|
||||
namespace OCC {
|
||||
@ -81,6 +83,22 @@ void FileProviderSocketServer::slotSocketDestroyed(const QLocalSocket * const so
|
||||
}
|
||||
}
|
||||
|
||||
FileProviderSocketState FileProviderSocketServer::socketStateForAccount(const QString &userIdAtHost) const
|
||||
{
|
||||
auto connected = false;
|
||||
auto latestStatus = SyncResult::Undefined;
|
||||
|
||||
for (const auto &controller : _socketControllers) {
|
||||
if (controller->accountState()->account()->userIdAtHostWithPort() == userIdAtHost) {
|
||||
connected = true;
|
||||
latestStatus = controller->latestStatus();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return { .connected = connected, .latestStatus = latestStatus };
|
||||
}
|
||||
|
||||
} // namespace Mac
|
||||
|
||||
} // namespace OCC
|
||||
|
||||
@ -54,6 +54,8 @@ class FileProviderSocketServer : public QObject
|
||||
public:
|
||||
explicit FileProviderSocketServer(QObject *parent = nullptr);
|
||||
|
||||
[[nodiscard]] FileProviderSocketState socketStateForAccount(const QString &userIdAtHost) const;
|
||||
|
||||
signals:
|
||||
void syncStateChanged(const AccountPtr &account, SyncResult::Status state) const;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user