File indexing completed on 2024-05-05 04:57:14
0001 /* 0002 This file is part of Choqok, the KDE micro-blogging client 0003 0004 SPDX-FileCopyrightText: 2008-2012 Mehrdad Momeny <mehrdad.momeny@gmail.com> 0005 0006 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0007 */ 0008 0009 #ifndef GNUSOCIALAPISEARCH_H 0010 #define GNUSOCIALAPISEARCH_H 0011 0012 #include "gnusocialapihelper_export.h" 0013 0014 #include "twitterapisearch.h" 0015 0016 class KJob; 0017 0018 /** 0019 GNU social/StatatusNet/GNUSocialApi search API implementation. 0020 0021 @author Stephen Henderson \<hendersonsk@gmail.com\> 0022 @author Mehrdad Momeny \<mehrdad.momeny@gmail.com\> 0023 */ 0024 class GNUSOCIALAPIHELPER_EXPORT GNUSocialApiSearch : public TwitterApiSearch 0025 { 0026 Q_OBJECT 0027 public: 0028 enum SearchType { ReferenceHashtag = 0, ReferenceGroup, FromUser, ToUser }; 0029 GNUSocialApiSearch(QObject *parent = nullptr); 0030 ~GNUSocialApiSearch(); 0031 virtual void requestSearchResults(const SearchInfo &searchInfo, 0032 const QString &sinceStatusId = QString(), 0033 uint count = 0, uint page = 1) override; 0034 virtual QString optionCode(int option) override; 0035 0036 protected: 0037 QUrl buildUrl(const SearchInfo &searchInfo, 0038 QString sinceStatusId = QString(), 0039 uint count = 0, uint page = 1); 0040 QList<Choqok::Post *> parseRss(const QByteArray &buffer); 0041 QList<Choqok::Post *> parseAtom(const QByteArray &buffer); 0042 0043 protected Q_SLOTS: 0044 void searchResultsReturned(KJob *job); 0045 0046 private: 0047 QMap<int, QString> mSearchCode; 0048 QMap<KJob *, SearchInfo> mSearchJobs; 0049 static const QRegExp mIdRegExp; 0050 static const QRegExp m_rId; 0051 }; 0052 0053 #endif // GNUSOCIALAPISEARCH_H