From 218a05f6ac67f260288ff70344f0f004c7b48c7b Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Sun, 22 Mar 2026 20:18:39 +0100 Subject: Use shared buteo-common and split notifications service on main 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 --- .../mastodonpostsmodel.cpp | 51 ++++------------------ 1 file changed, 9 insertions(+), 42 deletions(-) (limited to 'eventsview-plugins/eventsview-plugin-mastodon/mastodonpostsmodel.cpp') diff --git a/eventsview-plugins/eventsview-plugin-mastodon/mastodonpostsmodel.cpp b/eventsview-plugins/eventsview-plugin-mastodon/mastodonpostsmodel.cpp index aa98a95..fe61320 100644 --- a/eventsview-plugins/eventsview-plugin-mastodon/mastodonpostsmodel.cpp +++ b/eventsview-plugins/eventsview-plugin-mastodon/mastodonpostsmodel.cpp @@ -17,31 +17,7 @@ */ #include "mastodonpostsmodel.h" -#include - -namespace { - -static const char *URL_KEY = "url"; -static const char *TYPE_KEY = "type"; -static const char *TYPE_PHOTO = "photo"; -static const char *TYPE_VIDEO = "video"; - -QVariantMap createImageData(const SocialPostImage::ConstPtr &image) -{ - QVariantMap imageData; - imageData.insert(QLatin1String(URL_KEY), image->url()); - switch (image->type()) { - case SocialPostImage::Video: - imageData.insert(QLatin1String(TYPE_KEY), QLatin1String(TYPE_VIDEO)); - break; - default: - imageData.insert(QLatin1String(TYPE_KEY), QLatin1String(TYPE_PHOTO)); - break; - } - return imageData; -} - -} +#include MastodonPostsModel::MastodonPostsModel(QObject *parent) : QAbstractListModel(parent) @@ -123,13 +99,16 @@ void MastodonPostsModel::postsChanged() const bool favourited = m_database.favourited(post); const bool reblogged = m_database.reblogged(post); - eventMap.insert(MastodonPostsModel::MastodonId, post->identifier()); - eventMap.insert(MastodonPostsModel::Name, post->name()); + SocialPostHelpers::appendCommonPostFields(&eventMap, post, + MastodonPostsModel::MastodonId, + MastodonPostsModel::Name, + MastodonPostsModel::Body, + MastodonPostsModel::Timestamp, + MastodonPostsModel::Icon, + MastodonPostsModel::Images, + MastodonPostsModel::Accounts); eventMap.insert(MastodonPostsModel::AccountName, accountName); eventMap.insert(MastodonPostsModel::Acct, accountName); - eventMap.insert(MastodonPostsModel::Body, post->body()); - eventMap.insert(MastodonPostsModel::Timestamp, post->timestamp()); - eventMap.insert(MastodonPostsModel::Icon, post->icon()); eventMap.insert(MastodonPostsModel::Url, postUrl); eventMap.insert(MastodonPostsModel::Link, postUrl); eventMap.insert(MastodonPostsModel::BoostedBy, boostedBy); @@ -140,18 +119,6 @@ void MastodonPostsModel::postsChanged() eventMap.insert(MastodonPostsModel::Favourited, favourited); eventMap.insert(MastodonPostsModel::Reblogged, reblogged); eventMap.insert(MastodonPostsModel::InstanceUrl, m_database.instanceUrl(post)); - - QVariantList images; - Q_FOREACH (const SocialPostImage::ConstPtr &image, post->images()) { - images.append(createImageData(image)); - } - eventMap.insert(MastodonPostsModel::Images, images); - - QVariantList accountsVariant; - Q_FOREACH (int account, post->accounts()) { - accountsVariant.append(account); - } - eventMap.insert(MastodonPostsModel::Accounts, accountsVariant); data.append(eventMap); } -- cgit v1.2.3