Skip to content

Commit 3754e13

Browse files
committed
init commit
1 parent 161053b commit 3754e13

17 files changed

Lines changed: 2457 additions & 4 deletions

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,12 +360,13 @@ add_subdirectory(src/librssguard)
360360
add_subdirectory(localization)
361361

362362
# Plugins.
363-
add_subdirectory(src/librssguard-standard)
364363
add_subdirectory(src/librssguard-feedly)
365364
add_subdirectory(src/librssguard-gmail)
366365
add_subdirectory(src/librssguard-greader)
367-
add_subdirectory(src/librssguard-ttrss)
368366
add_subdirectory(src/librssguard-nextcloud)
367+
add_subdirectory(src/librssguard-standard)
368+
add_subdirectory(src/librssguard-ttrss)
369+
add_subdirectory(src/librssguard-xmpp)
369370

370371
# Additional programs.
371372
add_subdirectory(resources/scripts/standalone/article-extractor)

resources/graphics/misc/xmpp.png

10.1 KB
Loading

resources/rssguard.qrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
<file>graphics/misc/reedah.png</file>
4848
<file>graphics/misc/theoldreader.png</file>
4949
<file>graphics/misc/tt-rss.png</file>
50+
<file>graphics/misc/xmpp.png</file>
5051

5152
<file>graphics/misc/flags/cs.png</file>
5253
<file>graphics/misc/flags/da.png</file>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
include(../cmake_plugins.cmake)
2+
set(PLUGIN_TARGET "rssguard-xmpp")
3+
4+
set(SOURCES
5+
src/xmppentrypoint.cpp
6+
src/xmppentrypoint.h
7+
src/xmppfeed.cpp
8+
src/xmppfeed.h
9+
src/xmppnetwork.cpp
10+
src/xmppnetwork.h
11+
src/xmppserviceroot.cpp
12+
src/xmppserviceroot.h
13+
src/xmppubsubpmanager.cpp
14+
src/xmppubsubpmanager.h
15+
)
16+
17+
set(UI_FILES
18+
)
19+
20+
prepare_rssguard_plugin(${PLUGIN_TARGET})

src/librssguard-xmpp/plugin.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "XMPP (PubSub)",
3+
"author": "Martin Rotter",
4+
"website": "https://github.com/martinrotter/rssguard"
5+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#ifndef XMPP_DEFINITIONS_H
2+
#define XMPP_DEFINITIONS_H
3+
4+
#define XMPP_DEFAULT_BATCH_SIZE 100
5+
6+
// URLs.
7+
#define XMPP_URL_REEDAH "https://www.reedah.com"
8+
#define XMPP_URL_TOR "https://theoldreader.com"
9+
#define XMPP_URL_BAZQUX "https://bazqux.com"
10+
#define XMPP_URL_INOREADER "https://www.inoreader.com"
11+
12+
// States.
13+
#define XMPP_API_STATE_READING_LIST "state/com.google/reading-list"
14+
15+
// Means "read" message. If both "reading-list" and "read" are specified, message is READ. If this state
16+
// is not present, message is UNREAD.
17+
#define XMPP_API_STATE_READ "state/com.google/read"
18+
#define XMPP_API_STATE_IMPORTANT "state/com.google/starred"
19+
20+
#define XMPP_API_FULL_STATE_READING_LIST "user/-/state/com.google/reading-list"
21+
#define XMPP_API_FULL_STATE_READ "user/-/state/com.google/read"
22+
#define XMPP_API_FULL_STATE_IMPORTANT "user/-/state/com.google/starred"
23+
24+
// API.
25+
#define XMPP_API_CLIENT_LOGIN "accounts/ClientLogin"
26+
#define XMPP_API_TAG_LIST "reader/api/0/tag/list?output=json"
27+
#define XMPP_API_SUBSCRIPTION_LIST "reader/api/0/subscription/list?output=json"
28+
#define XMPP_API_STREAM_CONTENTS "reader/api/0/stream/contents/%1?output=json&n=%2"
29+
#define XMPP_API_EDIT_TAG "reader/api/0/edit-tag"
30+
#define XMPP_API_SUBSCRIPTION_EXPORT "reader/api/0/subscription/export"
31+
#define XMPP_API_SUBSCRIPTION_IMPORT "reader/api/0/subscription/import"
32+
#define XMPP_API_SUBSCRIPTION_EDIT "reader/api/0/subscription/edit?ac=%1&s=%2"
33+
#define XMPP_API_ITEM_IDS "reader/api/0/stream/items/ids?output=json&n=%2&s=%1"
34+
#define XMPP_API_ITEM_CONTENTS "reader/api/0/stream/items/contents?output=json&n=200000"
35+
#define XMPP_API_TOKEN "reader/api/0/token"
36+
#define XMPP_API_USER_INFO "reader/api/0/user-info?output=json"
37+
38+
// Edit subscription ops.
39+
#define XMPP_API_EDIT_SUBSCRIPTION_ADD "subscribe"
40+
#define XMPP_API_EDIT_SUBSCRIPTION_MODIFY "edit"
41+
#define XMPP_API_EDIT_SUBSCRIPTION_DELETE "unsubscribe"
42+
43+
// Misc.
44+
#define XMPP_API_ITEM_IDS_MAX 200000
45+
#define XMPP_API_EDIT_TAG_BATCH 200
46+
#define XMPP_API_ITEM_CONTENTS_BATCH 999
47+
#define XMPP_GLOBAL_UPDATE_THRES 0.3
48+
49+
// The Old Reader.
50+
#define TOR_SPONSORED_STREAM_ID "tor/sponsored"
51+
#define TOR_ITEM_CONTENTS_BATCH 9999
52+
53+
// Inoreader.
54+
#define INO_ITEM_CONTENTS_BATCH 250
55+
56+
#define INO_HEADER_APPID "AppId"
57+
#define INO_HEADER_APPKEY "AppKey"
58+
59+
#define INO_OAUTH_REDIRECT_URI_PORT 14488
60+
#define INO_OAUTH_SCOPE "read write"
61+
#define INO_OAUTH_TOKEN_URL "https://www.inoreader.com/oauth2/token"
62+
#define INO_OAUTH_AUTH_URL "https://www.inoreader.com/oauth2/auth"
63+
#define INO_REG_API_URL "https://www.inoreader.com/developers/register-app"
64+
65+
// FreshRSS.
66+
#define FRESHRSS_BASE_URL_PATH "api/xmpp.php/"
67+
68+
#endif // XMPP_DEFINITIONS_H
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// For license of this file, see <project-root-folder>/LICENSE.md.
2+
3+
#include "src/xmppentrypoint.h"
4+
5+
#include "src/xmppserviceroot.h"
6+
#include
7+
8+
#include <librssguard/database/databasequeries.h>
9+
#include <librssguard/definitions/definitions.h>
10+
#include <librssguard/miscellaneous/application.h>
11+
#include <librssguard/miscellaneous/iconfactory.h>
12+
13+
XmppEntryPoint::XmppEntryPoint(QObject* parent) : QObject(parent) {}
14+
15+
XmppEntryPoint::~XmppEntryPoint() {
16+
qDebugNN << LOGSEC_XMPP << "Destructing" << QUOTE_W_SPACE(QSL(SERVICE_CODE_XMPP)) << "plugin.";
17+
}
18+
19+
ServiceRoot* XmppEntryPoint::createNewRoot() const {
20+
// FormEditXmppAccount form_acc(qApp->mainFormWidget());
21+
// return form_acc.addEditAccount<XmppServiceRoot>();
22+
23+
return new XmppServiceRoot();
24+
}
25+
26+
QList<ServiceRoot*> XmppEntryPoint::initializeSubtree() const {
27+
return qApp->database()->worker()->read<QList<ServiceRoot*>>([&](const QSqlDatabase& db) {
28+
return DatabaseQueries::getAccounts<XmppServiceRoot>(db, code());
29+
});
30+
}
31+
32+
QString XmppEntryPoint::name() const {
33+
return QSL("XMPP (PubSub)");
34+
}
35+
36+
QString XmppEntryPoint::code() const {
37+
return QSL(SERVICE_CODE_XMPP);
38+
}
39+
40+
QString XmppEntryPoint::description() const {
41+
return QObject::tr("Plugin for XMPP which is able to get articles via PubSub real-time push notifications.");
42+
}
43+
44+
QString XmppEntryPoint::author() const {
45+
return QSL(APP_AUTHOR);
46+
}
47+
48+
QIcon XmppEntryPoint::icon() const {
49+
return qApp->icons()->miscIcon(QSL("xmpp"));
50+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// For license of this file, see <project-root-folder>/LICENSE.md.
2+
3+
#ifndef XMPPENTRYPOINT_H
4+
#define XMPPENTRYPOINT_H
5+
6+
#include <librssguard/services/abstract/serviceentrypoint.h>
7+
8+
class XmppEntryPoint : public QObject, public ServiceEntryPoint {
9+
Q_OBJECT
10+
Q_PLUGIN_METADATA(IID "io.github.martinrotter.rssguard.xmpp" FILE "plugin.json")
11+
Q_INTERFACES(ServiceEntryPoint)
12+
13+
public:
14+
explicit XmppEntryPoint(QObject* parent = nullptr);
15+
virtual ~XmppEntryPoint();
16+
17+
virtual ServiceRoot* createNewRoot() const;
18+
virtual QList<ServiceRoot*> initializeSubtree() const;
19+
virtual QString name() const;
20+
virtual QString code() const;
21+
virtual QString description() const;
22+
virtual QString author() const;
23+
virtual QIcon icon() const;
24+
};
25+
26+
#endif // XMPPENTRYPOINT_H
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// For license of this file, see <project-root-folder>/LICENSE.md.
2+
3+
#include "src/xmppfeed.h"
4+
5+
#include "src/definitions.h"
6+
#include "src/xmppnetwork.h"
7+
#include "src/xmppserviceroot.h"
8+
9+
#include <librssguard/database/databasequeries.h>
10+
#include <librssguard/definitions/definitions.h>
11+
#include <librssguard/miscellaneous/application.h>
12+
#include <librssguard/miscellaneous/iconfactory.h>
13+
14+
#include <QPointer>
15+
16+
XmppFeed::XmppFeed(RootItem* parent) : Feed(parent) {}
17+
18+
XmppServiceRoot* XmppFeed::serviceRoot() const {
19+
return qobject_cast<XmppServiceRoot*>(account());
20+
}
21+
22+
bool XmppFeed::canBeDeleted() const {
23+
return true;
24+
}
25+
26+
void XmppFeed::deleteItem() {
27+
/*
28+
serviceRoot()->network()->subscriptionEdit(QSL(XMPP_API_EDIT_SUBSCRIPTION_DELETE),
29+
customId(),
30+
{},
31+
{},
32+
{},
33+
serviceRoot()->networkProxy());
34+
*/
35+
removeItself();
36+
serviceRoot()->requestItemRemoval(this, false);
37+
}
38+
39+
void XmppFeed::removeItself() {
40+
qApp->database()->worker()->write([&](const QSqlDatabase& db) {
41+
DatabaseQueries::deleteFeed(db, this, serviceRoot()->accountId());
42+
});
43+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// For license of this file, see <project-root-folder>/LICENSE.md.
2+
3+
#ifndef XMPPFEED_H
4+
#define XMPPFEED_H
5+
6+
#include <librssguard/services/abstract/feed.h>
7+
8+
class XmppServiceRoot;
9+
10+
class XmppFeed : public Feed {
11+
Q_OBJECT
12+
13+
friend class FormXmppFeedDetails;
14+
15+
public:
16+
explicit XmppFeed(RootItem* parent = nullptr);
17+
18+
virtual bool canBeDeleted() const;
19+
virtual void deleteItem();
20+
21+
private:
22+
XmppServiceRoot* serviceRoot() const;
23+
void removeItself();
24+
};
25+
26+
#endif // TTRSSFEED_H

0 commit comments

Comments
 (0)