[aMail-checkins] CVS: new_project/program folders.pl,1.6,1.7 functions.pl,1.4,1.5 pop.pl,1.5,1.6
Brought to you by:
bit-man
|
From: Victor A. R. <bi...@us...> - 2002-08-29 17:36:37
|
Update of /cvsroot/amail/new_project/program
In directory usw-pr-cvs1:/tmp/cvs-serv29385/program
Modified Files:
folders.pl functions.pl pop.pl
Log Message:
Folder creation, with TRex service glue, fully integrated to TRex core ... well some minor hacks were done !!
Index: folders.pl
===================================================================
RCS file: /cvsroot/amail/new_project/program/folders.pl,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** folders.pl 26 Aug 2002 22:53:23 -0000 1.6
--- folders.pl 29 Aug 2002 17:36:34 -0000 1.7
***************
*** 341,361 ****
if ( ! defined $handler ) {
$folder_mess = "<font color='$problem_color'>" . $language->maketext("Failed to contact storage device") . ".</font>";
return;
};
my @authMethods = $handler->authMethods;
! if ( notExistsAuthMethod( 'AMAIL', \@authMethods ) ) {
$folder_mess = "<font color='$problem_color'>" . $language->maketext("Authentication failed") . ".</font>";
return;
};
! if( ! $handler->open( { AUTH_METHOD => 'AMAIL',
! AUTH_PARAMETERS => { aMail_ID => $amail_ID,
! SID => $SID } } ) ) {
$folder_mess = "<font color='$problem_color'>" . $language->maketext("Failed to contact storage device") . ".</font>";
return;
};
! if( ! (my $error = $handler->insert( { OBJECT => 'FOLDER', NAME => $folderName } ) ) ) {
$folder_mess = "<font color='$problem_color'>" . $language->maketext("Invalid authentication method") . ".</font>"
--- 341,365 ----
if ( ! defined $handler ) {
$folder_mess = "<font color='$problem_color'>" . $language->maketext("Failed to contact storage device") . ".</font>";
+ &Open_Read();
return;
};
my @authMethods = $handler->authMethods;
! if ( notExistsAuthMethod( { AUTH_METHOD => 'AMAIL',
! AUTH_ARRAY => \@authMethods } ) ) {
$folder_mess = "<font color='$problem_color'>" . $language->maketext("Authentication failed") . ".</font>";
+ &Open_Read();
return;
};
! if ( $handler->open( { AUTH_METHOD => 'AMAIL',
! AUTH_PARAMETERS => { aMail_ID => $amail_ID,
! SID => $SID } } ) ) {
$folder_mess = "<font color='$problem_color'>" . $language->maketext("Failed to contact storage device") . ".</font>";
+ &Open_Read();
return;
};
! if( my $error = $handler->insert( { OBJECT => 'FOLDER', NAME => $folderName } ) ) {
$folder_mess = "<font color='$problem_color'>" . $language->maketext("Invalid authentication method") . ".</font>"
***************
*** 371,403 ****
if ($error == 4);
! return;
};
$handler->close();
! # if ($_ = Check_folder_name($folder)) {
! # $folder_mess = $_;
! # &Open_Read();
! # return;
! # }
!
! # my $mailbox_file = "$user_path/folders";
! # safe_open_update( *MAILBOX{IO}, $mailbox_file);
! # flock(MAILBOX,2) || die "Could not exclusively lock $mailbox_file. $!";
! # while (($_ = <MAILBOX>) and $_ ne "\n") {
! # push @folders,$_;
! # }
! # foreach (@folders) {
! # if ($_ =~ /^$folder,/) {
! # $folder_mess = "<font color='$problem_color'>" . $language->maketext("You already have a folder by that name") . ".</font>";
! # close MAILBOX;
! # return;
! # }
! # }
! # my @messages = <MAILBOX>;
! # push @folders, "$folder,0,0,0\n";
! # seek MAILBOX, 0, 0;
! # print MAILBOX @folders,"\n",@messages;
! # close MAILBOX;
$folder_mess = $language->maketext("The folder [_1] has been created", "<b>$folder</b>"). ".";
$action = 1;
--- 375,385 ----
if ($error == 4);
! &Open_Read();
! return;
};
$handler->close();
!
$folder_mess = $language->maketext("The folder [_1] has been created", "<b>$folder</b>"). ".";
$action = 1;
Index: functions.pl
===================================================================
RCS file: /cvsroot/amail/new_project/program/functions.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** functions.pl 30 May 2002 17:31:09 -0000 1.4
--- functions.pl 29 Aug 2002 17:36:34 -0000 1.5
***************
*** 267,275 ****
EOP
-
-
-
-
-
-
-
--- 267,268 ----
Index: pop.pl
===================================================================
RCS file: /cvsroot/amail/new_project/program/pop.pl,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** pop.pl 3 Jun 2002 19:48:19 -0000 1.5
--- pop.pl 29 Aug 2002 17:36:34 -0000 1.6
***************
*** 13,16 ****
--- 13,17 ----
use aMail::Sec;
use aMail::PAM;
+ use aMail::Storage;
use Fcntl qw(:DEFAULT :flock);
***************
*** 167,173 ****
my $folders_file = "$db_path/$amail_ID/folders";
! safe_open_read( *MAILBOX{IO}, $folders_file );
! flock(MAILBOX,1) or die "Could not lock $db_path/$amail_ID/folders. $!";
my ($folder_info,%folder_info,$found);
while (($folder_info = <MAILBOX>) and ($folder_info ne "\n")) { # get folder info
--- 168,175 ----
my $folders_file = "$db_path/$amail_ID/folders";
! $folder_added = 0;
! AGAIN: safe_open_read( *MAILBOX{IO}, $folders_file );
! flock(MAILBOX,1) or die "Could not lock $folders_file. $!";
my ($folder_info,%folder_info,$found);
while (($folder_info = <MAILBOX>) and ($folder_info ne "\n")) { # get folder info
***************
*** 180,196 ****
@messages = <MAILBOX>;
close MAILBOX;
! &Make_sort;
! $folder_added = 0;
unless ($found) { # It's a new folder
! if ($_ = Check_folder_name($folder_to)) { # check if new name OK
$folder_mess = $_; # if something came back, it's an error message that we pass on
&Print_start;
return;
! }
! # This looks like a valid folder name
! $folder_info{$folder_to} = [$folder_to,0,0,0]; # create new folder entry
! $folder_list .= "$folder_to,";
$folder_added = 1;
}
my $keep_message;
if ($folder eq 'Search Results') { # if we are showing search results and we move a message to a folder
--- 182,218 ----
@messages = <MAILBOX>;
close MAILBOX;
!
unless ($found) { # It's a new folder
! if ($_ = createNewFolder($folder_to) ) {
$folder_mess = $_; # if something came back, it's an error message that we pass on
&Print_start;
return;
! };
$folder_added = 1;
+
+ ## Inits the previus defined/filled variables
+ undef $folder_info;
+ undef %folder_info;
+ undef $found;
+ delete @messages[ 0 ... $#messages ];
+ $folder_list = "";
+ goto AGAIN; ### This reads, again, the folders file, and is
+ ### just a hack to use createFolder mixed wiht
+ ### some code that manages the folders file
+ ### inside the kernel
+
+ # if ($_ = Check_folder_name($folder_to)) { # check if new name OK
+ # $folder_mess = $_; # if something came back, it's an error message that we pass on
+ # &Print_start;
+ # return;
+ # }
+ # # This looks like a valid folder name
+ # $folder_info{$folder_to} = [$folder_to,0,0,0]; # create new folder entry
+ # $folder_list .= "$folder_to,";
+ # $folder_added = 1;
}
+
+ &Make_sort;
+
my $keep_message;
if ($folder eq 'Search Results') { # if we are showing search results and we move a message to a folder
***************
*** 261,265 ****
}
!
sub Get_POP { #Get the email
--- 283,330 ----
}
! sub createNewFolder ($) {
! my $folderName = shift;
! my $folder_mess;
! my $handler = aMail::Storage->new( 'EMail' );
!
! if ( ! defined $handler ) {
! $folder_mess = "<font color='$problem_color'>" . $language->maketext("Failed to contact storage device") . ".</font>";
! return $folder_mess;
! };
!
! my @authMethods = $handler->authMethods;
! if ( notExistsAuthMethod( { AUTH_METHOD => 'AMAIL',
! AUTH_ARRAY => \@authMethods } ) ) {
! $folder_mess = "<font color='$problem_color'>" . $language->maketext("Authentication failed") . ".</font>";
! return $folder_mess;
! };
!
! if ( $handler->open( { AUTH_METHOD => 'AMAIL',
! AUTH_PARAMETERS => { aMail_ID => $amail_ID,
! SID => $SID } } ) ) {
! $folder_mess = "<font color='$problem_color'>" . $language->maketext("Failed to contact storage device") . ".</font>";
! return $folder_mess;
! };
!
! if( my $error = $handler->insert( { OBJECT => 'FOLDER', NAME => $folderName } ) ) {
!
! $folder_mess = "<font color='$problem_color'>" . $language->maketext("Invalid authentication method") . ".</font>"
! if ($error == 1);
!
! $folder_mess = "<font color='$problem_color'>" . $language->maketext("Authentication failed") . ".</font>"
! if ($error == 2);
!
! $folder_mess = "<font color='$problem_color'>" . $language->maketext("Internal error") . ".</font>"
! if ($error == 3);
!
! $folder_mess = "<font color='$problem_color'>" . $language->maketext("You already have a folder by that name") . ".</font>"
! if ($error == 4);
!
! return $folder_mess;
!
! };
!
! $handler->close();
! }
sub Get_POP { #Get the email
|