From 71edd6346a069740661789a8ebdb6f34fda7a966 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Thu, 23 Jul 2015 15:46:45 +0200 Subject: Mark mailboxes as (un)subscribed in the DB. --- imapsync | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/imapsync b/imapsync index eb8f652..705ad3d 100755 --- 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); } -- cgit v1.2.3