1 package FS::part_export::cp;
6 @ISA = qw(FS::part_export);
11 my( $self, $svc_acct ) = (shift, shift);
12 $self->cp_queue( $svc_acct->svcnum, 'create_mailbox',
13 'Mailbox' => $svc_acct->username,
14 'Password' => $svc_acct->_password,
15 'Workgroup' => $self->option('workgroup'),
16 'Domain' => $svc_acct->domain,
21 my( $self, $new, $old ) = (shift, shift, shift);
22 return "can't change domain with Critical Path"
23 if $old->domain ne $new->domain;
24 return '' unless $old->username ne $new->username
25 || $old->_password ne $new->_password;
26 $self->cp_queue( $new->svcnum, 'replace', $new->domain,
27 $old->username, $new->username, $old->_password, $new->_password );
31 my( $self, $svc_acct ) = (shift, shift);
32 $self->cp_queue( $svc_acct->svcnum, 'delete_mailbox',
33 'Mailbox' => $svc_acct->username,
34 'Domain' => $svc_acct->domain,
39 my( $self, $svc_acct ) = (shift, shift);
40 $self->cp_queue( $svc_acct->svcnum, 'set_mailbox_status',
41 'Mailbox' => $svc_acct->username,
42 'Domain' => $svc_acct->domain,
44 'OTHER_SUSPEND' => 'T',
48 sub _export_unsuspend {
49 my( $self, $svc_acct ) = (shift, shift);
50 $self->cp_queue( $svc_acct->svcnum, 'set_mailbox_status',
51 'Mailbox' => $svc_acct->username,
52 'Domain' => $svc_acct->domain,
55 'OTHER_SUSPEND' => 'F',
56 'OTHER_BOUNCE' => 'F',
61 my( $self, $svcnum, $method ) = (shift, shift, shift);
62 my $queue = new FS::queue {
64 'job' => 'FS::part_export::cp::cp_command',
68 $self->option('port'),
69 $self->option('username'),
70 $self->option('password'),
71 $self->option('domain'),
77 sub cp_command { #subroutine, not method
78 my($host, $port, $username, $password, $login_domain, $method, @args) = @_;
81 if ( $method eq 'replace' ) {
83 my( $domain, $old_username, $new_username, $old_password, $new_password)
86 if ( $old_username ne $new_username ) {
87 cp_command($host, $port, $username, $password, 'rename_mailbox',
89 Old_Mailbox => $old_username,
90 New_Mailbox => $new_username,
95 if ( $new_password =~ /^\*SUSPENDED\* (.*)$/ ) {
99 #cp_command($host, $port, $username, $password, $login_domain,
100 # 'set_mailbox_status',
102 # Mailbox => $new_username,
104 # Other_Bounce => $other,
107 if ( $old_password ne $new_password ) {
108 cp_command($host, $port, $username, $password, $login_domain,
111 Mailbox => $new_username,
112 Password => $new_password,
120 eval "use Net::APP;";
122 my $app = new Net::APP (
125 Password => $password,
126 Domain => $login_domain,
131 $app->$method( @args );
133 die $app->message."\n" unless $app->ok;