mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-27 17:37:36 +03:00
CSync callbacks: Don't use global account.
This commit is contained in:
parent
a9da5ebff6
commit
4fa212c43b
4 changed files with 14 additions and 4 deletions
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "utility.h"
|
||||
#include "account.h"
|
||||
#include "syncengine.h"
|
||||
|
||||
namespace OCC
|
||||
{
|
||||
|
@ -34,10 +35,11 @@ int handleNeonSSLProblems(const char* prompt,
|
|||
size_t /*len*/,
|
||||
int /*echo*/,
|
||||
int /*verify*/,
|
||||
void* /*userdata*/)
|
||||
void* userdata)
|
||||
{
|
||||
int re = 0;
|
||||
const QString qPrompt = QString::fromLatin1( prompt ).trimmed();
|
||||
SyncEngine* engine = reinterpret_cast<SyncEngine*>(userdata);
|
||||
|
||||
if( qPrompt.startsWith( QLatin1String("There are problems with the SSL certificate:"))) {
|
||||
// SSL is requested. If the program came here, the SSL check was done by Qt
|
||||
|
@ -48,7 +50,7 @@ int handleNeonSSLProblems(const char* prompt,
|
|||
int pos = 0;
|
||||
// This is the set of certificates which QNAM accepted, so we should accept
|
||||
// them as well
|
||||
QList<QSslCertificate> certs = AccountManager::instance()->account()->sslConfiguration().peerCertificateChain();
|
||||
QList<QSslCertificate> certs = engine->account()->sslConfiguration().peerCertificateChain();
|
||||
|
||||
while (!certOk && (pos = regexp.indexIn(qPrompt, 1+pos)) != -1) {
|
||||
QString neon_fingerprint = regexp.cap(1);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "accessmanager.h"
|
||||
#include "utility.h"
|
||||
#include "theme.h"
|
||||
#include "syncengine.h"
|
||||
#include "creds/credentialscommon.h"
|
||||
#include "creds/httpcredentials.h"
|
||||
|
||||
|
@ -47,8 +48,8 @@ int getauth(const char *prompt,
|
|||
int re = 0;
|
||||
|
||||
// ### safe? Not really. If the wizard is run in the main thread, the caccount could change during the sync.
|
||||
// Ideally, http_credentials could be use userdata, but userdata is the SyncEngine.
|
||||
HttpCredentials* http_credentials = qobject_cast<HttpCredentials*>(AccountManager::instance()->account()->credentials());
|
||||
SyncEngine* engine = reinterpret_cast<SyncEngine*>(userdata);
|
||||
HttpCredentials* http_credentials = qobject_cast<HttpCredentials*>(engine->account()->credentials());
|
||||
|
||||
if (!http_credentials) {
|
||||
qDebug() << "Not a HTTP creds instance!";
|
||||
|
|
|
@ -1149,6 +1149,11 @@ qint64 SyncEngine::timeSinceFileTouched(const QString& fn) const
|
|||
return -1;
|
||||
}
|
||||
|
||||
AccountPtr SyncEngine::account() const
|
||||
{
|
||||
return _account;
|
||||
}
|
||||
|
||||
void SyncEngine::abort()
|
||||
{
|
||||
csync_request_abort(_csync_ctx);
|
||||
|
|
|
@ -76,6 +76,8 @@ public:
|
|||
*/
|
||||
qint64 timeSinceFileTouched(const QString& fn) const;
|
||||
|
||||
AccountPtr account() const;
|
||||
|
||||
signals:
|
||||
void csyncError( const QString& );
|
||||
void csyncUnavailable();
|
||||
|
|
Loading…
Reference in a new issue