save
This commit is contained in:
		
							parent
							
								
									3d6a289120
								
							
						
					
					
						commit
						b19450932a
					
				
					 2 changed files with 24 additions and 4 deletions
				
			
		|  | @ -83,7 +83,7 @@ QList<Message> FeedlyNetwork::streamContents(const QString& stream_id) { | ||||||
|                                                           {}, |                                                           {}, | ||||||
|                                                           m_service->networkProxy()); |                                                           m_service->networkProxy()); | ||||||
| 
 | 
 | ||||||
|     messages += decodeStreamContents(output); |     messages += decodeStreamContents(output, continuation); | ||||||
| 
 | 
 | ||||||
|   } |   } | ||||||
|   while (!continuation.isEmpty()); |   while (!continuation.isEmpty()); | ||||||
|  | @ -91,8 +91,28 @@ QList<Message> FeedlyNetwork::streamContents(const QString& stream_id) { | ||||||
|   return messages; |   return messages; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| QList<Message> FeedlyNetwork::decodeStreamContents(const QByteArray& stream_contents) const { | QList<Message> FeedlyNetwork::decodeStreamContents(const QByteArray& stream_contents, QString& continuation) const { | ||||||
|   return {}; |   QList<Message> messages; | ||||||
|  |   QJsonDocument json = QJsonDocument::fromJson(stream_contents); | ||||||
|  | 
 | ||||||
|  |   continuation = json.object()["continuation"].toString(); | ||||||
|  | 
 | ||||||
|  |   for (const QJsonValue& entry : json.object()["items"].toArray()) { | ||||||
|  |     const QJsonObject& entry_obj = entry.toObject(); | ||||||
|  |     Message message; | ||||||
|  | 
 | ||||||
|  |     message.m_title = entry_obj["title"].toString(); | ||||||
|  |     message.m_author = entry_obj["author"].toString(); | ||||||
|  |     message.m_contents = entry_obj["content"].toObject()["content"].toString(); | ||||||
|  |     message.m_createdFromFeed = true; | ||||||
|  |     message.m_created = QDateTime::fromMSecsSinceEpoch(entry_obj["published"].toVariant().toLongLong(), | ||||||
|  |                                                        Qt::TimeSpec::UTC); | ||||||
|  |     message.m_customId = entry_obj["id"].toString(); | ||||||
|  | 
 | ||||||
|  |     messages.append(message); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   return messages; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| RootItem* FeedlyNetwork::collections(bool obtain_icons) { | RootItem* FeedlyNetwork::collections(bool obtain_icons) { | ||||||
|  |  | ||||||
|  | @ -61,7 +61,7 @@ class FeedlyNetwork : public QObject { | ||||||
| 
 | 
 | ||||||
|     QString fullUrl(Service service) const; |     QString fullUrl(Service service) const; | ||||||
|     QString bearer() const; |     QString bearer() const; | ||||||
|     QList<Message> decodeStreamContents(const QByteArray& stream_contents) const; |     QList<Message> decodeStreamContents(const QByteArray& stream_contents, QString& continuation) const; | ||||||
|     RootItem* decodeCollections(const QByteArray& json, bool obtain_icons, const QNetworkProxy& proxy, int timeout = 0) const; |     RootItem* decodeCollections(const QByteArray& json, bool obtain_icons, const QNetworkProxy& proxy, int timeout = 0) const; | ||||||
|     QPair<QByteArray, QByteArray> bearerHeader(const QString& bearer) const; |     QPair<QByteArray, QByteArray> bearerHeader(const QString& bearer) const; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue