summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@jolla.com>2026-03-22 20:18:39 +0100
committerAndrew Branson <andrew.branson@jolla.com>2026-03-22 20:25:03 +0100
commit218a05f6ac67f260288ff70344f0f004c7b48c7b (patch)
treed213c375b94b467aa439aabf9810554087b29ec0 /common
parent2b1a3046832074e47ad2ad703cd518526b9fb459 (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 'common')
-rw-r--r--common/mastodonpostsdatabase.cpp46
1 files changed, 10 insertions, 36 deletions
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 <socialcache/socialposthelpers.h>
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));
}