doveadm -u "local" mailbox create "foo" -- "-virtual" doveadm -u "remote" mailbox create "bar" -- "virtual-" interimap_init check_mailbox_list sqlite3 "$XDG_DATA_HOME/interimap/remote.db" >"$TMPDIR/mailboxes.sql" <<-EOF SELECT idx, mailbox FROM mailboxes ORDER BY idx EOF for ((i = 0; i < 16; i++)); do u="$(shuf -n1 -e "local" "remote")" # choose target at random m="$(shuf -n1 -e -- "INBOX" "foo" "bar")" sample_message | deliver -u "$u" -- -m "$m" done # create new mailboxes matching 'ignore-mailbox' doveadm -u "local" mailbox create "virtual" "virtual.foo" doveadm -u "remote" mailbox create "virtual^bar" for n in $(seq 1 "$(shuf -n1 -i1-8)"); do sample_message | deliver -u "local" -- -m "virtual" sample_message | deliver -u "local" -- -m "virtual.foo" done for n in $(seq 1 "$(shuf -n1 -i1-8)"); do sample_message | deliver -u "remote" -- -m "virtual^bar" done # no new mailbox should be created interimap || error sqlite3 "$XDG_DATA_HOME/interimap/remote.db" >"$TMPDIR/mailboxes2.sql" <<-EOF SELECT idx, mailbox FROM mailboxes ORDER BY idx EOF diff -u --label="a/mailboxes.sql" --label="b/mailboxes.sql" \ "$TMPDIR/mailboxes.sql" "$TMPDIR/mailboxes2.sql" || error "SQL dumps differ" check_mailboxes_status "INBOX" "foo" "bar" # double check the unsubscribed mailboxes weren't copied ! doveadm -u "remote" mailbox status uidvalidity "virtual" || error ! doveadm -u "remote" mailbox status uidvalidity "virtual^foo" || error ! doveadm -u "local" mailbox status uidvalidity "virtual.bar" || error # ignored mailboxes are created when passed to the command line interimap "virtual" "virtual.bar" || error grep -Fx "database: Created mailbox virtual" <"$STDERR" || error grep -Fx "database: Created mailbox virtual.bar" <"$STDERR" || error grep -Fx "local: Created mailbox virtual.bar" <"$STDERR" || error grep -Fx "remote: Created mailbox virtual" <"$STDERR" || error sqlite3 "$XDG_DATA_HOME/interimap/remote.db" >"$TMPDIR/mailboxes.sql" <<-EOF SELECT idx, mailbox FROM mailboxes WHERE mailbox != x'$(printf "virtual" | xxd -ps)' AND mailbox != x'$(printf "%s\\0%s" "virtual" "foo" | xxd -ps)' ORDER BY idx EOF check_mailboxes_status "virtual" "virtual.bar" || error # vim: set filetype=sh :