add communigate_pro_singledomain export
authorivan <ivan>
Tue, 18 Nov 2003 15:05:17 +0000 (15:05 +0000)
committerivan <ivan>
Tue, 18 Nov 2003 15:05:17 +0000 (15:05 +0000)
FS/FS/part_export.pm
FS/FS/part_export/communigate_pro.pm
FS/FS/part_export/communigate_pro_singledomain.pm [new file with mode: 0644]
FS/MANIFEST

index 3dfaaee..8d05884 100644 (file)
@@ -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 <a href="http://www.stalker.com/CommuniGatePro/"> mail server.  The <a href="http://www.stalker.com/CGPerl/">CommuniGate Pro Perl Interface</a> 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 <a href="http://www.stalker.com/CommuniGatePro/"> 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 <a href="http://www.stalker.com/CGPerl/">CommuniGate Pro Perl Interface</a> must be installed as CGP::CLI.',
+    },
+
   },
 
   'svc_domain' => {
index 9a4539a..aa038f0 100644 (file)
@@ -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 (file)
index 0000000..11574af
--- /dev/null
@@ -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');
+}
index 934100a..877f3ce 100644 (file)
@@ -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