Add convenience method in FileProvider to send a message to a given file provider domain

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2023-11-14 16:52:34 +08:00
parent 0a5df3ba66
commit 292ff9b3bc
No known key found for this signature in database
GPG Key ID: C839200C384636B0
2 changed files with 19 additions and 3 deletions

View File

@ -39,6 +39,9 @@ public:
static bool fileProviderAvailable();
public slots:
void sendMessageToDomain(const QString &domainIdentifier, const QString &message);
private slots:
void configureXPC();

View File

@ -12,13 +12,15 @@
* for more details.
*/
#import <Foundation/Foundation.h>
#include "fileprovider.h"
#include <QLoggingCategory>
#include "configfile.h"
#include "libsync/configfile.h"
#include "gui/macOS/fileprovidersocketcontroller.h"
#include "fileprovider.h"
#import <Foundation/Foundation.h>
namespace OCC {
@ -95,5 +97,16 @@ void FileProvider::configureXPC()
}
}
void FileProvider::sendMessageToDomain(const QString &domainIdentifier, const QString &message)
{
const auto domainSocketController = _socketServer->socketControllerForDomain(domainIdentifier);
if (!domainSocketController) {
qCWarning(lcMacFileProvider) << "Could not find socket controller for domain identifier" << domainIdentifier;
return;
}
domainSocketController->sendMessage(message);
}
} // namespace Mac
} // namespace OCC