Support for ATOM 0.3.
This commit is contained in:
		
							parent
							
								
									f677b6fc80
								
							
						
					
					
						commit
						8a7ca6b289
					
				
					 4 changed files with 24 additions and 10 deletions
				
			
		|  | @ -90,6 +90,7 @@ | |||
| #define EXTERNAL_TOOL_PARAM_SEPARATOR         "|||" | ||||
| 
 | ||||
| #define HTTP_HEADERS_ACCEPT         "Accept" | ||||
| #define HTTP_HEADERS_CONTENT_TYPE   "Content-Type" | ||||
| #define HTTP_HEADERS_AUTHORIZATION  "Authorization" | ||||
| 
 | ||||
| #define MAX_ZOOM_FACTOR     5.0f | ||||
|  |  | |||
|  | @ -180,7 +180,7 @@ Downloader* NetworkFactory::performAsyncNetworkOperation(const QString& url, int | |||
|     QString basic_value = username + ":" + password; | ||||
|     QString header_value = QString("Basic ") + QString(basic_value.toUtf8().toBase64()); | ||||
| 
 | ||||
|     downloader->appendRawHeader("Authorization", header_value.toLocal8Bit()); | ||||
|     downloader->appendRawHeader(HTTP_HEADERS_AUTHORIZATION, header_value.toLocal8Bit()); | ||||
|   } | ||||
| 
 | ||||
|   downloader->manipulateData(url, operation, input_data, timeout, protected_contents, username, password); | ||||
|  |  | |||
|  | @ -324,14 +324,14 @@ void OwnCloudNetworkFactory::markMessagesRead(RootItem::ReadStatus status, const | |||
| 
 | ||||
|   json["items"] = ids; | ||||
| 
 | ||||
|   Downloader* downloader = NetworkFactory::performAsyncNetworkOperation(final_url, | ||||
|                                                                         qApp->settings()->value(GROUP(Feeds), | ||||
|                                                                                                 SETTING(Feeds::UpdateTimeout)).toInt(), | ||||
|                                                                         QJsonDocument(json).toJson(QJsonDocument::Compact), | ||||
|                                                                         CONTENT_TYPE, | ||||
|                                                                         QNetworkAccessManager::PutOperation, | ||||
|                                                                         true, m_authUsername, m_authPassword, | ||||
|                                                                         true); | ||||
|   NetworkFactory::performAsyncNetworkOperation(final_url, | ||||
|                                                qApp->settings()->value(GROUP(Feeds), | ||||
|                                                                        SETTING(Feeds::UpdateTimeout)).toInt(), | ||||
|                                                QJsonDocument(json).toJson(QJsonDocument::Compact), | ||||
|                                                CONTENT_TYPE, | ||||
|                                                QNetworkAccessManager::PutOperation, | ||||
|                                                true, m_authUsername, m_authPassword, | ||||
|                                                true); | ||||
| } | ||||
| 
 | ||||
| void OwnCloudNetworkFactory::markMessagesStarred(RootItem::Importance importance, | ||||
|  |  | |||
|  | @ -24,7 +24,16 @@ | |||
| 
 | ||||
| #include "exceptions/applicationexception.h" | ||||
| 
 | ||||
| AtomParser::AtomParser(const QString& data) : FeedParser(data), m_atomNamespace(QSL("http://www.w3.org/2005/Atom")) {} | ||||
| AtomParser::AtomParser(const QString& data) : FeedParser(data) { | ||||
|   QString version = m_xml.documentElement().attribute(QSL("version")); | ||||
| 
 | ||||
|   if (version == QSL("0.3")) { | ||||
|     m_atomNamespace = QSL("http://purl.org/atom/ns#"); | ||||
|   } | ||||
|   else { | ||||
|     m_atomNamespace = QSL("http://www.w3.org/2005/Atom"); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| AtomParser::~AtomParser() {} | ||||
| 
 | ||||
|  | @ -68,6 +77,10 @@ Message AtomParser::extractMessage(const QDomElement& msg_element, QDateTime cur | |||
|   new_message.m_author = qApp->web()->escapeHtml(messageAuthor(msg_element)); | ||||
|   QString updated = textsFromPath(msg_element, m_atomNamespace, QSL("updated"), true).join(QSL(", ")); | ||||
| 
 | ||||
|   if (updated.isEmpty()) { | ||||
|     updated = textsFromPath(msg_element, m_atomNamespace, QSL("modified"), true).join(QSL(", ")); | ||||
|   } | ||||
| 
 | ||||
|   // Deal with creation date.
 | ||||
|   new_message.m_created = TextFactory::parseDateTime(updated); | ||||
|   new_message.m_createdFromFeed = !new_message.m_created.isNull(); | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue