From 6569ee0ceffd720ca55594dc0f5a454187ee3b75 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 18 Nov 2003 15:05:17 +0000 Subject: [PATCH] add communigate_pro_singledomain export --- FS/FS/part_export.pm | 25 +++++++++++++++++++++++ FS/FS/part_export/communigate_pro.pm | 15 +++++++++----- FS/FS/part_export/communigate_pro_singledomain.pm | 11 ++++++++++ FS/MANIFEST | 1 + 4 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 FS/FS/part_export/communigate_pro_singledomain.pm diff --git a/FS/FS/part_export.pm b/FS/FS/part_export.pm index 3dfaaee9b..8d058842e 100644 --- a/FS/FS/part_export.pm +++ b/FS/FS/part_export.pm @@ -754,6 +754,24 @@ tie my %communigate_pro_options, 'Tie::IxHash', }, ; +tie my %communigate_pro_singledomain_options, 'Tie::IxHash', + 'port' => { label=>'Port number', default=>'106', }, + 'login' => { label=>'The administrator account name. The name can contain a domain part.', }, + 'password' => { label=>'The administrator account password.', }, + 'domain' => { label=>'Domain', }, + 'accountType' => { label=>'Type for newly-created accounts', + type=>'select', + options=>[qw( MultiMailbox TextMailbox MailDirMailbox )], + default=>'MultiMailbox', + }, + 'externalFlag' => { label=> 'Create accounts with an external (visible for legacy mailers) INBOX.', + type=>'checkbox', + }, + 'AccessModes' => { label=>'Access modes', + default=>'Mail POP IMAP PWD WebMail WebSite', + }, +; + tie my %bind_options, 'Tie::IxHash', #'machine' => { label=>'named machine' }, 'named_conf' => { label => 'named.conf location', @@ -977,6 +995,13 @@ tie my %forward_shellcommands_options, 'Tie::IxHash', 'notes' => 'Real time export to a mail server. The CommuniGate Pro Perl Interface must be installed as CGP::CLI.', }, + 'communigate_pro_singledomain' => { + 'desc' => 'Real-time export to a CommuniGate Pro mail server, one domain only', + 'options' => \%communigate_pro_singledomain_options, + 'nodomain' => 'Y', + 'notes' => 'Real time export to a mail server. This is an unusual export to CommuniGate Pro that forces all accounts into a single domain. As CommuniGate Pro supports multiple domains, unless you have a specific reason for using this export, you probably want to use the communigate_pro export instead. The CommuniGate Pro Perl Interface must be installed as CGP::CLI.', + }, + }, 'svc_domain' => { diff --git a/FS/FS/part_export/communigate_pro.pm b/FS/FS/part_export/communigate_pro.pm index 9a4539a4a..aa038f08e 100644 --- a/FS/FS/part_export/communigate_pro.pm +++ b/FS/FS/part_export/communigate_pro.pm @@ -8,10 +8,15 @@ use FS::queue; sub rebless { shift; } +sub export_username { + my($self, $svc_acct) = (shift, shift); + $svc_acct->email; +} + sub _export_insert { my( $self, $svc_acct ) = (shift, shift); my @options = ( $svc_acct->svcnum, 'CreateAccount', - 'accountName' => $svc_acct->email, + 'accountName' => $self->export_username($svc_acct), 'accountType' => $self->option('accountType'), 'AccessModes' => $self->option('AccessModes'), 'RealName' => $svc_acct->finger, @@ -47,7 +52,7 @@ sub _export_replace { #my $jobnum = $err_or_queue->jobnum; $self->communigate_pro_queue( $new->svcnum, 'SetAccountPassword', - $new->email, $new->_password ) + $self->export_username($new), $new->_password ) if $new->_password ne $old->_password; } @@ -55,14 +60,14 @@ sub _export_replace { sub _export_delete { my( $self, $svc_acct ) = (shift, shift); $self->communigate_pro_queue( $svc_acct->svcnum, 'DeleteAccount', - $svc_acct->email, + $self->export_username($svc_acct), ); } sub _export_suspend { my( $self, $svc_acct ) = (shift, shift); $self->communigate_pro_queue( $svc_acct->svcnum, 'UpdateAccountSettings', - 'accountName' => $svc_acct->email, + 'accountName' => $self->export_username($svc_acct), 'AccessModes' => 'Mail', ); } @@ -70,7 +75,7 @@ sub _export_suspend { sub _export_unsuspend { my( $self, $svc_acct ) = (shift, shift); $self->communigate_pro_queue( $svc_acct->svcnum, 'UpdateAccountSettings', - 'accountName' => $svc_acct->email, + 'accountName' => $self->export_username($svc_acct), 'AccessModes' => $self->option('AccessModes'), ); } diff --git a/FS/FS/part_export/communigate_pro_singledomain.pm b/FS/FS/part_export/communigate_pro_singledomain.pm new file mode 100644 index 000000000..11574af9b --- /dev/null +++ b/FS/FS/part_export/communigate_pro_singledomain.pm @@ -0,0 +1,11 @@ +package FS::part_export::communigate_pro_singledomain; + +use vars qw(@ISA); +use FS::part_export::communigate_pro; + +@ISA = qw(FS::part_export::communigate_pro); + +sub export_username { + my($self, $svc_acct) = (shift, shift); + $svc_acct->username. '@'. $self->option('domain'); +} diff --git a/FS/MANIFEST b/FS/MANIFEST index 934100af5..877f3ce0d 100644 --- a/FS/MANIFEST +++ b/FS/MANIFEST @@ -72,6 +72,7 @@ FS/part_export/bind.pm FS/part_export/bind_slave.pm FS/part_export/bsdshell.pm FS/part_export/communigate_pro.pm +FS/part_export/communigate_pro_singledomain.pm FS/part_export/cp.pm FS/part_export/cyrus.pm FS/part_export/domain_shellcommands.pm -- 2.11.0