1 package FS::part_export::everyone_net;
3 use vars qw(@ISA %info);
7 @ISA = qw(FS::part_export);
9 tie my %options, 'Tie::IxHash',
10 'clientID' => { label=>'clientID' },
11 'password' => { label=>'Password' },
12 #'workgroup' => { label=>'Default Workgroup' },
17 'desc' => 'Real-time export to Everyone.net outsourced mail service',
18 'options'=> \%options,
21 <a href="http://www.cp.net/">Everyone.net</a> via the XRC Remote API.
22 Requires installation of
23 <a href="http://search.cpan.org/dist/Net-XRC">Net::XRC</a>
28 sub rebless { shift; }
30 # experiement: want the status of these right away (don't want account to
31 # create or whatever and then get error in the queue from dup username or
32 # something), so no queueing
35 my( $self, $svc_acct ) = (shift, shift);
37 eval "use Net::XRC qw(:types);";
40 $self->_xrc_command( 'createUser',
43 string($svc_acct->username),
44 string($svc_acct->_password),
49 my( $self, $method, $domain, @args ) = @_;
51 eval "use Net::XRC qw(:types);";
54 my $xrc = new Net::XRC (
55 'clientID' => $self->option('clientID'),
56 'password' => $self->option('password'),
59 my $dresponse = $xrc->lookupMXReadyClientIDByEmailDomain( string($domain) );
60 return $response->error unless $response->is_success;
61 my $clientID = $response->content;
62 return "clientID for domain $domain not found"
65 my $response = $xrc->$method($clientID, @args);
66 return $response->error unless $response->is_success;
72 my( $self, $new, $old ) = (shift, shift, shift);
74 eval "use Net::XRC qw(:types);";
77 return "can't change domain with Everyone.net"
78 if $old->domain ne $new->domain;
79 return "can't change username with Everyone.net"
80 if $old->username ne $new->username;
81 return '' unless $old->_password ne $new->_password;
83 $self->_xrc_command( 'setUserPassword',
86 string($new->username),
87 string($new->_password),
92 my( $self, $svc_acct ) = (shift, shift);
94 eval "use Net::XRC qw(:types);";
97 $self->_xrc_command( 'deleteUser',
99 string($svc_acct->username),
103 sub _export_suspend {
104 my( $self, $svc_acct ) = (shift, shift);
106 eval "use Net::XRC qw(:types);";
109 $self->_xrc_command( 'suspendUser',
112 string($svc_acct->username),
116 sub _export_unsuspend {
117 my( $self, $svc_acct ) = (shift, shift);
119 eval "use Net::XRC qw(:types);";
122 $self->_xrc_command( 'unsuspendUser',
124 string($svc_acct->username),