Update of /cvsroot/popfile/engine/Services
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31353/Services
Modified Files:
Tag: b0_22_2
IMAP.pm
Log Message:
Write out the file that contains a retrieved message completely relying on the sys... family of functions: eliminate open, print and seek. The classifier is reading that file handle with sysread and thus we should be using sys... too.
Index: IMAP.pm
===================================================================
RCS file: /cvsroot/popfile/engine/Services/IMAP.pm,v
retrieving revision 1.9.4.8
retrieving revision 1.9.4.9
diff -C2 -d -r1.9.4.8 -r1.9.4.9
*** IMAP.pm 18 Nov 2007 11:09:35 -0000 1.9.4.8
--- IMAP.pm 19 Nov 2007 14:04:08 -0000 1.9.4.9
***************
*** 5,8 ****
--- 5,9 ----
@ISA = ("POPFile::Module");
use Carp;
+ use Fcntl;
# ----------------------------------------------------------------------------
***************
*** 746,751 ****
my $pseudo_mailer;
my $file = $self->get_user_path_( 'imap.tmp' );
! unless ( open $pseudo_mailer, "+>$file" ) {
! $self->log_( 0, "Unable to open temporary file $file. Nothing done to message $msg." );
return;
--- 747,753 ----
my $pseudo_mailer;
my $file = $self->get_user_path_( 'imap.tmp' );
!
! unless ( sysopen( $pseudo_mailer, $file, O_RDWR | O_CREAT ) ) {
! $self->log_( 0, "Unable to open temporary file $file. Nothing done to message $msg. ($!)" );
return;
***************
*** 760,768 ****
# first looking at the parts the message really has.
- my @message_parts = qw/HEADER TEXT/;
my $imap = $self->{folders__}{$folder}{imap};
PART:
! foreach my $part ( @message_parts ) {
my ($ok, @lines ) = $imap->fetch_message_part( $msg, $part );
--- 762,769 ----
# first looking at the parts the message really has.
my $imap = $self->{folders__}{$folder}{imap};
PART:
! foreach my $part ( qw/ HEADER TEXT / ) {
my ($ok, @lines ) = $imap->fetch_message_part( $msg, $part );
***************
*** 775,779 ****
foreach ( @lines ) {
! print $pseudo_mailer "$_";
}
--- 776,780 ----
foreach ( @lines ) {
! syswrite $pseudo_mailer, $_;
}
***************
*** 784,793 ****
if ( $part eq 'HEADER' ) {
! seek $pseudo_mailer, 0, 0;
( $class, $slot, $magnet_used ) = $self->classifier()->classify_and_modify( $self->api_session(), $pseudo_mailer, undef, 1, '', undef, 0, undef );
if ( $magnet_used ) {
$self->log_( 0, "Message was with slot $slot classified as $class using a magnet." );
! print $pseudo_mailer "\nThis message was classified based on a magnet.\nThe body of the message was not retrieved from the server.\n";
}
else {
--- 785,794 ----
if ( $part eq 'HEADER' ) {
! sysseek $pseudo_mailer, 0, 0;
( $class, $slot, $magnet_used ) = $self->classifier()->classify_and_modify( $self->api_session(), $pseudo_mailer, undef, 1, '', undef, 0, undef );
if ( $magnet_used ) {
$self->log_( 0, "Message was with slot $slot classified as $class using a magnet." );
! syswrite $pseudo_mailer, "\nThis message was classified based on a magnet.\nThe body of the message was not retrieved from the server.\n";
}
else {
***************
*** 799,803 ****
# are looking at the complete message. Thus we let the classifier have
# a look and make it save the message to history:
! seek $pseudo_mailer, 0, 0;
( $class, $slot, $magnet_used ) = $self->classifier()->classify_and_modify( $self->api_session(), $pseudo_mailer, undef, 0, '', undef, 0, undef );
--- 800,804 ----
# are looking at the complete message. Thus we let the classifier have
# a look and make it save the message to history:
! sysseek $pseudo_mailer, 0, 0;
( $class, $slot, $magnet_used ) = $self->classifier()->classify_and_modify( $self->api_session(), $pseudo_mailer, undef, 0, '', undef, 0, undef );
|