mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-27 09:12:01 +03:00
Merge pull request #5170 from owncloud/add_capabilities_owncloudcmd
add server capabilities to owncloudcmd
This commit is contained in:
commit
b7eb37dc03
1 changed files with 20 additions and 0 deletions
|
@ -29,6 +29,7 @@
|
|||
#include "syncengine.h"
|
||||
#include "syncjournaldb.h"
|
||||
#include "config.h"
|
||||
#include "connectionvalidator.h"
|
||||
|
||||
#include "cmd.h"
|
||||
|
||||
|
@ -69,6 +70,8 @@ struct CmdOptions {
|
|||
// So we have to use a global variable
|
||||
CmdOptions *opts = 0;
|
||||
|
||||
const qint64 timeoutToUseMsec = qMax(1000, ConnectionValidator::DefaultCallingIntervalMsec - 5*1000);
|
||||
|
||||
class EchoDisabler
|
||||
{
|
||||
public:
|
||||
|
@ -389,6 +392,23 @@ int main(int argc, char **argv) {
|
|||
account->setCredentials(cred);
|
||||
account->setSslErrorHandler(sslErrorHandler);
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||
//obtain capabilities using event loop
|
||||
QEventLoop loop;
|
||||
|
||||
JsonApiJob *job = new JsonApiJob(account, QLatin1String("ocs/v1.php/cloud/capabilities"));
|
||||
job->setTimeout(timeoutToUseMsec);
|
||||
QObject::connect(job, &JsonApiJob::jsonReceived, [&](const QVariantMap &json) {
|
||||
auto caps = json.value("ocs").toMap().value("data").toMap().value("capabilities");
|
||||
qDebug() << "Server capabilities" << caps;
|
||||
account->setCapabilities(caps.toMap());
|
||||
loop.quit();
|
||||
});
|
||||
job->start();
|
||||
|
||||
loop.exec();
|
||||
#endif
|
||||
|
||||
// much lower age than the default since this utility is usually made to be run right after a change in the tests
|
||||
SyncEngine::minimumFileAgeForUpload = 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue