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 --- common/mastodonpostsdatabase.cpp | 46 +++++++++------------------------------- 1 file changed, 10 insertions(+), 36 deletions(-) (limited to 'common/mastodonpostsdatabase.cpp') diff --git a/common/mastodonpostsdatabase.cpp b/common/mastodonpostsdatabase.cpp index 7f82162..2e4b9c1 100644 --- a/common/mastodonpostsdatabase.cpp +++ b/common/mastodonpostsdatabase.cpp @@ -17,6 +17,7 @@ */ #include "mastodonpostsdatabase.h" +#include static const char *DB_NAME = "mastodon.db"; static const char *ACCOUNT_NAME_KEY = "account_name"; @@ -71,72 +72,45 @@ void MastodonPostsDatabase::addMastodonPost( QString MastodonPostsDatabase::accountName(const SocialPost::ConstPtr &post) { - if (post.isNull()) { - return QString(); - } - return post->extra().value(ACCOUNT_NAME_KEY).toString(); + return SocialPostHelpers::extraString(post, QString::fromLatin1(ACCOUNT_NAME_KEY)); } QString MastodonPostsDatabase::url(const SocialPost::ConstPtr &post) { - if (post.isNull()) { - return QString(); - } - return post->extra().value(URL_KEY).toString(); + return SocialPostHelpers::extraString(post, QString::fromLatin1(URL_KEY)); } QString MastodonPostsDatabase::boostedBy(const SocialPost::ConstPtr &post) { - if (post.isNull()) { - return QString(); - } - return post->extra().value(BOOSTED_BY_KEY).toString(); + return SocialPostHelpers::extraString(post, QString::fromLatin1(BOOSTED_BY_KEY)); } int MastodonPostsDatabase::repliesCount(const SocialPost::ConstPtr &post) { - if (post.isNull()) { - return 0; - } - return post->extra().value(REPLIES_COUNT_KEY).toInt(); + return SocialPostHelpers::extraInt(post, QString::fromLatin1(REPLIES_COUNT_KEY), 0); } int MastodonPostsDatabase::favouritesCount(const SocialPost::ConstPtr &post) { - if (post.isNull()) { - return 0; - } - return post->extra().value(FAVOURITES_COUNT_KEY).toInt(); + return SocialPostHelpers::extraInt(post, QString::fromLatin1(FAVOURITES_COUNT_KEY), 0); } int MastodonPostsDatabase::reblogsCount(const SocialPost::ConstPtr &post) { - if (post.isNull()) { - return 0; - } - return post->extra().value(REBLOGS_COUNT_KEY).toInt(); + return SocialPostHelpers::extraInt(post, QString::fromLatin1(REBLOGS_COUNT_KEY), 0); } bool MastodonPostsDatabase::favourited(const SocialPost::ConstPtr &post) { - if (post.isNull()) { - return false; - } - return post->extra().value(FAVOURITED_KEY).toBool(); + return SocialPostHelpers::extraBool(post, QString::fromLatin1(FAVOURITED_KEY), false); } bool MastodonPostsDatabase::reblogged(const SocialPost::ConstPtr &post) { - if (post.isNull()) { - return false; - } - return post->extra().value(REBLOGGED_KEY).toBool(); + return SocialPostHelpers::extraBool(post, QString::fromLatin1(REBLOGGED_KEY), false); } QString MastodonPostsDatabase::instanceUrl(const SocialPost::ConstPtr &post) { - if (post.isNull()) { - return QString(); - } - return post->extra().value(INSTANCE_URL_KEY).toString(); + return SocialPostHelpers::extraString(post, QString::fromLatin1(INSTANCE_URL_KEY)); } -- cgit v1.2.3