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) { | ||||
| 		QFile f(filename); | ||||
| 		if (f.exists()) { | ||||
| 			f.open(QIODevice::ReadOnly); | ||||
| 			uploadDives((QIODevice *)&f); | ||||
| 			f.close(); | ||||
| 			f.remove(); | ||||
|  | @ -744,18 +745,21 @@ void DivelogsDeWebServices::uploadFinished() | |||
| 	// an error condition, such as a failed login
 | ||||
| 	QByteArray xmlData = reply->readAll(); | ||||
| 	char *resp = xmlData.data(); | ||||
| 	// qDebug() << resp;
 | ||||
| 	if (resp) { | ||||
| 		char *parsed = strstr(resp, "<Login>"); | ||||
| 		// char *endat = strstr(resp, "</divelogsDataImport>");
 | ||||
| 		if (parsed) { | ||||
| 			if (strstr(resp, "failed")) | ||||
| 				ui.status->setText(tr("Login failed")); | ||||
| 			else | ||||
| 			if (strstr(resp, "<Login>succeeded</Login>")) { | ||||
| 				if (strstr(resp, "<FileCopy>failed</FileCopy>")) { | ||||
| 					ui.status->setText(tr("Upload failed")); | ||||
| 					return; | ||||
| 				} | ||||
| 				ui.status->setText(tr("Upload successful")); | ||||
| 		} else { | ||||
| 			ui.status->setText(tr("Cannot parse response")); | ||||
| 				return; | ||||
| 			} | ||||
| 			ui.status->setText(tr("Login failed")); | ||||
| 			return; | ||||
| 		} | ||||
| 		ui.status->setText(tr("Cannot parse response")); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue