summaryrefslogtreecommitdiff
path: root/buteo-plugins
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@jolla.com>2026-04-03 22:55:30 +0200
committerAndrew Branson <andrew.branson@jolla.com>2026-04-04 11:55:25 +0200
commita35c9fa159173388d88ef77e1d31f53488aad094 (patch)
treee4691b5bbf054ca13e35d98d9df653bf9cdc0054 /buteo-plugins
parent5f999f7a4712c4a4d1c89054b544064cfd4b769e (diff)
Generalize for all fediverse accounts
Diffstat (limited to 'buteo-plugins')
-rw-r--r--buteo-plugins/buteo-common/buteo-common.pri2
-rw-r--r--buteo-plugins/buteo-common/buteo-common.pro2
-rw-r--r--buteo-plugins/buteo-plugins.pro8
-rw-r--r--buteo-plugins/buteo-sync-plugin-fediverse-notifications/buteo-sync-plugin-fediverse-notifications.pro (renamed from buteo-plugins/buteo-sync-plugin-mastodon-notifications/buteo-sync-plugin-mastodon-notifications.pro)26
-rw-r--r--buteo-plugins/buteo-sync-plugin-fediverse-notifications/fediverse-notifications.xml (renamed from buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodon-notifications.xml)2
-rw-r--r--buteo-plugins/buteo-sync-plugin-fediverse-notifications/fediverse.Notifications.xml (renamed from buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodon.Notifications.xml)6
-rw-r--r--buteo-plugins/buteo-sync-plugin-fediverse-notifications/fediversedatatypesyncadaptor.cpp (renamed from buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodondatatypesyncadaptor.cpp)64
-rw-r--r--buteo-plugins/buteo-sync-plugin-fediverse-notifications/fediversedatatypesyncadaptor.h (renamed from buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodondatatypesyncadaptor.h)12
-rw-r--r--buteo-plugins/buteo-sync-plugin-fediverse-notifications/fediversenotificationsplugin.cpp (renamed from buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodonnotificationsplugin.cpp)22
-rw-r--r--buteo-plugins/buteo-sync-plugin-fediverse-notifications/fediversenotificationsplugin.h (renamed from buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodonnotificationsplugin.h)16
-rw-r--r--buteo-plugins/buteo-sync-plugin-fediverse-notifications/fediversenotificationssyncadaptor.cpp (renamed from buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodonnotificationssyncadaptor.cpp)162
-rw-r--r--buteo-plugins/buteo-sync-plugin-fediverse-notifications/fediversenotificationssyncadaptor.h (renamed from buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodonnotificationssyncadaptor.h)14
-rw-r--r--buteo-plugins/buteo-sync-plugin-fediverse-posts/buteo-sync-plugin-fediverse-posts.pro (renamed from buteo-plugins/buteo-sync-plugin-mastodon-posts/buteo-sync-plugin-mastodon-posts.pro)22
-rw-r--r--buteo-plugins/buteo-sync-plugin-fediverse-posts/fediverse-posts.xml (renamed from buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodon-posts.xml)2
-rw-r--r--buteo-plugins/buteo-sync-plugin-fediverse-posts/fediverse.Posts.xml (renamed from buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodon.Posts.xml)6
-rw-r--r--buteo-plugins/buteo-sync-plugin-fediverse-posts/fediversedatatypesyncadaptor.cpp (renamed from buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodondatatypesyncadaptor.cpp)70
-rw-r--r--buteo-plugins/buteo-sync-plugin-fediverse-posts/fediversedatatypesyncadaptor.h (renamed from buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodondatatypesyncadaptor.h)14
-rw-r--r--buteo-plugins/buteo-sync-plugin-fediverse-posts/fediversepostsplugin.cpp (renamed from buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodonpostsplugin.cpp)18
-rw-r--r--buteo-plugins/buteo-sync-plugin-fediverse-posts/fediversepostsplugin.h (renamed from buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodonpostsplugin.h)16
-rw-r--r--buteo-plugins/buteo-sync-plugin-fediverse-posts/fediversepostssyncadaptor.cpp (renamed from buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodonpostssyncadaptor.cpp)47
-rw-r--r--buteo-plugins/buteo-sync-plugin-fediverse-posts/fediversepostssyncadaptor.h (renamed from buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodonpostssyncadaptor.h)20
21 files changed, 282 insertions, 269 deletions
diff --git a/buteo-plugins/buteo-common/buteo-common.pri b/buteo-plugins/buteo-common/buteo-common.pri
index 83452ac..422d98f 100644
--- a/buteo-plugins/buteo-common/buteo-common.pri
+++ b/buteo-plugins/buteo-common/buteo-common.pri
@@ -10,4 +10,4 @@ QT += dbus
CONFIG += link_pkgconfig
PKGCONFIG += accounts-qt5 buteosyncfw5 socialcache libsignon-qt5 libsailfishkeyprovider
-LIBS += -L$$PWD -lmastodonbuteocommon
+LIBS += -L$$PWD -lfediversebuteocommon
diff --git a/buteo-plugins/buteo-common/buteo-common.pro b/buteo-plugins/buteo-common/buteo-common.pro
index c0b84a9..70a8332 100644
--- a/buteo-plugins/buteo-common/buteo-common.pro
+++ b/buteo-plugins/buteo-common/buteo-common.pro
@@ -4,7 +4,7 @@
TEMPLATE = lib
-TARGET = mastodonbuteocommon
+TARGET = fediversebuteocommon
TARGET = $$qtLibraryTarget($$TARGET)
QT -= gui
diff --git a/buteo-plugins/buteo-plugins.pro b/buteo-plugins/buteo-plugins.pro
index ead60e6..7938956 100644
--- a/buteo-plugins/buteo-plugins.pro
+++ b/buteo-plugins/buteo-plugins.pro
@@ -5,8 +5,8 @@
TEMPLATE = subdirs
SUBDIRS += \
buteo-common \
- buteo-sync-plugin-mastodon-posts \
- buteo-sync-plugin-mastodon-notifications
+ buteo-sync-plugin-fediverse-posts \
+ buteo-sync-plugin-fediverse-notifications
-buteo-sync-plugin-mastodon-posts.depends = buteo-common
-buteo-sync-plugin-mastodon-notifications.depends = buteo-common
+buteo-sync-plugin-fediverse-posts.depends = buteo-common
+buteo-sync-plugin-fediverse-notifications.depends = buteo-common
diff --git a/buteo-plugins/buteo-sync-plugin-mastodon-notifications/buteo-sync-plugin-mastodon-notifications.pro b/buteo-plugins/buteo-sync-plugin-fediverse-notifications/buteo-sync-plugin-fediverse-notifications.pro
index d16cc3d..0ba9d2f 100644
--- a/buteo-plugins/buteo-sync-plugin-mastodon-notifications/buteo-sync-plugin-mastodon-notifications.pro
+++ b/buteo-plugins/buteo-sync-plugin-fediverse-notifications/buteo-sync-plugin-fediverse-notifications.pro
@@ -2,15 +2,15 @@
#
# SPDX-License-Identifier: BSD-3-Clause
-TARGET = mastodon-notifications-client
+TARGET = fediverse-notifications-client
QT -= gui
include($$PWD/../buteo-common/buteo-common.pri)
include($$PWD/../../common/common.pri)
-TS_FILE = $$OUT_PWD/lipstick-jolla-home-mastodon-notifications.ts
-EE_QM = $$OUT_PWD/lipstick-jolla-home-mastodon-notifications_eng_en.qm
+TS_FILE = $$OUT_PWD/lipstick-jolla-home-fediverse-notifications.ts
+EE_QM = $$OUT_PWD/lipstick-jolla-home-fediverse-notifications_eng_en.qm
ts.commands += lupdate $$PWD -ts $$TS_FILE
ts.CONFIG += no_check_exist no_link
@@ -40,27 +40,27 @@ PKGCONFIG += mlite5 nemonotifications-qt5
INCLUDEPATH += $$PWD
SOURCES += \
- $$PWD/mastodondatatypesyncadaptor.cpp \
- $$PWD/mastodonnotificationsplugin.cpp \
- $$PWD/mastodonnotificationssyncadaptor.cpp
+ $$PWD/fediversedatatypesyncadaptor.cpp \
+ $$PWD/fediversenotificationsplugin.cpp \
+ $$PWD/fediversenotificationssyncadaptor.cpp
HEADERS += \
- $$PWD/mastodondatatypesyncadaptor.h \
- $$PWD/mastodonnotificationsplugin.h \
- $$PWD/mastodonnotificationssyncadaptor.h
+ $$PWD/fediversedatatypesyncadaptor.h \
+ $$PWD/fediversenotificationsplugin.h \
+ $$PWD/fediversenotificationssyncadaptor.h
OTHER_FILES += \
- $$PWD/mastodon-notifications.xml \
- $$PWD/mastodon.Notifications.xml
+ $$PWD/fediverse-notifications.xml \
+ $$PWD/fediverse.Notifications.xml
TEMPLATE = lib
CONFIG += plugin
target.path = $$[QT_INSTALL_LIBS]/buteo-plugins-qt5/oopp
sync.path = /etc/buteo/profiles/sync
-sync.files = mastodon.Notifications.xml
+sync.files = fediverse.Notifications.xml
client.path = /etc/buteo/profiles/client
-client.files = mastodon-notifications.xml
+client.files = fediverse-notifications.xml
INSTALLS += target sync client ts_install engineering_english_install
diff --git a/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodon-notifications.xml b/buteo-plugins/buteo-sync-plugin-fediverse-notifications/fediverse-notifications.xml
index 3284d61..81de349 100644
--- a/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodon-notifications.xml
+++ b/buteo-plugins/buteo-sync-plugin-fediverse-notifications/fediverse-notifications.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- SPDX-FileCopyrightText: 2013 - 2026 Jolla Ltd. -->
<!-- SPDX-License-Identifier: BSD-3-Clause -->
-<profile name="mastodon-notifications" type="client" >
+<profile name="fediverse-notifications" type="client" >
<field name="Sync Direction" />
</profile>
diff --git a/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodon.Notifications.xml b/buteo-plugins/buteo-sync-plugin-fediverse-notifications/fediverse.Notifications.xml
index 05d5218..bf0ecee 100644
--- a/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodon.Notifications.xml
+++ b/buteo-plugins/buteo-sync-plugin-fediverse-notifications/fediverse.Notifications.xml
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- SPDX-FileCopyrightText: 2013 - 2026 Jolla Ltd. -->
<!-- SPDX-License-Identifier: BSD-3-Clause -->
-<profile name="mastodon.Notifications" type="sync" >
+<profile name="fediverse.Notifications" type="sync" >
<key name="category" value="eventfeed" />
<key name="enabled" value="true" />
<key name="use_accounts" value="false" />
<key name="destinationtype" value="online" />
<key name="hidden" value="true" />
- <key name="displayname" value="Mastodon Notifications"/>
+ <key name="displayname" value="Fediverse Notifications"/>
<schedule enabled="true" interval="30" days="1,2,3,4,5,6,7" syncconfiguredtime="" time="" />
- <profile name="mastodon-notifications" type="client" >
+ <profile name="fediverse-notifications" type="client" >
<key name="Sync Direction" value="from-remote" />
</profile>
</profile>
diff --git a/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodondatatypesyncadaptor.cpp b/buteo-plugins/buteo-sync-plugin-fediverse-notifications/fediversedatatypesyncadaptor.cpp
index ddf6686..3d71585 100644
--- a/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodondatatypesyncadaptor.cpp
+++ b/buteo-plugins/buteo-sync-plugin-fediverse-notifications/fediversedatatypesyncadaptor.cpp
@@ -18,8 +18,8 @@
**
****************************************************************************/
-#include "mastodondatatypesyncadaptor.h"
-#include "mastodonauthutils.h"
+#include "fediversedatatypesyncadaptor.h"
+#include "fediverseauthutils.h"
#include <QtCore/QLoggingCategory>
#include <QtCore/QVariantMap>
@@ -36,23 +36,23 @@
#include <SignOn/AuthSession>
#include <SignOn/SessionData>
-Q_LOGGING_CATEGORY(lcMastodonNotificationsSync, "buteo.plugin.mastodon.notifications.sync", QtWarningMsg)
+Q_LOGGING_CATEGORY(lcFediverseNotificationsSync, "buteo.plugin.fediverse.notifications.sync", QtWarningMsg)
-MastodonNotificationsDataTypeSyncAdaptor::MastodonNotificationsDataTypeSyncAdaptor(
+FediverseNotificationsDataTypeSyncAdaptor::FediverseNotificationsDataTypeSyncAdaptor(
SocialNetworkSyncAdaptor::DataType dataType,
QObject *parent)
- : SocialNetworkSyncAdaptor(QStringLiteral("mastodon"), dataType, 0, parent)
+ : SocialNetworkSyncAdaptor(QStringLiteral("fediverse"), dataType, 0, parent)
{
}
-MastodonNotificationsDataTypeSyncAdaptor::~MastodonNotificationsDataTypeSyncAdaptor()
+FediverseNotificationsDataTypeSyncAdaptor::~FediverseNotificationsDataTypeSyncAdaptor()
{
}
-void MastodonNotificationsDataTypeSyncAdaptor::sync(const QString &dataTypeString, int accountId)
+void FediverseNotificationsDataTypeSyncAdaptor::sync(const QString &dataTypeString, int accountId)
{
if (dataTypeString != SocialNetworkSyncAdaptor::dataTypeName(m_dataType)) {
- qCWarning(lcMastodonNotificationsSync) << "Mastodon" << SocialNetworkSyncAdaptor::dataTypeName(m_dataType)
+ qCWarning(lcFediverseNotificationsSync) << "Fediverse" << SocialNetworkSyncAdaptor::dataTypeName(m_dataType)
<< "sync adaptor was asked to sync" << dataTypeString;
setStatus(SocialNetworkSyncAdaptor::Error);
return;
@@ -60,14 +60,14 @@ void MastodonNotificationsDataTypeSyncAdaptor::sync(const QString &dataTypeStrin
setStatus(SocialNetworkSyncAdaptor::Busy);
updateDataForAccount(accountId);
- qCDebug(lcMastodonNotificationsSync) << "successfully triggered sync with profile:" << m_accountSyncProfile->name();
+ qCDebug(lcFediverseNotificationsSync) << "successfully triggered sync with profile:" << m_accountSyncProfile->name();
}
-void MastodonNotificationsDataTypeSyncAdaptor::updateDataForAccount(int accountId)
+void FediverseNotificationsDataTypeSyncAdaptor::updateDataForAccount(int accountId)
{
Accounts::Account *account = Accounts::Account::fromId(m_accountManager, accountId, this);
if (!account) {
- qCWarning(lcMastodonNotificationsSync) << "existing account with id" << accountId << "couldn't be retrieved";
+ qCWarning(lcFediverseNotificationsSync) << "existing account with id" << accountId << "couldn't be retrieved";
setStatus(SocialNetworkSyncAdaptor::Error);
return;
}
@@ -76,17 +76,17 @@ void MastodonNotificationsDataTypeSyncAdaptor::updateDataForAccount(int accountI
signIn(account);
}
-QString MastodonNotificationsDataTypeSyncAdaptor::apiHost(int accountId) const
+QString FediverseNotificationsDataTypeSyncAdaptor::apiHost(int accountId) const
{
- return m_apiHosts.value(accountId, QStringLiteral("https://mastodon.social"));
+ return m_apiHosts.value(accountId, FediverseAuthUtils::defaultApiHost());
}
-QString MastodonNotificationsDataTypeSyncAdaptor::authServiceName() const
+QString FediverseNotificationsDataTypeSyncAdaptor::authServiceName() const
{
return syncServiceName();
}
-void MastodonNotificationsDataTypeSyncAdaptor::errorHandler(QNetworkReply::NetworkError err)
+void FediverseNotificationsDataTypeSyncAdaptor::errorHandler(QNetworkReply::NetworkError err)
{
QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
if (!reply) {
@@ -96,7 +96,7 @@ void MastodonNotificationsDataTypeSyncAdaptor::errorHandler(QNetworkReply::Netwo
const int accountId = reply->property("accountId").toInt();
const int httpStatus = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
- qCWarning(lcMastodonNotificationsSync) << SocialNetworkSyncAdaptor::dataTypeName(m_dataType)
+ qCWarning(lcFediverseNotificationsSync) << SocialNetworkSyncAdaptor::dataTypeName(m_dataType)
<< "request with account" << accountId
<< "experienced error:" << err
<< "HTTP:" << httpStatus;
@@ -111,7 +111,7 @@ void MastodonNotificationsDataTypeSyncAdaptor::errorHandler(QNetworkReply::Netwo
}
}
-void MastodonNotificationsDataTypeSyncAdaptor::sslErrorsHandler(const QList<QSslError> &errs)
+void FediverseNotificationsDataTypeSyncAdaptor::sslErrorsHandler(const QList<QSslError> &errs)
{
QString sslerrs;
foreach (const QSslError &e, errs) {
@@ -121,24 +121,24 @@ void MastodonNotificationsDataTypeSyncAdaptor::sslErrorsHandler(const QList<QSsl
sslerrs.chop(2);
}
- qCWarning(lcMastodonNotificationsSync) << SocialNetworkSyncAdaptor::dataTypeName(m_dataType)
+ qCWarning(lcFediverseNotificationsSync) << SocialNetworkSyncAdaptor::dataTypeName(m_dataType)
<< "request with account" << sender()->property("accountId").toInt()
<< "experienced ssl errors:" << sslerrs;
sender()->setProperty("isError", QVariant::fromValue<bool>(true));
}
-void MastodonNotificationsDataTypeSyncAdaptor::setCredentialsNeedUpdate(Accounts::Account *account)
+void FediverseNotificationsDataTypeSyncAdaptor::setCredentialsNeedUpdate(Accounts::Account *account)
{
- qCInfo(lcMastodonNotificationsSync) << "sociald:Mastodon: setting CredentialsNeedUpdate to true for account:" << account->id();
+ qCInfo(lcFediverseNotificationsSync) << "sociald:Fediverse: setting CredentialsNeedUpdate to true for account:" << account->id();
Accounts::Service srv(m_accountManager->service(authServiceName()));
account->selectService(srv);
account->setValue(QStringLiteral("CredentialsNeedUpdate"), QVariant::fromValue<bool>(true));
- account->setValue(QStringLiteral("CredentialsNeedUpdateFrom"), QVariant::fromValue<QString>(QString::fromLatin1("sociald-mastodon")));
+ account->setValue(QStringLiteral("CredentialsNeedUpdateFrom"), QVariant::fromValue<QString>(QString::fromLatin1("sociald-fediverse")));
account->selectService(Accounts::Service());
account->syncAndBlock();
}
-void MastodonNotificationsDataTypeSyncAdaptor::signIn(Accounts::Account *account)
+void FediverseNotificationsDataTypeSyncAdaptor::signIn(Accounts::Account *account)
{
const int accountId = account->id();
if (!checkAccount(account)) {
@@ -153,7 +153,7 @@ void MastodonNotificationsDataTypeSyncAdaptor::signIn(Accounts::Account *account
? SignOn::Identity::existingIdentity(account->credentialsId())
: 0;
if (!identity) {
- qCWarning(lcMastodonNotificationsSync) << "account" << accountId << "has no valid credentials, cannot sign in";
+ qCWarning(lcFediverseNotificationsSync) << "account" << accountId << "has no valid credentials, cannot sign in";
decrementSemaphore(accountId);
return;
}
@@ -163,14 +163,14 @@ void MastodonNotificationsDataTypeSyncAdaptor::signIn(Accounts::Account *account
const QString mechanism = accSrv.authData().mechanism();
SignOn::AuthSession *session = identity->createSession(method);
if (!session) {
- qCWarning(lcMastodonNotificationsSync) << "could not create signon session for account" << accountId;
+ qCWarning(lcFediverseNotificationsSync) << "could not create signon session for account" << accountId;
identity->deleteLater();
decrementSemaphore(accountId);
return;
}
QVariantMap signonSessionData = accSrv.authData().parameters();
- MastodonAuthUtils::addSignOnSessionParameters(account, &signonSessionData);
+ FediverseAuthUtils::addSignOnSessionParameters(account, &signonSessionData);
connect(session, SIGNAL(response(SignOn::SessionData)),
this, SLOT(signOnResponse(SignOn::SessionData)),
@@ -184,14 +184,14 @@ void MastodonNotificationsDataTypeSyncAdaptor::signIn(Accounts::Account *account
session->process(SignOn::SessionData(signonSessionData), mechanism);
}
-void MastodonNotificationsDataTypeSyncAdaptor::signOnError(const SignOn::Error &error)
+void FediverseNotificationsDataTypeSyncAdaptor::signOnError(const SignOn::Error &error)
{
SignOn::AuthSession *session = qobject_cast<SignOn::AuthSession*>(sender());
Accounts::Account *account = session->property("account").value<Accounts::Account*>();
SignOn::Identity *identity = session->property("identity").value<SignOn::Identity*>();
const int accountId = account->id();
- qCWarning(lcMastodonNotificationsSync) << "credentials for account with id" << accountId
+ qCWarning(lcFediverseNotificationsSync) << "credentials for account with id" << accountId
<< "couldn't be retrieved:" << error.type() << error.message();
if (error.type() == SignOn::Error::UserInteraction) {
@@ -207,9 +207,9 @@ void MastodonNotificationsDataTypeSyncAdaptor::signOnError(const SignOn::Error &
decrementSemaphore(accountId);
}
-void MastodonNotificationsDataTypeSyncAdaptor::signOnResponse(const SignOn::SessionData &responseData)
+void FediverseNotificationsDataTypeSyncAdaptor::signOnResponse(const SignOn::SessionData &responseData)
{
- const QVariantMap data = MastodonAuthUtils::responseDataToMap(responseData);
+ const QVariantMap data = FediverseAuthUtils::responseDataToMap(responseData);
QString accessToken;
SignOn::AuthSession *session = qobject_cast<SignOn::AuthSession*>(sender());
@@ -217,13 +217,13 @@ void MastodonNotificationsDataTypeSyncAdaptor::signOnResponse(const SignOn::Sess
SignOn::Identity *identity = session->property("identity").value<SignOn::Identity*>();
const int accountId = account->id();
- accessToken = MastodonAuthUtils::accessToken(data);
+ accessToken = FediverseAuthUtils::accessToken(data);
if (accessToken.isEmpty()) {
- qCWarning(lcMastodonNotificationsSync) << "signon response for account with id" << accountId
+ qCWarning(lcFediverseNotificationsSync) << "signon response for account with id" << accountId
<< "contained no access token; keys:" << data.keys();
}
- m_apiHosts.insert(accountId, MastodonAuthUtils::normalizeApiHost(account->value(QStringLiteral("api/Host")).toString()));
+ m_apiHosts.insert(accountId, FediverseAuthUtils::normalizeApiHost(account->value(QStringLiteral("api/Host")).toString()));
session->disconnect(this);
identity->destroySession(session);
diff --git a/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodondatatypesyncadaptor.h b/buteo-plugins/buteo-sync-plugin-fediverse-notifications/fediversedatatypesyncadaptor.h
index 3c61ade..0acbc87 100644
--- a/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodondatatypesyncadaptor.h
+++ b/buteo-plugins/buteo-sync-plugin-fediverse-notifications/fediversedatatypesyncadaptor.h
@@ -18,8 +18,8 @@
**
****************************************************************************/
-#ifndef MASTODONNOTIFICATIONSDATATYPESYNCADAPTOR_H
-#define MASTODONNOTIFICATIONSDATATYPESYNCADAPTOR_H
+#ifndef FEDIVERSENOTIFICATIONSDATATYPESYNCADAPTOR_H
+#define FEDIVERSENOTIFICATIONSDATATYPESYNCADAPTOR_H
#include "socialnetworksyncadaptor.h"
@@ -35,13 +35,13 @@ namespace SignOn {
class SessionData;
}
-class MastodonNotificationsDataTypeSyncAdaptor : public SocialNetworkSyncAdaptor
+class FediverseNotificationsDataTypeSyncAdaptor : public SocialNetworkSyncAdaptor
{
Q_OBJECT
public:
- MastodonNotificationsDataTypeSyncAdaptor(SocialNetworkSyncAdaptor::DataType dataType, QObject *parent);
- virtual ~MastodonNotificationsDataTypeSyncAdaptor();
+ FediverseNotificationsDataTypeSyncAdaptor(SocialNetworkSyncAdaptor::DataType dataType, QObject *parent);
+ virtual ~FediverseNotificationsDataTypeSyncAdaptor();
void sync(const QString &dataTypeString, int accountId) override;
@@ -67,4 +67,4 @@ private:
QMap<int, QString> m_apiHosts;
};
-#endif // MASTODONNOTIFICATIONSDATATYPESYNCADAPTOR_H
+#endif // FEDIVERSENOTIFICATIONSDATATYPESYNCADAPTOR_H
diff --git a/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodonnotificationsplugin.cpp b/buteo-plugins/buteo-sync-plugin-fediverse-notifications/fediversenotificationsplugin.cpp
index 9dd3724..c518e7e 100644
--- a/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodonnotificationsplugin.cpp
+++ b/buteo-plugins/buteo-sync-plugin-fediverse-notifications/fediversenotificationsplugin.cpp
@@ -18,8 +18,8 @@
**
****************************************************************************/
-#include "mastodonnotificationsplugin.h"
-#include "mastodonnotificationssyncadaptor.h"
+#include "fediversenotificationsplugin.h"
+#include "fediversenotificationssyncadaptor.h"
#include "socialnetworksyncadaptor.h"
#include <QCoreApplication>
@@ -55,12 +55,12 @@ void ensureNotificationTranslations()
}
AppTranslator *engineeringEnglish = new AppTranslator(app);
- engineeringEnglish->load(QStringLiteral("lipstick-jolla-home-mastodon-notifications_eng_en"),
+ engineeringEnglish->load(QStringLiteral("lipstick-jolla-home-fediverse-notifications_eng_en"),
QStringLiteral("/usr/share/translations"));
AppTranslator *translator = new AppTranslator(app);
translator->load(QLocale(),
- QStringLiteral("lipstick-jolla-home-mastodon-notifications"),
+ QStringLiteral("lipstick-jolla-home-fediverse-notifications"),
QStringLiteral("-"),
QStringLiteral("/usr/share/translations"));
@@ -68,29 +68,29 @@ void ensureNotificationTranslations()
}
}
-MastodonNotificationsPlugin::MastodonNotificationsPlugin(const QString& pluginName,
+FediverseNotificationsPlugin::FediverseNotificationsPlugin(const QString& pluginName,
const Buteo::SyncProfile& profile,
Buteo::PluginCbInterface *callbackInterface)
: SocialdButeoPlugin(pluginName, profile, callbackInterface,
- QStringLiteral("mastodon"),
+ QStringLiteral("fediverse"),
SocialNetworkSyncAdaptor::dataTypeName(SocialNetworkSyncAdaptor::Notifications))
{
ensureNotificationTranslations();
}
-MastodonNotificationsPlugin::~MastodonNotificationsPlugin()
+FediverseNotificationsPlugin::~FediverseNotificationsPlugin()
{
}
-SocialNetworkSyncAdaptor *MastodonNotificationsPlugin::createSocialNetworkSyncAdaptor()
+SocialNetworkSyncAdaptor *FediverseNotificationsPlugin::createSocialNetworkSyncAdaptor()
{
- return new MastodonNotificationsSyncAdaptor(this);
+ return new FediverseNotificationsSyncAdaptor(this);
}
-Buteo::ClientPlugin* MastodonNotificationsPluginLoader::createClientPlugin(
+Buteo::ClientPlugin* FediverseNotificationsPluginLoader::createClientPlugin(
const QString& pluginName,
const Buteo::SyncProfile& profile,
Buteo::PluginCbInterface* cbInterface)
{
- return new MastodonNotificationsPlugin(pluginName, profile, cbInterface);
+ return new FediverseNotificationsPlugin(pluginName, profile, cbInterface);
}
diff --git a/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodonnotificationsplugin.h b/buteo-plugins/buteo-sync-plugin-fediverse-notifications/fediversenotificationsplugin.h
index a5a7b37..002aeb6 100644
--- a/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodonnotificationsplugin.h
+++ b/buteo-plugins/buteo-sync-plugin-fediverse-notifications/fediversenotificationsplugin.h
@@ -18,31 +18,31 @@
**
****************************************************************************/
-#ifndef MASTODONNOTIFICATIONSPLUGIN_H
-#define MASTODONNOTIFICATIONSPLUGIN_H
+#ifndef FEDIVERSENOTIFICATIONSPLUGIN_H
+#define FEDIVERSENOTIFICATIONSPLUGIN_H
#include "socialdbuteoplugin.h"
#include <buteosyncfw5/SyncPluginLoader.h>
-class Q_DECL_EXPORT MastodonNotificationsPlugin : public SocialdButeoPlugin
+class Q_DECL_EXPORT FediverseNotificationsPlugin : public SocialdButeoPlugin
{
Q_OBJECT
public:
- MastodonNotificationsPlugin(const QString& pluginName,
+ FediverseNotificationsPlugin(const QString& pluginName,
const Buteo::SyncProfile& profile,
Buteo::PluginCbInterface *cbInterface);
- ~MastodonNotificationsPlugin();
+ ~FediverseNotificationsPlugin();
protected:
SocialNetworkSyncAdaptor *createSocialNetworkSyncAdaptor() override;
};
-class MastodonNotificationsPluginLoader : public Buteo::SyncPluginLoader
+class FediverseNotificationsPluginLoader : public Buteo::SyncPluginLoader
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.sailfishos.plugins.sync.MastodonNotificationsPluginLoader")
+ Q_PLUGIN_METADATA(IID "org.sailfishos.plugins.sync.FediverseNotificationsPluginLoader")
Q_INTERFACES(Buteo::SyncPluginLoader)
public:
@@ -51,4 +51,4 @@ public:
Buteo::PluginCbInterface* cbInterface) override;
};
-#endif // MASTODONNOTIFICATIONSPLUGIN_H
+#endif // FEDIVERSENOTIFICATIONSPLUGIN_H
diff --git a/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodonnotificationssyncadaptor.cpp b/buteo-plugins/buteo-sync-plugin-fediverse-notifications/fediversenotificationssyncadaptor.cpp
index 98dbbc8..2a84637 100644
--- a/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodonnotificationssyncadaptor.cpp
+++ b/buteo-plugins/buteo-sync-plugin-fediverse-notifications/fediversenotificationssyncadaptor.cpp
@@ -18,8 +18,8 @@
**
****************************************************************************/
-#include "mastodonnotificationssyncadaptor.h"
-#include "mastodontextutils.h"
+#include "fediversenotificationssyncadaptor.h"
+#include "fediversetextutils.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QLoggingCategory>
@@ -51,79 +51,79 @@
)
namespace {
- Q_LOGGING_CATEGORY(lcMastodonNotifications, "buteo.plugin.mastodon.notifications", QtWarningMsg)
+ Q_LOGGING_CATEGORY(lcFediverseNotifications, "buteo.plugin.fediverse.notifications", QtWarningMsg)
- const char *const NotificationCategory = "x-nemo.social.mastodon.notification";
+ const char *const NotificationCategory = "x-nemo.social.fediverse.notification";
const char *const NotificationIdHint = "x-nemo.sociald.notification-id";
const char *const LastFetchedNotificationIdKey = "LastFetchedNotificationId";
const int NotificationsPageLimit = 80;
const uint NotificationDismissedReason = 1;
//% "mentioned you"
- const char *const TrIdMentionedYou = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-mentioned_you");
+ const char *const TrIdMentionedYou = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-mentioned_you");
//% "boosted your post"
- const char *const TrIdBoostedYourPost = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-boosted_your_post");
+ const char *const TrIdBoostedYourPost = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-boosted_your_post");
//% "favourited your post"
- const char *const TrIdFavouritedYourPost = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-favourited_your_post");
+ const char *const TrIdFavouritedYourPost = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-favourited_your_post");
//% "started following you"
- const char *const TrIdStartedFollowingYou = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-started_following_you");
+ const char *const TrIdStartedFollowingYou = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-started_following_you");
//% "requested to follow you"
- const char *const TrIdRequestedToFollowYou = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-requested_to_follow_you");
+ const char *const TrIdRequestedToFollowYou = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-requested_to_follow_you");
//% "interacted with your poll"
- const char *const TrIdInteractedWithYourPoll = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-interacted_with_your_poll");
+ const char *const TrIdInteractedWithYourPoll = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-interacted_with_your_poll");
//% "posted"
- const char *const TrIdPosted = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-posted");
+ const char *const TrIdPosted = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-posted");
//% "updated a post"
- const char *const TrIdUpdatedPost = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-updated_post");
+ const char *const TrIdUpdatedPost = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-updated_post");
//% "signed up"
- const char *const TrIdSignedUp = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-signed_up");
+ const char *const TrIdSignedUp = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-signed_up");
//% "reported an account"
- const char *const TrIdReportedAccount = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-reported_account");
+ const char *const TrIdReportedAccount = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-reported_account");
//% "received a moderation warning"
- const char *const TrIdReceivedModerationWarning = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-received_moderation_warning");
+ const char *const TrIdReceivedModerationWarning = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-received_moderation_warning");
//% "quoted your post"
- const char *const TrIdQuotedYourPost = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-quoted_your_post");
+ const char *const TrIdQuotedYourPost = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-quoted_your_post");
//% "updated a post that quoted you"
- const char *const TrIdUpdatedQuotedPost = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-updated_quoted_post");
+ const char *const TrIdUpdatedQuotedPost = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-updated_quoted_post");
//% "sent you a notification"
- const char *const TrIdSentNotification = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-sent_notification");
+ const char *const TrIdSentNotification = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-sent_notification");
//% "An admin blocked an instance"
- const char *const TrIdAdminBlockedInstance = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-admin_blocked_instance");
+ const char *const TrIdAdminBlockedInstance = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-admin_blocked_instance");
//% "An admin blocked %1"
- const char *const TrIdAdminBlockedTarget = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-admin_blocked_target");
+ const char *const TrIdAdminBlockedTarget = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-admin_blocked_target");
//% "You blocked an instance"
- const char *const TrIdYouBlockedInstance = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-you_blocked_instance");
+ const char *const TrIdYouBlockedInstance = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-you_blocked_instance");
//% "You blocked %1"
- const char *const TrIdYouBlockedTarget = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-you_blocked_target");
+ const char *const TrIdYouBlockedTarget = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-you_blocked_target");
//% "An account was suspended"
- const char *const TrIdAccountSuspended = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-account_suspended");
+ const char *const TrIdAccountSuspended = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-account_suspended");
//% "%1 was suspended"
- const char *const TrIdTargetSuspended = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-target_suspended");
+ const char *const TrIdTargetSuspended = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-target_suspended");
//% "Some follow relationships were severed"
- const char *const TrIdRelationshipsSevered = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-relationships_severed");
+ const char *const TrIdRelationshipsSevered = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-relationships_severed");
//% "%1 (%2 followers, %3 following removed)"
- const char *const TrIdRelationshipsSummary = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-relationships_summary");
+ const char *const TrIdRelationshipsSummary = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-relationships_summary");
//% "A moderator sent you a warning"
- const char *const TrIdModeratorWarningNone = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-moderator_warning_none");
+ const char *const TrIdModeratorWarningNone = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-moderator_warning_none");
//% "A moderator disabled your account"
- const char *const TrIdModeratorWarningDisable = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-moderator_warning_disable");
+ const char *const TrIdModeratorWarningDisable = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-moderator_warning_disable");
//% "A moderator marked specific posts as sensitive"
- const char *const TrIdModeratorWarningSpecificSensitive = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-moderator_warning_specific_sensitive");
+ const char *const TrIdModeratorWarningSpecificSensitive = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-moderator_warning_specific_sensitive");
//% "A moderator deleted specific posts"
- const char *const TrIdModeratorWarningDeletePosts = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-moderator_warning_delete_posts");
+ const char *const TrIdModeratorWarningDeletePosts = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-moderator_warning_delete_posts");
//% "A moderator marked all your posts as sensitive"
- const char *const TrIdModeratorWarningAllSensitive = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-moderator_warning_all_sensitive");
+ const char *const TrIdModeratorWarningAllSensitive = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-moderator_warning_all_sensitive");
//% "A moderator limited your account"
- const char *const TrIdModeratorWarningSilence = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-moderator_warning_silence");
+ const char *const TrIdModeratorWarningSilence = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-moderator_warning_silence");
//% "A moderator suspended your account"
- const char *const TrIdModeratorWarningSuspend = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-moderator_warning_suspend");
+ const char *const TrIdModeratorWarningSuspend = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-moderator_warning_suspend");
- //% "Mastodon"
- const char *const TrIdMastodon = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-mastodon");
+ //% "Fediverse"
+ const char *const TrIdFediverse = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-fediverse");
//% "New notification"
- const char *const TrIdNewNotification = QT_TRID_NOOP("lipstick-jolla-home-la-mastodon-notification-new_notification");
+ const char *const TrIdNewNotification = QT_TRID_NOOP("lipstick-jolla-home-la-fediverse-notification-new_notification");
QString displayNameForAccount(const QJsonObject &account)
{
@@ -290,27 +290,27 @@ namespace {
}
-MastodonNotificationsSyncAdaptor::MastodonNotificationsSyncAdaptor(QObject *parent)
- : MastodonNotificationsDataTypeSyncAdaptor(SocialNetworkSyncAdaptor::Notifications, parent)
+FediverseNotificationsSyncAdaptor::FediverseNotificationsSyncAdaptor(QObject *parent)
+ : FediverseNotificationsDataTypeSyncAdaptor(SocialNetworkSyncAdaptor::Notifications, parent)
{
setInitialActive(true);
}
-MastodonNotificationsSyncAdaptor::~MastodonNotificationsSyncAdaptor()
+FediverseNotificationsSyncAdaptor::~FediverseNotificationsSyncAdaptor()
{
}
-QString MastodonNotificationsSyncAdaptor::syncServiceName() const
+QString FediverseNotificationsSyncAdaptor::syncServiceName() const
{
- return QStringLiteral("mastodon-notifications");
+ return QStringLiteral("fediverse-notifications");
}
-QString MastodonNotificationsSyncAdaptor::authServiceName() const
+QString FediverseNotificationsSyncAdaptor::authServiceName() const
{
- return QStringLiteral("mastodon-microblog");
+ return QStringLiteral("fediverse-microblog");
}
-void MastodonNotificationsSyncAdaptor::purgeDataForOldAccount(int oldId, SocialNetworkSyncAdaptor::PurgeMode)
+void FediverseNotificationsSyncAdaptor::purgeDataForOldAccount(int oldId, SocialNetworkSyncAdaptor::PurgeMode)
{
closeAccountNotifications(oldId);
@@ -320,33 +320,33 @@ void MastodonNotificationsSyncAdaptor::purgeDataForOldAccount(int oldId, SocialN
saveLastFetchedId(oldId, QString());
}
-void MastodonNotificationsSyncAdaptor::beginSync(int accountId, const QString &accessToken)
+void FediverseNotificationsSyncAdaptor::beginSync(int accountId, const QString &accessToken)
{
m_accessTokens.insert(accountId, accessToken);
m_pendingSyncStates.remove(accountId);
requestUnreadMarker(accountId, accessToken);
}
-void MastodonNotificationsSyncAdaptor::finalize(int accountId)
+void FediverseNotificationsSyncAdaptor::finalize(int accountId)
{
if (syncAborted()) {
- qCInfo(lcMastodonNotifications) << "sync aborted, won't update notifications";
+ qCInfo(lcFediverseNotifications) << "sync aborted, won't update notifications";
}
Q_UNUSED(accountId)
}
-QString MastodonNotificationsSyncAdaptor::sanitizeContent(const QString &content)
+QString FediverseNotificationsSyncAdaptor::sanitizeContent(const QString &content)
{
- return MastodonTextUtils::sanitizeContent(content);
+ return FediverseTextUtils::sanitizeContent(content);
}
-QDateTime MastodonNotificationsSyncAdaptor::parseTimestamp(const QString &timestampString)
+QDateTime FediverseNotificationsSyncAdaptor::parseTimestamp(const QString &timestampString)
{
- return MastodonTextUtils::parseTimestamp(timestampString);
+ return FediverseTextUtils::parseTimestamp(timestampString);
}
-int MastodonNotificationsSyncAdaptor::compareNotificationIds(const QString &left, const QString &right)
+int FediverseNotificationsSyncAdaptor::compareNotificationIds(const QString &left, const QString &right)
{
if (left == right) {
return 0;
@@ -366,12 +366,12 @@ int MastodonNotificationsSyncAdaptor::compareNotificationIds(const QString &left
return left < right ? -1 : 1;
}
-QString MastodonNotificationsSyncAdaptor::notificationObjectKey(int accountId, const QString &notificationId)
+QString FediverseNotificationsSyncAdaptor::notificationObjectKey(int accountId, const QString &notificationId)
{
return QString::number(accountId) + QLatin1Char(':') + notificationId;
}
-QString MastodonNotificationsSyncAdaptor::loadLastFetchedId(int accountId) const
+QString FediverseNotificationsSyncAdaptor::loadLastFetchedId(int accountId) const
{
Accounts::Account *account = Accounts::Account::fromId(m_accountManager, accountId, 0);
if (!account) {
@@ -386,7 +386,7 @@ QString MastodonNotificationsSyncAdaptor::loadLastFetchedId(int accountId) const
return lastFetchedId;
}
-void MastodonNotificationsSyncAdaptor::saveLastFetchedId(int accountId, const QString &lastFetchedId)
+void FediverseNotificationsSyncAdaptor::saveLastFetchedId(int accountId, const QString &lastFetchedId)
{
Accounts::Account *account = Accounts::Account::fromId(m_accountManager, accountId, 0);
if (!account) {
@@ -404,7 +404,7 @@ void MastodonNotificationsSyncAdaptor::saveLastFetchedId(int accountId, const QS
account->deleteLater();
}
-void MastodonNotificationsSyncAdaptor::requestUnreadMarker(int accountId, const QString &accessToken)
+void FediverseNotificationsSyncAdaptor::requestUnreadMarker(int accountId, const QString &accessToken)
{
QUrl url(apiHost(accountId) + QStringLiteral("/api/v1/markers"));
@@ -426,11 +426,11 @@ void MastodonNotificationsSyncAdaptor::requestUnreadMarker(int accountId, const
incrementSemaphore(accountId);
setupReplyTimeout(accountId, reply);
} else {
- qCWarning(lcMastodonNotifications) << "unable to request notifications marker from Mastodon account with id" << accountId;
+ qCWarning(lcFediverseNotifications) << "unable to request notifications marker from Fediverse account with id" << accountId;
}
}
-void MastodonNotificationsSyncAdaptor::finishedUnreadMarkerHandler()
+void FediverseNotificationsSyncAdaptor::finishedUnreadMarkerHandler()
{
QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
if (!reply) {
@@ -449,7 +449,7 @@ void MastodonNotificationsSyncAdaptor::finishedUnreadMarkerHandler()
bool ok = false;
const QJsonObject markerObject = parseJsonObjectReplyData(replyData, &ok);
if (isError || !ok) {
- qCWarning(lcMastodonNotifications) << "unable to parse notifications marker data from request with account"
+ qCWarning(lcFediverseNotifications) << "unable to parse notifications marker data from request with account"
<< accountId << ", got:" << QString::fromUtf8(replyData);
PendingSyncState fallbackState;
fallbackState.accessToken = accessToken;
@@ -482,7 +482,7 @@ void MastodonNotificationsSyncAdaptor::finishedUnreadMarkerHandler()
decrementSemaphore(accountId);
}
-void MastodonNotificationsSyncAdaptor::requestNotifications(int accountId,
+void FediverseNotificationsSyncAdaptor::requestNotifications(int accountId,
const QString &accessToken,
const QString &minId,
const QString &maxId)
@@ -514,11 +514,11 @@ void MastodonNotificationsSyncAdaptor::requestNotifications(int accountId,
incrementSemaphore(accountId);
setupReplyTimeout(accountId, reply);
} else {
- qCWarning(lcMastodonNotifications) << "unable to request notifications from Mastodon account with id" << accountId;
+ qCWarning(lcFediverseNotifications) << "unable to request notifications from Fediverse account with id" << accountId;
}
}
-void MastodonNotificationsSyncAdaptor::requestMarkRead(int accountId,
+void FediverseNotificationsSyncAdaptor::requestMarkRead(int accountId,
const QString &accessToken,
const QString &lastReadId)
{
@@ -542,11 +542,11 @@ void MastodonNotificationsSyncAdaptor::requestMarkRead(int accountId,
incrementSemaphore(accountId);
setupReplyTimeout(accountId, reply);
} else {
- qCWarning(lcMastodonNotifications) << "unable to update notifications marker for Mastodon account with id" << accountId;
+ qCWarning(lcFediverseNotifications) << "unable to update notifications marker for Fediverse account with id" << accountId;
}
}
-void MastodonNotificationsSyncAdaptor::finishedNotificationsHandler()
+void FediverseNotificationsSyncAdaptor::finishedNotificationsHandler()
{
QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
if (!reply) {
@@ -580,7 +580,7 @@ void MastodonNotificationsSyncAdaptor::finishedNotificationsHandler()
const QJsonArray notifications = parseJsonArrayReplyData(replyData, &ok);
if (!isError && ok) {
if (!notifications.size()) {
- qCDebug(lcMastodonNotifications) << "no notifications received for account" << accountId;
+ qCDebug(lcFediverseNotifications) << "no notifications received for account" << accountId;
if (state.markerKnown) {
closeAccountNotifications(accountId);
}
@@ -682,7 +682,7 @@ void MastodonNotificationsSyncAdaptor::finishedNotificationsHandler()
PendingNotification pendingNotification;
pendingNotification.notificationId = notificationId;
pendingNotification.summary = useSystemSummary(notificationType)
- ? qtTrId(TrIdMastodon)
+ ? qtTrId(TrIdFediverse)
: displayName;
pendingNotification.body = body;
pendingNotification.link = url;
@@ -737,7 +737,7 @@ void MastodonNotificationsSyncAdaptor::finishedNotificationsHandler()
maybeMarkAccountNotificationsRead(accountId, state.accessToken);
}
} else {
- qCWarning(lcMastodonNotifications) << "unable to parse notifications data from request with account" << accountId
+ qCWarning(lcFediverseNotifications) << "unable to parse notifications data from request with account" << accountId
<< ", got:" << QString::fromUtf8(replyData);
}
@@ -745,7 +745,7 @@ void MastodonNotificationsSyncAdaptor::finishedNotificationsHandler()
decrementSemaphore(accountId);
}
-void MastodonNotificationsSyncAdaptor::finishedMarkReadHandler()
+void FediverseNotificationsSyncAdaptor::finishedMarkReadHandler()
{
QNetworkReply *reply = qobject_cast<QNetworkReply *>(sender());
if (!reply) {
@@ -769,14 +769,14 @@ void MastodonNotificationsSyncAdaptor::finishedMarkReadHandler()
m_lastMarkedReadIds.insert(accountId, lastReadId);
}
} else {
- qCWarning(lcMastodonNotifications) << "unable to update notifications marker for account" << accountId
+ qCWarning(lcFediverseNotifications) << "unable to update notifications marker for account" << accountId
<< ", got:" << QString::fromUtf8(replyData);
}
decrementSemaphore(accountId);
}
-void MastodonNotificationsSyncAdaptor::publishSystemNotification(int accountId,
+void FediverseNotificationsSyncAdaptor::publishSystemNotification(int accountId,
const PendingNotification &notificationData)
{
Notification *notification = createNotification(accountId, notificationData.notificationId);
@@ -785,7 +785,7 @@ void MastodonNotificationsSyncAdaptor::publishSystemNotification(int accountId,
? notificationData.timestamp
: QDateTime::currentDateTimeUtc());
notification->setSummary(notificationData.summary.isEmpty()
- ? qtTrId(TrIdMastodon)
+ ? qtTrId(TrIdFediverse)
: notificationData.summary);
notification->setBody(notificationData.body.isEmpty()
? qtTrId(TrIdNewNotification)
@@ -806,12 +806,12 @@ void MastodonNotificationsSyncAdaptor::publishSystemNotification(int accountId,
notification->setRemoteAction(OPEN_URL_ACTION(authorizeInteractionUrl(apiHost(accountId), safeOpenUrl)));
notification->publish();
if (notification->replacesId() == 0) {
- qCWarning(lcMastodonNotifications) << "failed to publish Mastodon notification"
+ qCWarning(lcFediverseNotifications) << "failed to publish Fediverse notification"
<< notificationData.notificationId;
}
}
-void MastodonNotificationsSyncAdaptor::notificationClosedWithReason(uint reason)
+void FediverseNotificationsSyncAdaptor::notificationClosedWithReason(uint reason)
{
Notification *notification = qobject_cast<Notification *>(sender());
removeCachedNotification(notification);
@@ -820,7 +820,7 @@ void MastodonNotificationsSyncAdaptor::notificationClosedWithReason(uint reason)
}
}
-void MastodonNotificationsSyncAdaptor::maybeMarkAccountNotificationsRead(int accountId,
+void FediverseNotificationsSyncAdaptor::maybeMarkAccountNotificationsRead(int accountId,
const QString &accessToken,
Notification *ignoredNotification)
{
@@ -845,7 +845,7 @@ void MastodonNotificationsSyncAdaptor::maybeMarkAccountNotificationsRead(int acc
requestMarkRead(accountId, accessToken, lastReadId);
}
-void MastodonNotificationsSyncAdaptor::markReadFromNotification(Notification *notification)
+void FediverseNotificationsSyncAdaptor::markReadFromNotification(Notification *notification)
{
if (!notification) {
return;
@@ -860,7 +860,7 @@ void MastodonNotificationsSyncAdaptor::markReadFromNotification(Notification *no
maybeMarkAccountNotificationsRead(accountId, accessToken, notification);
}
-void MastodonNotificationsSyncAdaptor::removeCachedNotification(Notification *notification)
+void FediverseNotificationsSyncAdaptor::removeCachedNotification(Notification *notification)
{
if (!notification) {
return;
@@ -875,7 +875,7 @@ void MastodonNotificationsSyncAdaptor::removeCachedNotification(Notification *no
m_notificationObjects.remove(notificationObjectKey(accountId, notificationId));
}
-void MastodonNotificationsSyncAdaptor::closeAccountNotifications(int accountId,
+void FediverseNotificationsSyncAdaptor::closeAccountNotifications(int accountId,
const QSet<QString> &keepNotificationIds)
{
QStringList cachedKeys = m_notificationObjects.keys();
@@ -918,7 +918,7 @@ void MastodonNotificationsSyncAdaptor::closeAccountNotifications(int accountId,
}
}
-Notification *MastodonNotificationsSyncAdaptor::createNotification(int accountId, const QString &notificationId)
+Notification *FediverseNotificationsSyncAdaptor::createNotification(int accountId, const QString &notificationId)
{
const QString objectKey = notificationObjectKey(accountId, notificationId);
Notification *notification = m_notificationObjects.value(objectKey);
@@ -931,8 +931,8 @@ Notification *MastodonNotificationsSyncAdaptor::createNotification(int accountId
notification->setParent(this);
}
- notification->setAppName(QStringLiteral("Mastodon"));
- notification->setAppIcon(QStringLiteral("icon-l-mastodon"));
+ notification->setAppName(QStringLiteral("Fediverse"));
+ notification->setAppIcon(QStringLiteral("icon-l-fediverse"));
notification->setHintValue("x-nemo.sociald.account-id", accountId);
notification->setHintValue(NotificationIdHint, notificationId);
notification->setHintValue("x-nemo-feedback", QStringLiteral("social"));
@@ -945,7 +945,7 @@ Notification *MastodonNotificationsSyncAdaptor::createNotification(int accountId
return notification;
}
-Notification *MastodonNotificationsSyncAdaptor::findNotification(int accountId, const QString &notificationId)
+Notification *FediverseNotificationsSyncAdaptor::findNotification(int accountId, const QString &notificationId)
{
Notification *notification = 0;
QList<QObject *> notifications = Notification::notifications();
diff --git a/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodonnotificationssyncadaptor.h b/buteo-plugins/buteo-sync-plugin-fediverse-notifications/fediversenotificationssyncadaptor.h
index 0e9106c..24f2745 100644
--- a/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodonnotificationssyncadaptor.h
+++ b/buteo-plugins/buteo-sync-plugin-fediverse-notifications/fediversenotificationssyncadaptor.h
@@ -18,10 +18,10 @@
**
****************************************************************************/
-#ifndef MASTODONNOTIFICATIONSSYNCADAPTOR_H
-#define MASTODONNOTIFICATIONSSYNCADAPTOR_H
+#ifndef FEDIVERSENOTIFICATIONSSYNCADAPTOR_H
+#define FEDIVERSENOTIFICATIONSSYNCADAPTOR_H
-#include "mastodondatatypesyncadaptor.h"
+#include "fediversedatatypesyncadaptor.h"
#include <QtCore/QDateTime>
#include <QtCore/QHash>
@@ -30,13 +30,13 @@
class Notification;
-class MastodonNotificationsSyncAdaptor : public MastodonNotificationsDataTypeSyncAdaptor
+class FediverseNotificationsSyncAdaptor : public FediverseNotificationsDataTypeSyncAdaptor
{
Q_OBJECT
public:
- MastodonNotificationsSyncAdaptor(QObject *parent);
- ~MastodonNotificationsSyncAdaptor();
+ FediverseNotificationsSyncAdaptor(QObject *parent);
+ ~FediverseNotificationsSyncAdaptor();
QString syncServiceName() const override;
@@ -101,4 +101,4 @@ private:
QHash<QString, Notification *> m_notificationObjects;
};
-#endif // MASTODONNOTIFICATIONSSYNCADAPTOR_H
+#endif // FEDIVERSENOTIFICATIONSSYNCADAPTOR_H
diff --git a/buteo-plugins/buteo-sync-plugin-mastodon-posts/buteo-sync-plugin-mastodon-posts.pro b/buteo-plugins/buteo-sync-plugin-fediverse-posts/buteo-sync-plugin-fediverse-posts.pro
index a9f65af..d9936b0 100644
--- a/buteo-plugins/buteo-sync-plugin-mastodon-posts/buteo-sync-plugin-mastodon-posts.pro
+++ b/buteo-plugins/buteo-sync-plugin-fediverse-posts/buteo-sync-plugin-fediverse-posts.pro
@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: BSD-3-Clause
-TARGET = mastodon-posts-client
+TARGET = fediverse-posts-client
QT -= gui
@@ -15,27 +15,27 @@ PKGCONFIG += mlite5 nemonotifications-qt5
INCLUDEPATH += $$PWD
SOURCES += \
- $$PWD/mastodondatatypesyncadaptor.cpp \
- $$PWD/mastodonpostsplugin.cpp \
- $$PWD/mastodonpostssyncadaptor.cpp
+ $$PWD/fediversedatatypesyncadaptor.cpp \
+ $$PWD/fediversepostsplugin.cpp \
+ $$PWD/fediversepostssyncadaptor.cpp
HEADERS += \
- $$PWD/mastodondatatypesyncadaptor.h \
- $$PWD/mastodonpostsplugin.h \
- $$PWD/mastodonpostssyncadaptor.h
+ $$PWD/fediversedatatypesyncadaptor.h \
+ $$PWD/fediversepostsplugin.h \
+ $$PWD/fediversepostssyncadaptor.h
OTHER_FILES += \
- $$PWD/mastodon-posts.xml \
- $$PWD/mastodon.Posts.xml
+ $$PWD/fediverse-posts.xml \
+ $$PWD/fediverse.Posts.xml
TEMPLATE = lib
CONFIG += plugin
target.path = $$[QT_INSTALL_LIBS]/buteo-plugins-qt5/oopp
sync.path = /etc/buteo/profiles/sync
-sync.files = mastodon.Posts.xml
+sync.files = fediverse.Posts.xml
client.path = /etc/buteo/profiles/client
-client.files = mastodon-posts.xml
+client.files = fediverse-posts.xml
INSTALLS += target sync client
diff --git a/buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodon-posts.xml b/buteo-plugins/buteo-sync-plugin-fediverse-posts/fediverse-posts.xml
index c1e25ae..4397ff0 100644
--- a/buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodon-posts.xml
+++ b/buteo-plugins/buteo-sync-plugin-fediverse-posts/fediverse-posts.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- SPDX-FileCopyrightText: 2013 - 2026 Jolla Ltd. -->
<!-- SPDX-License-Identifier: BSD-3-Clause -->
-<profile name="mastodon-posts" type="client" >
+<profile name="fediverse-posts" type="client" >
<field name="Sync Direction" />
</profile>
diff --git a/buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodon.Posts.xml b/buteo-plugins/buteo-sync-plugin-fediverse-posts/fediverse.Posts.xml
index c7e2448..6601313 100644
--- a/buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodon.Posts.xml
+++ b/buteo-plugins/buteo-sync-plugin-fediverse-posts/fediverse.Posts.xml
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- SPDX-FileCopyrightText: 2013 - 2026 Jolla Ltd. -->
<!-- SPDX-License-Identifier: BSD-3-Clause -->
-<profile name="mastodon.Posts" type="sync" >
+<profile name="fediverse.Posts" type="sync" >
<key name="category" value="eventfeed" />
<key name="enabled" value="false" />
<key name="use_accounts" value="false" />
<key name="destinationtype" value="online" />
<key name="hidden" value="true" />
- <key name="displayname" value="Mastodon Posts"/>
+ <key name="displayname" value="Fediverse Posts"/>
<schedule enabled="false" interval="30" days="1,2,3,4,5,6,7" syncconfiguredtime="" time="" />
- <profile name="mastodon-posts" type="client" >
+ <profile name="fediverse-posts" type="client" >
<key name="Sync Direction" value="from-remote" />
</profile>
</profile>
diff --git a/buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodondatatypesyncadaptor.cpp b/buteo-plugins/buteo-sync-plugin-fediverse-posts/fediversedatatypesyncadaptor.cpp
index 7b47fe8..3ef6f35 100644
--- a/buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodondatatypesyncadaptor.cpp
+++ b/buteo-plugins/buteo-sync-plugin-fediverse-posts/fediversedatatypesyncadaptor.cpp
@@ -18,10 +18,10 @@
**
****************************************************************************/
-#include "mastodondatatypesyncadaptor.h"
-#include "mastodonauthutils.h"
-#include "trace.h"
+#include "fediversedatatypesyncadaptor.h"
+#include "fediverseauthutils.h"
+#include <QtCore/QLoggingCategory>
#include <QtCore/QVariantMap>
#include <QtNetwork/QNetworkRequest>
@@ -36,21 +36,23 @@
#include <SignOn/AuthSession>
#include <SignOn/SessionData>
-MastodonDataTypeSyncAdaptor::MastodonDataTypeSyncAdaptor(
+Q_LOGGING_CATEGORY(lcFediverseSync, "buteo.plugin.fediverse.sync", QtWarningMsg)
+
+FediverseDataTypeSyncAdaptor::FediverseDataTypeSyncAdaptor(
SocialNetworkSyncAdaptor::DataType dataType,
QObject *parent)
- : SocialNetworkSyncAdaptor(QStringLiteral("mastodon"), dataType, 0, parent)
+ : SocialNetworkSyncAdaptor(QStringLiteral("fediverse"), dataType, 0, parent)
{
}
-MastodonDataTypeSyncAdaptor::~MastodonDataTypeSyncAdaptor()
+FediverseDataTypeSyncAdaptor::~FediverseDataTypeSyncAdaptor()
{
}
-void MastodonDataTypeSyncAdaptor::sync(const QString &dataTypeString, int accountId)
+void FediverseDataTypeSyncAdaptor::sync(const QString &dataTypeString, int accountId)
{
if (dataTypeString != SocialNetworkSyncAdaptor::dataTypeName(m_dataType)) {
- qCWarning(lcSocialPlugin) << "Mastodon" << SocialNetworkSyncAdaptor::dataTypeName(m_dataType)
+ qCWarning(lcFediverseSync) << "Fediverse" << SocialNetworkSyncAdaptor::dataTypeName(m_dataType)
<< "sync adaptor was asked to sync" << dataTypeString;
setStatus(SocialNetworkSyncAdaptor::Error);
return;
@@ -58,14 +60,14 @@ void MastodonDataTypeSyncAdaptor::sync(const QString &dataTypeString, int accoun
setStatus(SocialNetworkSyncAdaptor::Busy);
updateDataForAccount(accountId);
- qCDebug(lcSocialPlugin) << "successfully triggered sync with profile:" << m_accountSyncProfile->name();
+ qCDebug(lcFediverseSync) << "successfully triggered sync with profile:" << m_accountSyncProfile->name();
}
-void MastodonDataTypeSyncAdaptor::updateDataForAccount(int accountId)
+void FediverseDataTypeSyncAdaptor::updateDataForAccount(int accountId)
{
Accounts::Account *account = Accounts::Account::fromId(m_accountManager, accountId, this);
if (!account) {
- qCWarning(lcSocialPlugin) << "existing account with id" << accountId << "couldn't be retrieved";
+ qCWarning(lcFediverseSync) << "existing account with id" << accountId << "couldn't be retrieved";
setStatus(SocialNetworkSyncAdaptor::Error);
return;
}
@@ -74,12 +76,17 @@ void MastodonDataTypeSyncAdaptor::updateDataForAccount(int accountId)
signIn(account);
}
-QString MastodonDataTypeSyncAdaptor::apiHost(int accountId) const
+QString FediverseDataTypeSyncAdaptor::apiHost(int accountId) const
+{
+ return m_apiHosts.value(accountId, FediverseAuthUtils::defaultApiHost());
+}
+
+QString FediverseDataTypeSyncAdaptor::iconPath(int accountId) const
{
- return m_apiHosts.value(accountId, QStringLiteral("https://mastodon.social"));
+ return m_iconPaths.value(accountId, QStringLiteral("image://theme/icon-l-fediverse"));
}
-void MastodonDataTypeSyncAdaptor::errorHandler(QNetworkReply::NetworkError err)
+void FediverseDataTypeSyncAdaptor::errorHandler(QNetworkReply::NetworkError err)
{
QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
if (!reply) {
@@ -89,7 +96,7 @@ void MastodonDataTypeSyncAdaptor::errorHandler(QNetworkReply::NetworkError err)
const int accountId = reply->property("accountId").toInt();
const int httpStatus = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
- qCWarning(lcSocialPlugin) << SocialNetworkSyncAdaptor::dataTypeName(m_dataType)
+ qCWarning(lcFediverseSync) << SocialNetworkSyncAdaptor::dataTypeName(m_dataType)
<< "request with account" << accountId
<< "experienced error:" << err
<< "HTTP:" << httpStatus;
@@ -104,7 +111,7 @@ void MastodonDataTypeSyncAdaptor::errorHandler(QNetworkReply::NetworkError err)
}
}
-void MastodonDataTypeSyncAdaptor::sslErrorsHandler(const QList<QSslError> &errs)
+void FediverseDataTypeSyncAdaptor::sslErrorsHandler(const QList<QSslError> &errs)
{
QString sslerrs;
foreach (const QSslError &e, errs) {
@@ -114,24 +121,24 @@ void MastodonDataTypeSyncAdaptor::sslErrorsHandler(const QList<QSslError> &errs)
sslerrs.chop(2);
}
- qCWarning(lcSocialPlugin) << SocialNetworkSyncAdaptor::dataTypeName(m_dataType)
+ qCWarning(lcFediverseSync) << SocialNetworkSyncAdaptor::dataTypeName(m_dataType)
<< "request with account" << sender()->property("accountId").toInt()
<< "experienced ssl errors:" << sslerrs;
sender()->setProperty("isError", QVariant::fromValue<bool>(true));
}
-void MastodonDataTypeSyncAdaptor::setCredentialsNeedUpdate(Accounts::Account *account)
+void FediverseDataTypeSyncAdaptor::setCredentialsNeedUpdate(Accounts::Account *account)
{
- qCInfo(lcSocialPlugin) << "sociald:Mastodon: setting CredentialsNeedUpdate to true for account:" << account->id();
+ qCInfo(lcFediverseSync) << "sociald:Fediverse: setting CredentialsNeedUpdate to true for account:" << account->id();
Accounts::Service srv(m_accountManager->service(syncServiceName()));
account->selectService(srv);
account->setValue(QStringLiteral("CredentialsNeedUpdate"), QVariant::fromValue<bool>(true));
- account->setValue(QStringLiteral("CredentialsNeedUpdateFrom"), QVariant::fromValue<QString>(QString::fromLatin1("sociald-mastodon")));
+ account->setValue(QStringLiteral("CredentialsNeedUpdateFrom"), QVariant::fromValue<QString>(QString::fromLatin1("sociald-fediverse")));
account->selectService(Accounts::Service());
account->syncAndBlock();
}
-void MastodonDataTypeSyncAdaptor::signIn(Accounts::Account *account)
+void FediverseDataTypeSyncAdaptor::signIn(Accounts::Account *account)
{
const int accountId = account->id();
if (!checkAccount(account)) {
@@ -145,7 +152,7 @@ void MastodonDataTypeSyncAdaptor::signIn(Accounts::Account *account)
? SignOn::Identity::existingIdentity(account->credentialsId())
: 0;
if (!identity) {
- qCWarning(lcSocialPlugin) << "account" << accountId << "has no valid credentials, cannot sign in";
+ qCWarning(lcFediverseSync) << "account" << accountId << "has no valid credentials, cannot sign in";
decrementSemaphore(accountId);
return;
}
@@ -155,14 +162,14 @@ void MastodonDataTypeSyncAdaptor::signIn(Accounts::Account *account)
const QString mechanism = accSrv.authData().mechanism();
SignOn::AuthSession *session = identity->createSession(method);
if (!session) {
- qCWarning(lcSocialPlugin) << "could not create signon session for account" << accountId;
+ qCWarning(lcFediverseSync) << "could not create signon session for account" << accountId;
identity->deleteLater();
decrementSemaphore(accountId);
return;
}
QVariantMap signonSessionData = accSrv.authData().parameters();
- MastodonAuthUtils::addSignOnSessionParameters(account, &signonSessionData);
+ FediverseAuthUtils::addSignOnSessionParameters(account, &signonSessionData);
connect(session, SIGNAL(response(SignOn::SessionData)),
this, SLOT(signOnResponse(SignOn::SessionData)),
@@ -176,14 +183,14 @@ void MastodonDataTypeSyncAdaptor::signIn(Accounts::Account *account)
session->process(SignOn::SessionData(signonSessionData), mechanism);
}
-void MastodonDataTypeSyncAdaptor::signOnError(const SignOn::Error &error)
+void FediverseDataTypeSyncAdaptor::signOnError(const SignOn::Error &error)
{
SignOn::AuthSession *session = qobject_cast<SignOn::AuthSession*>(sender());
Accounts::Account *account = session->property("account").value<Accounts::Account*>();
SignOn::Identity *identity = session->property("identity").value<SignOn::Identity*>();
const int accountId = account->id();
- qCWarning(lcSocialPlugin) << "credentials for account with id" << accountId
+ qCWarning(lcFediverseSync) << "credentials for account with id" << accountId
<< "couldn't be retrieved:" << error.type() << error.message();
if (error.type() == SignOn::Error::UserInteraction) {
@@ -199,9 +206,9 @@ void MastodonDataTypeSyncAdaptor::signOnError(const SignOn::Error &error)
decrementSemaphore(accountId);
}
-void MastodonDataTypeSyncAdaptor::signOnResponse(const SignOn::SessionData &responseData)
+void FediverseDataTypeSyncAdaptor::signOnResponse(const SignOn::SessionData &responseData)
{
- const QVariantMap data = MastodonAuthUtils::responseDataToMap(responseData);
+ const QVariantMap data = FediverseAuthUtils::responseDataToMap(responseData);
QString accessToken;
SignOn::AuthSession *session = qobject_cast<SignOn::AuthSession*>(sender());
@@ -209,13 +216,14 @@ void MastodonDataTypeSyncAdaptor::signOnResponse(const SignOn::SessionData &resp
SignOn::Identity *identity = session->property("identity").value<SignOn::Identity*>();
const int accountId = account->id();
- accessToken = MastodonAuthUtils::accessToken(data);
+ accessToken = FediverseAuthUtils::accessToken(data);
if (accessToken.isEmpty()) {
- qCWarning(lcSocialPlugin) << "signon response for account with id" << accountId
+ qCWarning(lcFediverseSync) << "signon response for account with id" << accountId
<< "contained no access token; keys:" << data.keys();
}
- m_apiHosts.insert(accountId, MastodonAuthUtils::normalizeApiHost(account->value(QStringLiteral("api/Host")).toString()));
+ m_apiHosts.insert(accountId, FediverseAuthUtils::normalizeApiHost(account->value(QStringLiteral("api/Host")).toString()));
+ m_iconPaths.insert(accountId, account->value(QStringLiteral("iconPath")).toString().trimmed());
session->disconnect(this);
identity->destroySession(session);
diff --git a/buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodondatatypesyncadaptor.h b/buteo-plugins/buteo-sync-plugin-fediverse-posts/fediversedatatypesyncadaptor.h
index 3ebbbf5..4511a26 100644
--- a/buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodondatatypesyncadaptor.h
+++ b/buteo-plugins/buteo-sync-plugin-fediverse-posts/fediversedatatypesyncadaptor.h
@@ -18,8 +18,8 @@
**
****************************************************************************/
-#ifndef MASTODONDATATYPESYNCADAPTOR_H
-#define MASTODONDATATYPESYNCADAPTOR_H
+#ifndef FEDIVERSEDATATYPESYNCADAPTOR_H
+#define FEDIVERSEDATATYPESYNCADAPTOR_H
#include "socialnetworksyncadaptor.h"
@@ -35,18 +35,19 @@ namespace SignOn {
class SessionData;
}
-class MastodonDataTypeSyncAdaptor : public SocialNetworkSyncAdaptor
+class FediverseDataTypeSyncAdaptor : public SocialNetworkSyncAdaptor
{
Q_OBJECT
public:
- MastodonDataTypeSyncAdaptor(SocialNetworkSyncAdaptor::DataType dataType, QObject *parent);
- virtual ~MastodonDataTypeSyncAdaptor();
+ FediverseDataTypeSyncAdaptor(SocialNetworkSyncAdaptor::DataType dataType, QObject *parent);
+ virtual ~FediverseDataTypeSyncAdaptor();
void sync(const QString &dataTypeString, int accountId) override;
protected:
QString apiHost(int accountId) const;
+ QString iconPath(int accountId) const;
virtual void updateDataForAccount(int accountId);
virtual void beginSync(int accountId, const QString &accessToken) = 0;
@@ -64,6 +65,7 @@ private:
private:
QMap<int, QString> m_apiHosts;
+ QMap<int, QString> m_iconPaths;
};
-#endif // MASTODONDATATYPESYNCADAPTOR_H
+#endif // FEDIVERSEDATATYPESYNCADAPTOR_H
diff --git a/buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodonpostsplugin.cpp b/buteo-plugins/buteo-sync-plugin-fediverse-posts/fediversepostsplugin.cpp
index a196180..c794c00 100644
--- a/buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodonpostsplugin.cpp
+++ b/buteo-plugins/buteo-sync-plugin-fediverse-posts/fediversepostsplugin.cpp
@@ -18,32 +18,32 @@
**
****************************************************************************/
-#include "mastodonpostsplugin.h"
-#include "mastodonpostssyncadaptor.h"
+#include "fediversepostsplugin.h"
+#include "fediversepostssyncadaptor.h"
#include "socialnetworksyncadaptor.h"
-MastodonPostsPlugin::MastodonPostsPlugin(const QString& pluginName,
+FediversePostsPlugin::FediversePostsPlugin(const QString& pluginName,
const Buteo::SyncProfile& profile,
Buteo::PluginCbInterface *callbackInterface)
: SocialdButeoPlugin(pluginName, profile, callbackInterface,
- QStringLiteral("mastodon"),
+ QStringLiteral("fediverse"),
SocialNetworkSyncAdaptor::dataTypeName(SocialNetworkSyncAdaptor::Posts))
{
}
-MastodonPostsPlugin::~MastodonPostsPlugin()
+FediversePostsPlugin::~FediversePostsPlugin()
{
}
-SocialNetworkSyncAdaptor *MastodonPostsPlugin::createSocialNetworkSyncAdaptor()
+SocialNetworkSyncAdaptor *FediversePostsPlugin::createSocialNetworkSyncAdaptor()
{
- return new MastodonPostsSyncAdaptor(this);
+ return new FediversePostsSyncAdaptor(this);
}
-Buteo::ClientPlugin* MastodonPostsPluginLoader::createClientPlugin(
+Buteo::ClientPlugin* FediversePostsPluginLoader::createClientPlugin(
const QString& pluginName,
const Buteo::SyncProfile& profile,
Buteo::PluginCbInterface* cbInterface)
{
- return new MastodonPostsPlugin(pluginName, profile, cbInterface);
+ return new FediversePostsPlugin(pluginName, profile, cbInterface);
}
diff --git a/buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodonpostsplugin.h b/buteo-plugins/buteo-sync-plugin-fediverse-posts/fediversepostsplugin.h
index c8a1d6b..933cd97 100644
--- a/buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodonpostsplugin.h
+++ b/buteo-plugins/buteo-sync-plugin-fediverse-posts/fediversepostsplugin.h
@@ -18,31 +18,31 @@
**
****************************************************************************/
-#ifndef MASTODONPOSTSPLUGIN_H
-#define MASTODONPOSTSPLUGIN_H
+#ifndef FEDIVERSEPOSTSPLUGIN_H
+#define FEDIVERSEPOSTSPLUGIN_H
#include "socialdbuteoplugin.h"
#include <buteosyncfw5/SyncPluginLoader.h>
-class Q_DECL_EXPORT MastodonPostsPlugin : public SocialdButeoPlugin
+class Q_DECL_EXPORT FediversePostsPlugin : public SocialdButeoPlugin
{
Q_OBJECT
public:
- MastodonPostsPlugin(const QString& pluginName,
+ FediversePostsPlugin(const QString& pluginName,
const Buteo::SyncProfile& profile,
Buteo::PluginCbInterface *cbInterface);
- ~MastodonPostsPlugin();
+ ~FediversePostsPlugin();
protected:
SocialNetworkSyncAdaptor *createSocialNetworkSyncAdaptor() override;
};
-class MastodonPostsPluginLoader : public Buteo::SyncPluginLoader
+class FediversePostsPluginLoader : public Buteo::SyncPluginLoader
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.sailfishos.plugins.sync.MastodonPostsPluginLoader")
+ Q_PLUGIN_METADATA(IID "org.sailfishos.plugins.sync.FediversePostsPluginLoader")
Q_INTERFACES(Buteo::SyncPluginLoader)
public:
@@ -51,4 +51,4 @@ public:
Buteo::PluginCbInterface* cbInterface) override;
};
-#endif // MASTODONPOSTSPLUGIN_H
+#endif // FEDIVERSEPOSTSPLUGIN_H
diff --git a/buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodonpostssyncadaptor.cpp b/buteo-plugins/buteo-sync-plugin-fediverse-posts/fediversepostssyncadaptor.cpp
index 160d6cc..59e37bf 100644
--- a/buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodonpostssyncadaptor.cpp
+++ b/buteo-plugins/buteo-sync-plugin-fediverse-posts/fediversepostssyncadaptor.cpp
@@ -18,10 +18,10 @@
**
****************************************************************************/
-#include "mastodonpostssyncadaptor.h"
-#include "trace.h"
-#include "mastodontextutils.h"
+#include "fediversepostssyncadaptor.h"
+#include "fediversetextutils.h"
+#include <QtCore/QLoggingCategory>
#include <QtCore/QJsonArray>
#include <QtCore/QJsonObject>
#include <QtCore/QJsonValue>
@@ -30,6 +30,8 @@
#include <QtNetwork/QNetworkRequest>
namespace {
+ Q_LOGGING_CATEGORY(lcFediversePostsSync, "buteo.plugin.fediverse.posts.sync", QtWarningMsg)
+
QString displayNameForAccount(const QJsonObject &account)
{
const QString displayName = account.value(QStringLiteral("display_name")).toString().trimmed();
@@ -46,22 +48,22 @@ namespace {
}
}
-MastodonPostsSyncAdaptor::MastodonPostsSyncAdaptor(QObject *parent)
- : MastodonDataTypeSyncAdaptor(SocialNetworkSyncAdaptor::Posts, parent)
+FediversePostsSyncAdaptor::FediversePostsSyncAdaptor(QObject *parent)
+ : FediverseDataTypeSyncAdaptor(SocialNetworkSyncAdaptor::Posts, parent)
{
setInitialActive(m_db.isValid());
}
-MastodonPostsSyncAdaptor::~MastodonPostsSyncAdaptor()
+FediversePostsSyncAdaptor::~FediversePostsSyncAdaptor()
{
}
-QString MastodonPostsSyncAdaptor::syncServiceName() const
+QString FediversePostsSyncAdaptor::syncServiceName() const
{
- return QStringLiteral("mastodon-microblog");
+ return QStringLiteral("fediverse-microblog");
}
-void MastodonPostsSyncAdaptor::purgeDataForOldAccount(int oldId, SocialNetworkSyncAdaptor::PurgeMode)
+void FediversePostsSyncAdaptor::purgeDataForOldAccount(int oldId, SocialNetworkSyncAdaptor::PurgeMode)
{
m_db.removePosts(oldId);
m_db.commit();
@@ -72,15 +74,15 @@ void MastodonPostsSyncAdaptor::purgeDataForOldAccount(int oldId, SocialNetworkSy
purgeCachedImages(&m_imageCacheDb, oldId);
}
-void MastodonPostsSyncAdaptor::beginSync(int accountId, const QString &accessToken)
+void FediversePostsSyncAdaptor::beginSync(int accountId, const QString &accessToken)
{
requestPosts(accountId, accessToken);
}
-void MastodonPostsSyncAdaptor::finalize(int accountId)
+void FediversePostsSyncAdaptor::finalize(int accountId)
{
if (syncAborted()) {
- qCInfo(lcSocialPlugin) << "sync aborted, won't commit database changes";
+ qCInfo(lcFediversePostsSync) << "sync aborted, won't commit database changes";
} else {
m_db.commit();
m_db.wait();
@@ -90,17 +92,17 @@ void MastodonPostsSyncAdaptor::finalize(int accountId)
}
}
-QString MastodonPostsSyncAdaptor::sanitizeContent(const QString &content)
+QString FediversePostsSyncAdaptor::sanitizeContent(const QString &content)
{
- return MastodonTextUtils::sanitizeContent(content);
+ return FediverseTextUtils::sanitizeContent(content);
}
-QDateTime MastodonPostsSyncAdaptor::parseTimestamp(const QString &timestampString)
+QDateTime FediversePostsSyncAdaptor::parseTimestamp(const QString &timestampString)
{
- return MastodonTextUtils::parseTimestamp(timestampString);
+ return FediverseTextUtils::parseTimestamp(timestampString);
}
-void MastodonPostsSyncAdaptor::requestPosts(int accountId, const QString &accessToken)
+void FediversePostsSyncAdaptor::requestPosts(int accountId, const QString &accessToken)
{
QUrl url(apiHost(accountId) + QStringLiteral("/api/v1/timelines/home"));
@@ -121,11 +123,11 @@ void MastodonPostsSyncAdaptor::requestPosts(int accountId, const QString &access
incrementSemaphore(accountId);
setupReplyTimeout(accountId, reply);
} else {
- qCWarning(lcSocialPlugin) << "unable to request home timeline posts from Mastodon account with id" << accountId;
+ qCWarning(lcFediversePostsSync) << "unable to request home timeline posts from Fediverse account with id" << accountId;
}
}
-void MastodonPostsSyncAdaptor::finishedPostsHandler()
+void FediversePostsSyncAdaptor::finishedPostsHandler()
{
QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
if (!reply) {
@@ -146,7 +148,7 @@ void MastodonPostsSyncAdaptor::finishedPostsHandler()
m_db.removePosts(accountId);
if (!statuses.size()) {
- qCDebug(lcSocialPlugin) << "no feed posts received for account" << accountId;
+ qCDebug(lcFediversePostsSync) << "no feed posts received for account" << accountId;
decrementSemaphore(accountId);
return;
}
@@ -231,7 +233,7 @@ void MastodonPostsSyncAdaptor::finishedPostsHandler()
}
}
- m_db.addMastodonPost(identifier,
+ m_db.addFediversePost(identifier,
displayName,
accountName,
body,
@@ -246,10 +248,11 @@ void MastodonPostsSyncAdaptor::finishedPostsHandler()
favourited,
reblogged,
apiHost(accountId),
+ iconPath(accountId),
accountId);
}
} else {
- qCWarning(lcSocialPlugin) << "unable to parse event feed data from request with account" << accountId
+ qCWarning(lcFediversePostsSync) << "unable to parse event feed data from request with account" << accountId
<< ", got:" << QString::fromUtf8(replyData);
}
diff --git a/buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodonpostssyncadaptor.h b/buteo-plugins/buteo-sync-plugin-fediverse-posts/fediversepostssyncadaptor.h
index d2ca464..341e049 100644
--- a/buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodonpostssyncadaptor.h
+++ b/buteo-plugins/buteo-sync-plugin-fediverse-posts/fediversepostssyncadaptor.h
@@ -18,24 +18,24 @@
**
****************************************************************************/
-#ifndef MASTODONPOSTSSYNCADAPTOR_H
-#define MASTODONPOSTSSYNCADAPTOR_H
+#ifndef FEDIVERSEPOSTSSYNCADAPTOR_H
+#define FEDIVERSEPOSTSSYNCADAPTOR_H
-#include "mastodondatatypesyncadaptor.h"
+#include "fediversedatatypesyncadaptor.h"
#include <QtCore/QDateTime>
#include <QtNetwork/QNetworkReply>
-#include "mastodonpostsdatabase.h"
-#include <socialcache/socialimagesdatabase.h>
+#include "fediversepostsdatabase.h"
+#include <socialimagesdatabase.h>
-class MastodonPostsSyncAdaptor : public MastodonDataTypeSyncAdaptor
+class FediversePostsSyncAdaptor : public FediverseDataTypeSyncAdaptor
{
Q_OBJECT
public:
- MastodonPostsSyncAdaptor(QObject *parent);
- ~MastodonPostsSyncAdaptor();
+ FediversePostsSyncAdaptor(QObject *parent);
+ ~FediversePostsSyncAdaptor();
QString syncServiceName() const override;
@@ -54,8 +54,8 @@ private Q_SLOTS:
void finishedPostsHandler();
private:
- MastodonPostsDatabase m_db;
+ FediversePostsDatabase m_db;
SocialImagesDatabase m_imageCacheDb;
};
-#endif // MASTODONPOSTSSYNCADAPTOR_H
+#endif // FEDIVERSEPOSTSSYNCADAPTOR_H