]> git.g-eek.se Git - interimap.git/commitdiff
Mark mailboxes as (un)subscribed in the DB.
authorGuilhem Moulin <guilhem@fripost.org>
Thu, 23 Jul 2015 13:46:45 +0000 (15:46 +0200)
committerGuilhem Moulin <guilhem@fripost.org>
Thu, 23 Jul 2015 15:15:38 +0000 (17:15 +0200)
imapsync

index eb8f65282ceec76ccb2a9f17ded5869f55b116b5..705ad3d3285fe4f59323cf0b384674c3b4b82250 100755 (executable)
--- a/imapsync
+++ b/imapsync
@@ -444,6 +444,20 @@ my @SUBSCRIPTIONS;
                 push @{$IMAP->{$unsubscribed}->{mailboxes}->{$mbx}}, '\Subscribed';
             }
         }
+        else {
+            $sth_search->execute($mbx);
+            my $row = $sth_search->fetch();
+            die if defined $sth_search->fetch(); # sanity check
+
+            if (defined $row) {
+                my ($idx,$status) = @$row;
+                unless (defined $status and $status != 0) {
+                    my $subscribed = subscribed_mbx('local',$mbx) ? 1 : 0;
+                    $sth_subscribe->execute($subscribed, $idx);
+                    $DBH->commit();
+                }
+            }
+        }
         push @SUBSCRIPTIONS, $mbx if subscribed_mbx('local', $mbx) and
                                      subscribed_mbx('remote',$mbx);
     }