Author: varkoly Date: Sat Jul 19 00:45:57 2008 New Revision: 49260 URL: http://svn.opensuse.org/viewcvs/yast?rev=49260&view=rev Log: now we can create the shared folders for spam learning Modified: trunk/mail/src/YaPI/MailServer.pm Modified: trunk/mail/src/YaPI/MailServer.pm URL: http://svn.opensuse.org/viewcvs/yast/trunk/mail/src/YaPI/MailServer.pm?rev=49260&r1=49259&r2=49260&view=diff ============================================================================== --- trunk/mail/src/YaPI/MailServer.pm (original) +++ trunk/mail/src/YaPI/MailServer.pm Sat Jul 19 00:45:57 2008 @@ -37,6 +37,7 @@ use POSIX; # Needed for setlocale() use Data::Dumper; +use Net::IMAP; textdomain("mail"); our %TYPEINFO; @@ -55,6 +56,11 @@ my $proposal_valid = 0; ## + # Some global variables for cyrus-imapd +my $imapadm = "cyrus"; +my $imaphost = "localhost"; + +## # Write only, used during autoinstallation. # Don't run services and SuSEconfig, it's all done at one place. # @@ -1041,7 +1047,8 @@ 'BasicProtection' => 'hard', 'RBLList' => [], 'AccessList' => [], - 'VirusScanning' => 1 + 'VirusScanning' => 1, + 'SpamLearning' => 1 ); AccessList is a pointer to an array of %AccessEntry hashes. @@ -1086,7 +1093,8 @@ 'BasicProtection' => 'hard', 'RBLList' => [], 'AccessList' => [], - 'VirusScanning' => YaST::YCP::Boolean(0) + 'VirusScanning' => YaST::YCP::Boolean(0), + 'SpamLearning' => YaST::YCP::Boolean(0) ); # Make LDAP Connection @@ -1163,6 +1171,19 @@ $MailPrevention{'VirusScanning'} = YaST::YCP::Boolean(1); } } + # make IMAP connection + my $imap = new Net::IMAP($imaphost, Debug => 0); + if( $imap ) + { + $ret = $imap->login($imapadm, $AdminPassword); + if($$ret{Status} eq "ok") { + $ret = $imap->select('NEWSPAM'); + if( $ret->{Status} eq 'ok' ) + { + $MailPrevention{'SpamLearning'} = YaST::YCP::Boolean(1); + } + } + } return \%MailPrevention; } @@ -1391,6 +1412,24 @@ SCR->Write('.mail.postfix.main',undef); SCR->Write('.mail.postfix.mastercf',undef); + # make IMAP connection + my $imap = new Net::IMAP($imaphost, Debug => 0); + if( $imap ) + { + my $ret = $imap->login($imapadm, $AdminPassword); + if($$ret{Status} eq "ok") + { + if( $MailPrevention->{'SpamLearning'} ) + { + $ret = $imap->create('NewSpam'); + $ret = $imap->create('NoSpam'); + $ret = $imap->setacl('NewSpam', $imapadm, "lrswipkxtea"); + $ret = $imap->setacl('NoSpam', $imapadm, "lrswipkxtea"); + $ret = $imap->setacl('NewSpam', 'anyone', "lrswi"); + $ret = $imap->setacl('NoSpam', 'anyone', "lsi"); + } + } + } return 1; } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org