1 package FS::acct_snarf;
8 @ISA = qw( FS::Record );
12 FS::acct_snarf - Object methods for acct_snarf records
18 $record = new FS::acct_snarf \%hash;
19 $record = new FS::acct_snarf { 'column' => 'value' };
21 $error = $record->insert;
23 $error = $new_record->replace($old_record);
25 $error = $record->delete;
27 $error = $record->check;
31 An FS::svc_acct object represents an external mail account, typically for
32 download of mail. FS::acct_snarf inherits from FS::Record. The following
33 fields are currently supported:
37 =item snarfnum - primary key
39 =item snarfname - Label
41 =item svcnum - Account (see L<FS::svc_acct>)
43 =item machine - external machine to download mail from
45 =item protocol - protocol (pop3, imap, etc.)
47 =item username - external login username
49 =item _password - external login password
59 Creates a new record. To add the record to the database, see L<"insert">.
61 Note that this stores the hash reference, not a distinct copy of the hash it
62 points to. You can ask the object for a copy with the I<hash> method.
66 sub table { 'acct_snarf'; }
70 Adds this record to the database. If there is an error, returns the error,
71 otherwise returns false.
75 # the insert method can be inherited from FS::Record
79 Delete this record from the database.
83 # the delete method can be inherited from FS::Record
85 =item replace OLD_RECORD
87 Replaces the OLD_RECORD with this one in the database. If there is an error,
88 returns the error, otherwise returns false.
92 # the replace method can be inherited from FS::Record
96 Checks all fields to make sure this is a valid external mail account. If
97 there is an error, returns the error, otherwise returns false. Called by the
98 insert and replace methods.
105 $self->ut_numbern('snarfnum')
106 || $self->ut_textn('snarfname') #alphasn?
107 || $self->ut_number('svcnum')
108 || $self->ut_foreign_key('svcnum', 'svc_acct', 'svcnum')
109 || $self->ut_domain('machine')
110 || $self->ut_alphan('protocol')
111 || $self->ut_textn('username')
112 || $self->ut_numbern('check_freq')
113 || $self->ut_enum('leave', [ '', 'Y' ])
114 || $self->ut_enum('apop', [ '', 'Y' ])
115 || $self->ut_enum('tls', [ '', 'Y' ])
116 || $self->ut_alphan('mailbox')
118 return $error if $error;
120 $self->_password =~ /^[^\t\n]*$/ or return "illegal password";
121 $self->_password($1);
126 sub check_freq_labels {
128 tie my %hash, 'Tie::IxHash',
136 1800 => '30 minutes',
146 1000000000 => 'Disabled',
158 L<FS::Record>, schema.html from the base documentation.