-);
-
-my $table = 'mailbox'; #also needs to be configurable...
-
-my $primary_key = 'username';
-
-sub rebless { shift; }
-
-sub _export_insert {
- my($self, $svc_acct) = (shift, shift);
-
-
- my %record = map { my $value = $map{$_};
- $_ => ( ref($value)
- ? &{$value}($svc_acct)
- : $svc_acct->$value()
- );
- } keys %map;
-
- my $err_or_queue =
- $self->acct_sql_queue( $svc_acct->svcnum, 'insert', $table, %record );
- return $err_or_queue unless ref($err_or_queue);
-
- '';
-
-}
-
-sub _export_replace {
-}
-
-sub _export_delete {
- my ( $self, $svc_acct ) = (shift, shift);
- my $keymap = $map{$primary_key};
- my $err_or_queue = $self->acct_sql_queue(
- $svc_acct->svcnum,
- 'delete',
- $table,
- $primary_key => ref($keymap) ? &{$keymap}($svc_acct) : $svc_acct->$keymap()
- );
- return $err_or_queue unless ref($err_or_queue);
- '';
-}
-
-sub acct_sql_queue {
- my( $self, $svcnum, $method ) = (shift, shift, shift);
- my $queue = new FS::queue {
- 'svcnum' => $svcnum,
- 'job' => "FS::part_export::acct_sql::acct_sql_$method",
- };
- $queue->insert(
- $self->option('datasrc'),
- $self->option('username'),
- $self->option('password'),
- @_,
- ) or $queue;
-}
-
-sub acct_sql_insert { #subroutine, not method
- my $dbh = acct_sql_connect(shift, shift, shift);
- my( $table, %record ) = @_;
-
- my $sth = $dbh->prepare(
- "INSERT INTO $table ( ". join(", ", keys %record).
- " ) VALUES ( ". join(", ", map '?', keys %record ). " )"
- ) or die $dbh->errstr;
-
- $sth->execute( map $record{$_}, keys %record )
- or die "can't insert into $table table: ". $sth->errstr;
-
- $dbh->disconnect;
-}
-
-sub acct_sql_delete { #subroutine, not method
- my $dbh = acct_sql_connect(shift, shift, shift);
- my( $table, %record ) = @_;
-
- my $sth = $dbh->prepare(
- "DELETE FROM $table WHERE ". join(' AND ', map "$_ = ? ", keys %record )
- ) or die $dbh->errstr;
-
- $sth->execute( map $record{$_}, keys %record )
- or die "can't delete from $table table: ". $sth->errstr;
+;
+my $postfix_courierimap_mailbox_map =
+ join('\n', map "$_ $postfix_courierimap_mailbox_map{$_}",
+ keys %postfix_courierimap_mailbox_map );
+
+tie my %postfix_courierimap_alias_map, 'Tie::IxHash',
+ 'address' => 'email',
+ 'goto' => 'email',
+ 'domain' => 'domain',
+ 'svcnum' => 'svcnum',
+;
+my $postfix_courierimap_alias_map =
+ join('\n', map "$_ $postfix_courierimap_alias_map{$_}",
+ keys %postfix_courierimap_alias_map );
+
+tie my %postfix_native_mailbox_map, 'Tie::IxHash',
+ 'userid' => 'email',
+ 'uid' => 'uid',
+ 'gid' => 'gid',
+ 'password' => 'ldap_password',
+ 'mail' => 'domain_slash_username',
+;
+my $postfix_native_mailbox_map =
+ join('\n', map "$_ $postfix_native_mailbox_map{$_}",
+ keys %postfix_native_mailbox_map );