@@ -2079,15 +2079,35 @@ void FolderMan::slotSetupPushNotifications(const Folder::Map &folderMap)
20792079
20802080void FolderMan::slotProcessFilesPushNotification (Account *account)
20812081{
2082- qCInfo (lcFolderMan) << " Got files push notification for account" << account;
2082+ qCDebug (lcFolderMan) << " received notify_file push notification account= " << account-> displayName () ;
20832083
20842084 for (auto folder : std::as_const (_folderMap)) {
20852085 // Just run on the folders that belong to this account
20862086 if (folder->accountState ()->account () != account) {
20872087 continue ;
20882088 }
20892089
2090- qCInfo (lcFolderMan) << " Schedule folder" << folder << " for sync" ;
2090+ qCInfo (lcFolderMan).nospace () << " scheduling sync account=" << account->displayName () << " folder=" << folder->alias () << " reason=notify_file" ;
2091+ scheduleFolder (folder);
2092+ }
2093+ }
2094+
2095+ void FolderMan::slotProcessFileIdsPushNotification (Account *account, const QList<qint64> &fileIds)
2096+ {
2097+ qCDebug (lcFolderMan).nospace () << " received notify_file_id push notification account=" << account->displayName () << " fileIds=" << fileIds;
2098+
2099+ for (auto folder : std::as_const (_folderMap)) {
2100+ // Just run on the folders that belong to this account
2101+ if (folder->accountState ()->account () != account) {
2102+ continue ;
2103+ }
2104+
2105+ if (!folder->hasFileIds (fileIds)) {
2106+ qCDebug (lcFolderMan).nospace () << " no matching file ids, ignoring account=" << account->displayName () << " folder=" << folder->alias ();
2107+ continue ;
2108+ }
2109+
2110+ qCInfo (lcFolderMan).nospace () << " scheduling sync account=" << account->displayName () << " folder=" << folder->alias () << " reason=notify_file_id" ;
20912111 scheduleFolder (folder);
20922112 }
20932113}
@@ -2099,6 +2119,7 @@ void FolderMan::slotConnectToPushNotifications(const AccountPtr &account)
20992119 if (pushNotificationsFilesReady (account)) {
21002120 qCInfo (lcFolderMan) << " Push notifications ready" ;
21012121 connect (pushNotifications, &PushNotifications::filesChanged, this , &FolderMan::slotProcessFilesPushNotification, Qt::UniqueConnection);
2122+ connect (pushNotifications, &PushNotifications::fileIdsChanged, this , &FolderMan::slotProcessFileIdsPushNotification, Qt::UniqueConnection);
21022123 }
21032124}
21042125
0 commit comments