mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Divelogs.de: further improve reading the server reponse
We now check for the following entries: <Login>succeeded</Login> <FileCopy>failed</FileCopy> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
5514499867
commit
70fce6ce6b
1 changed files with 11 additions and 7 deletions
|
@ -543,6 +543,7 @@ void DivelogsDeWebServices::prepareDivesForUpload()
|
||||||
if (filename) {
|
if (filename) {
|
||||||
QFile f(filename);
|
QFile f(filename);
|
||||||
if (f.exists()) {
|
if (f.exists()) {
|
||||||
|
f.open(QIODevice::ReadOnly);
|
||||||
uploadDives((QIODevice *)&f);
|
uploadDives((QIODevice *)&f);
|
||||||
f.close();
|
f.close();
|
||||||
f.remove();
|
f.remove();
|
||||||
|
@ -744,18 +745,21 @@ void DivelogsDeWebServices::uploadFinished()
|
||||||
// an error condition, such as a failed login
|
// an error condition, such as a failed login
|
||||||
QByteArray xmlData = reply->readAll();
|
QByteArray xmlData = reply->readAll();
|
||||||
char *resp = xmlData.data();
|
char *resp = xmlData.data();
|
||||||
// qDebug() << resp;
|
|
||||||
if (resp) {
|
if (resp) {
|
||||||
char *parsed = strstr(resp, "<Login>");
|
char *parsed = strstr(resp, "<Login>");
|
||||||
// char *endat = strstr(resp, "</divelogsDataImport>");
|
|
||||||
if (parsed) {
|
if (parsed) {
|
||||||
if (strstr(resp, "failed"))
|
if (strstr(resp, "<Login>succeeded</Login>")) {
|
||||||
ui.status->setText(tr("Login failed"));
|
if (strstr(resp, "<FileCopy>failed</FileCopy>")) {
|
||||||
else
|
ui.status->setText(tr("Upload failed"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
ui.status->setText(tr("Upload successful"));
|
ui.status->setText(tr("Upload successful"));
|
||||||
} else {
|
return;
|
||||||
ui.status->setText(tr("Cannot parse response"));
|
}
|
||||||
|
ui.status->setText(tr("Login failed"));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
ui.status->setText(tr("Cannot parse response"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue