diff options
| author | Andrew Branson <andrew.branson@jolla.com> | 2026-03-22 20:18:39 +0100 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@jolla.com> | 2026-03-22 20:25:03 +0100 |
| commit | 218a05f6ac67f260288ff70344f0f004c7b48c7b (patch) | |
| tree | d213c375b94b467aa439aabf9810554087b29ec0 /buteo-plugins/buteo-sync-plugin-mastodon-posts | |
| parent | 2b1a3046832074e47ad2ad703cd518526b9fb459 (diff) | |
Use shared buteo-common and split notifications service on mainmain
Keep main as the branch that builds against the newer shared social sync modules, while master stays self-contained.
- drop the bundled buteo-common sources and stop building or packaging libmastodonbuteocommon
- link the Mastodon sync plugins against buteosocialcommon and add the matching build/runtime package requirements
- install a dedicated mastodon-notifications account service and wire account creation/packaging around the separate notifications profile
- move the posts/events-view side over to the newer shared-helper style used with the updated socialcache stack
- clean up qmake project wiring for the shared-module layout and refresh the branch README to describe the split service model
- keep the notification schedule at the master value instead of carrying the temporary timing tweak
Diffstat (limited to 'buteo-plugins/buteo-sync-plugin-mastodon-posts')
3 files changed, 28 insertions, 18 deletions
diff --git a/buteo-plugins/buteo-sync-plugin-mastodon-posts/buteo-sync-plugin-mastodon-posts.pro b/buteo-plugins/buteo-sync-plugin-mastodon-posts/buteo-sync-plugin-mastodon-posts.pro index a9f65af..c25e5d4 100644 --- a/buteo-plugins/buteo-sync-plugin-mastodon-posts/buteo-sync-plugin-mastodon-posts.pro +++ b/buteo-plugins/buteo-sync-plugin-mastodon-posts/buteo-sync-plugin-mastodon-posts.pro @@ -6,11 +6,17 @@ TARGET = mastodon-posts-client QT -= gui -include($$PWD/../buteo-common/buteo-common.pri) include($$PWD/../../common/common.pri) CONFIG += link_pkgconfig -PKGCONFIG += mlite5 nemonotifications-qt5 +PKGCONFIG += \ + buteosocialcommon \ + socialcache \ + accounts-qt5 \ + buteosyncfw5 \ + libsignon-qt5 \ + mlite5 \ + nemonotifications-qt5 INCLUDEPATH += $$PWD diff --git a/buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodondatatypesyncadaptor.cpp b/buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodondatatypesyncadaptor.cpp index 7b47fe8..577e185 100644 --- a/buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodondatatypesyncadaptor.cpp +++ b/buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodondatatypesyncadaptor.cpp @@ -20,8 +20,8 @@ #include "mastodondatatypesyncadaptor.h" #include "mastodonauthutils.h" -#include "trace.h" +#include <QtCore/QLoggingCategory> #include <QtCore/QVariantMap> #include <QtNetwork/QNetworkRequest> @@ -36,6 +36,8 @@ #include <SignOn/AuthSession> #include <SignOn/SessionData> +Q_LOGGING_CATEGORY(lcMastodonSync, "buteo.plugin.mastodon.sync", QtWarningMsg) + MastodonDataTypeSyncAdaptor::MastodonDataTypeSyncAdaptor( SocialNetworkSyncAdaptor::DataType dataType, QObject *parent) @@ -50,7 +52,7 @@ MastodonDataTypeSyncAdaptor::~MastodonDataTypeSyncAdaptor() void MastodonDataTypeSyncAdaptor::sync(const QString &dataTypeString, int accountId) { if (dataTypeString != SocialNetworkSyncAdaptor::dataTypeName(m_dataType)) { - qCWarning(lcSocialPlugin) << "Mastodon" << SocialNetworkSyncAdaptor::dataTypeName(m_dataType) + qCWarning(lcMastodonSync) << "Mastodon" << 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(lcMastodonSync) << "successfully triggered sync with profile:" << m_accountSyncProfile->name(); } void MastodonDataTypeSyncAdaptor::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(lcMastodonSync) << "existing account with id" << accountId << "couldn't be retrieved"; setStatus(SocialNetworkSyncAdaptor::Error); return; } @@ -89,7 +91,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(lcMastodonSync) << SocialNetworkSyncAdaptor::dataTypeName(m_dataType) << "request with account" << accountId << "experienced error:" << err << "HTTP:" << httpStatus; @@ -114,7 +116,7 @@ void MastodonDataTypeSyncAdaptor::sslErrorsHandler(const QList<QSslError> &errs) sslerrs.chop(2); } - qCWarning(lcSocialPlugin) << SocialNetworkSyncAdaptor::dataTypeName(m_dataType) + qCWarning(lcMastodonSync) << SocialNetworkSyncAdaptor::dataTypeName(m_dataType) << "request with account" << sender()->property("accountId").toInt() << "experienced ssl errors:" << sslerrs; sender()->setProperty("isError", QVariant::fromValue<bool>(true)); @@ -122,7 +124,7 @@ void MastodonDataTypeSyncAdaptor::sslErrorsHandler(const QList<QSslError> &errs) void MastodonDataTypeSyncAdaptor::setCredentialsNeedUpdate(Accounts::Account *account) { - qCInfo(lcSocialPlugin) << "sociald:Mastodon: setting CredentialsNeedUpdate to true for account:" << account->id(); + qCInfo(lcMastodonSync) << "sociald:Mastodon: 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)); @@ -145,7 +147,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(lcMastodonSync) << "account" << accountId << "has no valid credentials, cannot sign in"; decrementSemaphore(accountId); return; } @@ -155,7 +157,7 @@ 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(lcMastodonSync) << "could not create signon session for account" << accountId; identity->deleteLater(); decrementSemaphore(accountId); return; @@ -183,7 +185,7 @@ void MastodonDataTypeSyncAdaptor::signOnError(const SignOn::Error &error) SignOn::Identity *identity = session->property("identity").value<SignOn::Identity*>(); const int accountId = account->id(); - qCWarning(lcSocialPlugin) << "credentials for account with id" << accountId + qCWarning(lcMastodonSync) << "credentials for account with id" << accountId << "couldn't be retrieved:" << error.type() << error.message(); if (error.type() == SignOn::Error::UserInteraction) { @@ -211,7 +213,7 @@ void MastodonDataTypeSyncAdaptor::signOnResponse(const SignOn::SessionData &resp accessToken = MastodonAuthUtils::accessToken(data); if (accessToken.isEmpty()) { - qCWarning(lcSocialPlugin) << "signon response for account with id" << accountId + qCWarning(lcMastodonSync) << "signon response for account with id" << accountId << "contained no access token; keys:" << data.keys(); } diff --git a/buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodonpostssyncadaptor.cpp b/buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodonpostssyncadaptor.cpp index 160d6cc..6c9a280 100644 --- a/buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodonpostssyncadaptor.cpp +++ b/buteo-plugins/buteo-sync-plugin-mastodon-posts/mastodonpostssyncadaptor.cpp @@ -19,9 +19,9 @@ ****************************************************************************/ #include "mastodonpostssyncadaptor.h" -#include "trace.h" #include "mastodontextutils.h" +#include <QtCore/QLoggingCategory> #include <QtCore/QJsonArray> #include <QtCore/QJsonObject> #include <QtCore/QJsonValue> @@ -30,6 +30,8 @@ #include <QtNetwork/QNetworkRequest> namespace { + Q_LOGGING_CATEGORY(lcMastodonPostsSync, "buteo.plugin.mastodon.posts.sync", QtWarningMsg) + QString displayNameForAccount(const QJsonObject &account) { const QString displayName = account.value(QStringLiteral("display_name")).toString().trimmed(); @@ -80,7 +82,7 @@ void MastodonPostsSyncAdaptor::beginSync(int accountId, const QString &accessTok void MastodonPostsSyncAdaptor::finalize(int accountId) { if (syncAborted()) { - qCInfo(lcSocialPlugin) << "sync aborted, won't commit database changes"; + qCInfo(lcMastodonPostsSync) << "sync aborted, won't commit database changes"; } else { m_db.commit(); m_db.wait(); @@ -121,7 +123,7 @@ 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(lcMastodonPostsSync) << "unable to request home timeline posts from Mastodon account with id" << accountId; } } @@ -146,7 +148,7 @@ void MastodonPostsSyncAdaptor::finishedPostsHandler() m_db.removePosts(accountId); if (!statuses.size()) { - qCDebug(lcSocialPlugin) << "no feed posts received for account" << accountId; + qCDebug(lcMastodonPostsSync) << "no feed posts received for account" << accountId; decrementSemaphore(accountId); return; } @@ -249,7 +251,7 @@ void MastodonPostsSyncAdaptor::finishedPostsHandler() accountId); } } else { - qCWarning(lcSocialPlugin) << "unable to parse event feed data from request with account" << accountId + qCWarning(lcMastodonPostsSync) << "unable to parse event feed data from request with account" << accountId << ", got:" << QString::fromUtf8(replyData); } |
