diff options
-rwxr-xr-x | interimap | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -426,9 +426,8 @@ elsif (defined $COMMAND and $COMMAND eq 'rename') { ############################################################################## # Synchronize mailbox and subscription lists -my @MAILBOXES; sub sync_mailbox_list() { - my %mailboxes; + my (%mailboxes, @mailboxes); $mailboxes{$_} = 1 foreach keys %{$IMAP->{local}->{mailboxes}}; $mailboxes{$_} = 1 foreach keys %{$IMAP->{remote}->{mailboxes}}; my $sth_subscribe = $DBH->prepare(q{UPDATE mailboxes SET subscribed = ? WHERE idx = ?}); @@ -445,7 +444,7 @@ sub sync_mailbox_list() { }; check_delim($mailbox); # ensure that the delimiter match - push @MAILBOXES, $mailbox unless grep {lc $_ eq lc '\NoSelect'} @attrs; + push @mailboxes, $mailbox unless grep {lc $_ eq lc '\NoSelect'} @attrs; $STH_GET_INDEX->execute($mailbox); my ($idx,$subscribed) = $STH_GET_INDEX->fetchrow_array(); @@ -513,9 +512,10 @@ sub sync_mailbox_list() { $DBH->commit(); } } + return @mailboxes; } -sync_mailbox_list(); +my @MAILBOXES = sync_mailbox_list(); ($lIMAP, $rIMAP) = map {$IMAP->{$_}->{client}} qw/local remote/; my $ATTRS = join ' ', qw/MODSEQ FLAGS INTERNALDATE BODY.PEEK[]/; @@ -1222,7 +1222,7 @@ while(1) { sleep $CONFIG{watch}; # Refresh the mailbox list and status @{$IMAP->{$_}}{qw/mailboxes delims/} = $IMAP->{$_}->{client}->list($LIST, @LIST_PARAMS) for qw/local remote/; - sync_mailbox_list(); + @MAILBOXES = sync_mailbox_list(); } END { cleanup(); } |