From 69628390815254297bbd8c95436f6780fa846fae Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Tue, 10 Feb 2026 23:16:37 +0100 Subject: Translations fixed and other stuff --- .../mastodonnotificationssyncadaptor.h | 37 ++++++++++------------ 1 file changed, 16 insertions(+), 21 deletions(-) (limited to 'buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodonnotificationssyncadaptor.h') diff --git a/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodonnotificationssyncadaptor.h b/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodonnotificationssyncadaptor.h index 8c79d7d..0cd63a4 100644 --- a/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodonnotificationssyncadaptor.h +++ b/buteo-plugins/buteo-sync-plugin-mastodon-notifications/mastodonnotificationssyncadaptor.h @@ -25,11 +25,9 @@ #include #include +#include #include -#include "mastodonnotificationsdatabase.h" -#include - class Notification; class MastodonNotificationsSyncAdaptor : public MastodonNotificationsDataTypeSyncAdaptor @@ -48,22 +46,18 @@ protected: void finalize(int accountId) override; private: + struct PendingNotification { + QString notificationId; + QString summary; + QString body; + QString link; + QDateTime timestamp; + }; + struct PendingSyncState { QString accessToken; QString minReadId; - QString maxNotificationId; - int newNotificationCount; - QString singleSummary; - QString singleBody; - QString singleLink; - QDateTime singleTimestamp; - bool dbCleared; - - PendingSyncState() - : newNotificationCount(0) - , dbCleared(false) - { - } + QHash pendingNotifications; }; static QString sanitizeContent(const QString &content); @@ -76,9 +70,11 @@ private: const QString &minId, const QString &maxId = QString()); void requestMarkRead(int accountId, const QString &accessToken, const QString &lastReadId); - void publishSystemNotification(int accountId, const PendingSyncState &state); - Notification *createNotification(int accountId); - Notification *findNotification(int accountId); + void publishSystemNotification(int accountId, const PendingNotification ¬ificationData); + Notification *createNotification(int accountId, const QString ¬ificationId); + Notification *findNotification(int accountId, const QString ¬ificationId); + void closeAccountNotifications(int accountId, const QSet &keepNotificationIds = QSet()); + static QString notificationObjectKey(int accountId, const QString ¬ificationId); void markReadFromNotification(Notification *notification); private Q_SLOTS: @@ -88,11 +84,10 @@ private Q_SLOTS: void notificationClosedWithReason(uint reason); private: - MastodonNotificationsDatabase m_db; - SocialImagesDatabase m_imageCacheDb; QHash m_pendingSyncStates; QHash m_accessTokens; QHash m_lastMarkedReadIds; + QHash m_notificationObjects; }; #endif // MASTODONNOTIFICATIONSSYNCADAPTOR_H -- cgit v1.2.3