You can subscribe to this list here.
2003 |
Jan
|
Feb
(160) |
Mar
(119) |
Apr
(111) |
May
(118) |
Jun
(101) |
Jul
(304) |
Aug
(113) |
Sep
(140) |
Oct
(137) |
Nov
(87) |
Dec
(122) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(78) |
Feb
(125) |
Mar
(131) |
Apr
(59) |
May
(121) |
Jun
(166) |
Jul
(150) |
Aug
(137) |
Sep
(73) |
Oct
(58) |
Nov
(27) |
Dec
(60) |
2005 |
Jan
(131) |
Feb
(84) |
Mar
(36) |
Apr
(8) |
May
(28) |
Jun
(20) |
Jul
(10) |
Aug
(72) |
Sep
(76) |
Oct
(34) |
Nov
(3) |
Dec
(29) |
2006 |
Jan
(13) |
Feb
(92) |
Mar
(7) |
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
(4) |
Aug
(17) |
Sep
(5) |
Oct
(2) |
Nov
(8) |
Dec
(12) |
2007 |
Jan
(28) |
Feb
(15) |
Mar
|
Apr
|
May
(8) |
Jun
(4) |
Jul
(5) |
Aug
(8) |
Sep
(20) |
Oct
(38) |
Nov
(65) |
Dec
(92) |
2008 |
Jan
(21) |
Feb
(56) |
Mar
(27) |
Apr
(174) |
May
(25) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Manni H. <man...@us...> - 2008-04-15 06:47:37
|
Update of /cvsroot/popfile/engine/Services/IMAP In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9182/Services/IMAP Modified Files: Client.pm Log Message: Log errors when connection to server fails. Index: Client.pm =================================================================== RCS file: /cvsroot/popfile/engine/Services/IMAP/Client.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Client.pm 9 Feb 2008 08:51:25 -0000 1.5 --- Client.pm 15 Apr 2008 06:47:39 -0000 1.6 *************** *** 139,143 **** PeerPort => $port, Timeout => $timeout, ! ); } else { --- 139,144 ---- PeerPort => $port, Timeout => $timeout, ! ) ! or $self->log_(0, "IO::Socket::SSL error: $@"); } else { *************** *** 147,151 **** PeerPort => $port, Timeout => $timeout, ! ); } --- 148,153 ---- PeerPort => $port, Timeout => $timeout, ! ) ! or $self->log_(0, "IO::Socket::INET error: $@"); } |
From: Manni H. <man...@us...> - 2008-04-15 06:46:50
|
Update of /cvsroot/popfile/engine/Services/IMAP In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8805/Services/IMAP Modified Files: Tag: b0_22_2 Client.pm Log Message: Log errors when connection to server fails. Index: Client.pm =================================================================== RCS file: /cvsroot/popfile/engine/Services/IMAP/Client.pm,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -C2 -d -r1.1.2.6 -r1.1.2.7 *** Client.pm 9 Feb 2008 08:47:45 -0000 1.1.2.6 --- Client.pm 15 Apr 2008 06:46:54 -0000 1.1.2.7 *************** *** 139,143 **** PeerPort => $port, Timeout => $timeout, ! ); } else { --- 139,144 ---- PeerPort => $port, Timeout => $timeout, ! ) ! or $self->log_(0, "IO::Socket::SSL error: $@"); } else { *************** *** 147,151 **** PeerPort => $port, Timeout => $timeout, ! ); } --- 148,153 ---- PeerPort => $port, Timeout => $timeout, ! ) ! or $self->log_(0, "IO::Socket::INET error: $@"); } |
From: Manni H. <man...@us...> - 2008-04-14 10:09:41
|
Update of /cvsroot/popfile/engine/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22591/tests Modified Files: Tag: b0_22_2 IMAP_test_server.pl Log Message: The IMAP test server now uses a higher time-out value so the IMAP tests will run on systems that seem to be a bit slower. Index: IMAP_test_server.pl =================================================================== RCS file: /cvsroot/popfile/engine/tests/IMAP_test_server.pl,v retrieving revision 1.2.4.2 retrieving revision 1.2.4.3 diff -C2 -d -r1.2.4.2 -r1.2.4.3 *** IMAP_test_server.pl 11 Nov 2007 16:42:54 -0000 1.2.4.2 --- IMAP_test_server.pl 14 Apr 2008 10:09:43 -0000 1.2.4.3 *************** *** 55,59 **** # if nothing happens with in $idle_timeout seconds # we call exit. ! my $idle_timeout = 6; my @mailboxes = qw/INBOX spam personal other unclassified/; --- 55,59 ---- # if nothing happens with in $idle_timeout seconds # we call exit. ! my $idle_timeout = 60; my @mailboxes = qw/INBOX spam personal other unclassified/; |
From: Manni H. <man...@us...> - 2008-04-14 10:09:17
|
Update of /cvsroot/popfile/engine/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22564/tests Modified Files: IMAP_test_server.pl Log Message: The IMAP test server now uses a higher time-out value so the IMAP tests will run on systems that seem to be a bit slower. Index: IMAP_test_server.pl =================================================================== RCS file: /cvsroot/popfile/engine/tests/IMAP_test_server.pl,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** IMAP_test_server.pl 3 Dec 2007 08:56:13 -0000 1.6 --- IMAP_test_server.pl 14 Apr 2008 10:09:09 -0000 1.7 *************** *** 56,60 **** # if nothing happens with in $idle_timeout seconds # we call exit. ! my $idle_timeout = 6; my @mailboxes = qw/INBOX spam personal other unclassified/; --- 56,60 ---- # if nothing happens with in $idle_timeout seconds # we call exit. ! my $idle_timeout = 60; my @mailboxes = qw/INBOX spam personal other unclassified/; |
From: naoki i. <am...@us...> - 2008-04-14 00:58:26
|
Update of /cvsroot/popfile/engine/POPFile In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7538/POPFile Added Files: Random.pm Log Message: Forgot to add --- NEW FILE: Random.pm --- package POPFile::Random; #---------------------------------------------------------------------------- # # This is a module to generate random strings using the Crypt::Random or # the Crypt::OpenSSL::Random Perl modules. # # Copyright (c) 2001-2008 John Graham-Cumming # # This file is part of POPFile # # POPFile is free software; you can redistribute it and/or modify it # under the terms of version 2 of the GNU General Public License as # published by the Free Software Foundation. # # POPFile is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with POPFile; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # #---------------------------------------------------------------------------- use strict; #---------------------------------------------------------------------------- # new # # Returns the module itself # #---------------------------------------------------------------------------- sub new { my $type = shift; my $self; $self->{name__} = "random"; return bless $self, $type; } #---------------------------------------------------------------------------- # # generate_random_string # # Returns length $length of random string. # # $length Length of the string # $module The module to use to generate the random string # $strength The Strength value ( used only if using Crypt::Random ) # $device The Device value ( used only if using Crypt::Random ) # #---------------------------------------------------------------------------- sub generate_random_string { my ( $self, $module, $length, $strength, $device ) = @_; if ( defined($module) && ( $module eq 'Crypt::Random' ) ) { require Crypt::Random; return Crypt::Random::makerandom_octet( Length => $length, Strength => $strength, Device => $device, ); } if ( defined($module) && ( $module eq 'Crypt::OpenSSL::Random' ) ) { require Crypt::OpenSSL::Random; return Crypt::OpenSSL::Random::random_bytes( $length ); } my $result = ''; for (1 .. $length) { my $random = chr( int( rand(255) ) + 1 ); $result .= $random; } return $result; } #---------------------------------------------------------------------------- # # rand_seed # # Give a random seed to the module # #---------------------------------------------------------------------------- sub rand_seed { my ( $self, $seed ) = @_; my $module = $self->global_config_( 'random_module' ); if ( defined($module) && $module eq 'Crypt::OpenSSL::Random' ) { require Crypt::OpenSSL::Random; Crypt::OpenSSL::Random::random_seed( $seed ); } } 1; |
From: Brian S. <xue...@us...> - 2008-04-13 18:13:52
|
Update of /cvsroot/popfile/windows/UI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10376 Modified Files: Tag: b0_22_2 UI ReadMe Log Message: Use the UI files from NSIS 2.36 as the basis for the customised UI files for the installer and the other NSIS-based utilities. Index: UI ReadMe =================================================================== RCS file: /cvsroot/popfile/windows/UI/UI ReadMe,v retrieving revision 1.3.6.1 retrieving revision 1.3.6.2 diff -C2 -d -r1.3.6.1 -r1.3.6.2 *** UI ReadMe 29 Aug 2006 16:21:44 -0000 1.3.6.1 --- UI ReadMe 13 Apr 2008 18:13:43 -0000 1.3.6.2 *************** *** 3,7 **** ============================================================================= ! Last updated: 23 August 2006 (12:34 GMT) ============================================================================= --- 3,7 ---- ============================================================================= ! Last updated: 13 April 2008 (17:52 GMT) ============================================================================= *************** *** 22,26 **** The current versions of these customised UI files are based upon the UI files ! provided in the NSIS 2.19 release (nsis-2.19-setup.exe, dated 6 August 2006). Future updates to the NSIS compiler may not be compatible with these customised --- 22,26 ---- The current versions of these customised UI files are based upon the UI files ! provided in the NSIS 2.36 release (nsis-2.36-setup.exe, dated 29 March 2008). Future updates to the NSIS compiler may not be compatible with these customised *************** *** 50,55 **** Details: ! 'pfi_modern.exe' v1.4 was created by modifying 'modern.exe' from the NSIS 2.19 ! release (dated 06-Aug-2006), as follows: [1] Dialog 111, Control 103 (the icon image) --- 50,55 ---- Details: ! 'pfi_modern.exe' v1.3.6.2 was created by modifying 'modern.exe' from the ! NSIS 2.36 release (dated 29-Mar-2008), as follows: [1] Dialog 111, Control 103 (the icon image) *************** *** 123,128 **** ============================================================================= ! 'pfi_headerbmp.exe' v1.4 was created by modifying 'modern_headerbmp.exe' from ! the NSIS 2.19 release (dated 06-Aug-2006), as follows: [1] Dialog 105, Control 1037 (the TITLE text area) --- 123,128 ---- ============================================================================= ! 'pfi_headerbmp.exe' v1.3.6.2 was created by modifying 'modern_headerbmp.exe' ! from the NSIS 2.36 release (dated 29-Mar-2008), as follows: [1] Dialog 105, Control 1037 (the TITLE text area) *************** *** 172,177 **** ============================================================================= ! 'pfi_headerbmpr.exe' v1.4 was created by modifying 'modern_headerbmpr.exe' ! from the NSIS 2.19 release (dated 06-Aug-2006), as follows: [1] Dialog 105, Control 1037 (the TITLE text area) --- 172,177 ---- ============================================================================= ! 'pfi_headerbmpr.exe' v1.3.6.2 was created by modifying 'modern_headerbmpr.exe' ! from the NSIS 2.36 release (dated 29-Mar-2008), as follows: [1] Dialog 105, Control 1037 (the TITLE text area) |
From: Brian S. <xue...@us...> - 2008-04-13 18:11:54
|
Update of /cvsroot/popfile/windows/UI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9631 Modified Files: Tag: b0_22_2 pfi_headerbmp.exe pfi_headerbmpr.exe pfi_modern.exe Log Message: Use the UI files from NSIS 2.36 as the basis for the customised UI files for the installer and the other NSIS-based utilities. Index: pfi_headerbmp.exe =================================================================== RCS file: /cvsroot/popfile/windows/UI/pfi_headerbmp.exe,v retrieving revision 1.3.6.1 retrieving revision 1.3.6.2 diff -C2 -d -r1.3.6.1 -r1.3.6.2 Binary files /tmp/cvsqmG6DD and /tmp/cvsQsPkVY differ Index: pfi_headerbmpr.exe =================================================================== RCS file: /cvsroot/popfile/windows/UI/pfi_headerbmpr.exe,v retrieving revision 1.3.6.1 retrieving revision 1.3.6.2 diff -C2 -d -r1.3.6.1 -r1.3.6.2 Binary files /tmp/cvspS1fFC and /tmp/cvsNBsgYX differ Index: pfi_modern.exe =================================================================== RCS file: /cvsroot/popfile/windows/UI/pfi_modern.exe,v retrieving revision 1.3.6.1 retrieving revision 1.3.6.2 diff -C2 -d -r1.3.6.1 -r1.3.6.2 Binary files /tmp/cvs38TirD and /tmp/cvsbe58LY differ |
From: Brian S. <xue...@us...> - 2008-04-13 18:11:12
|
Update of /cvsroot/popfile/windows/UI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9606 Modified Files: UI ReadMe Log Message: Use the UI files from NSIS 2.36 as the basis for the customised UI files for the installer and the other NSIS-based utilities. Index: UI ReadMe =================================================================== RCS file: /cvsroot/popfile/windows/UI/UI ReadMe,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UI ReadMe 17 Aug 2004 08:28:00 -0000 1.3 --- UI ReadMe 13 Apr 2008 18:11:16 -0000 1.4 *************** *** 3,7 **** ============================================================================= ! Last updated: 16 August 2004 (17:24 GMT) ============================================================================= --- 3,7 ---- ============================================================================= ! Last updated: 13 April 2008 (17:52 GMT) ============================================================================= *************** *** 22,26 **** The current versions of these customised UI files are based upon the UI files ! provided in the NSIS 2.0b4 release (dated 19 November 2003). Future updates to the NSIS compiler may not be compatible with these customised --- 22,26 ---- The current versions of these customised UI files are based upon the UI files ! provided in the NSIS 2.36 release (nsis-2.36-setup.exe, dated 29 March 2008). Future updates to the NSIS compiler may not be compatible with these customised *************** *** 50,55 **** Details: ! 'pfi_modern.exe' v1.3 was created by modifying 'modern.exe', NSIS CVS v1.37 ! (dated 24-Oct-2003), as follows: [1] Dialog 111, Control 103 (the icon image) --- 50,55 ---- Details: ! 'pfi_modern.exe' v1.4 was created by modifying 'modern.exe' from the NSIS 2.36 ! release (dated 29-Mar-2008), as follows: [1] Dialog 111, Control 103 (the icon image) *************** *** 123,128 **** ============================================================================= ! 'pfi_headerbmp.exe' v1.3 was created by modifying 'modern_headerbmp.exe', ! NSIS CVS v1.6 (dated 12-Oct-2003), as follows: [1] Dialog 105, Control 1037 (the TITLE text area) --- 123,128 ---- ============================================================================= ! 'pfi_headerbmp.exe' v1.4 was created by modifying 'modern_headerbmp.exe' from ! the NSIS 2.36 release (dated 29-Mar-2008), as follows: [1] Dialog 105, Control 1037 (the TITLE text area) *************** *** 172,177 **** ============================================================================= ! 'pfi_headerbmpr.exe' v1.3 was created by modifying 'modern_headerbmpr.exe', ! NSIS CVS v1.6 (dated 12-Oct-2003), as follows: [1] Dialog 105, Control 1037 (the TITLE text area) --- 172,177 ---- ============================================================================= ! 'pfi_headerbmpr.exe' v1.4 was created by modifying 'modern_headerbmpr.exe' ! from the NSIS 2.36 release (dated 29-Mar-2008), as follows: [1] Dialog 105, Control 1037 (the TITLE text area) |
From: Brian S. <xue...@us...> - 2008-04-13 18:10:17
|
Update of /cvsroot/popfile/windows/UI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9044 Modified Files: pfi_headerbmp.exe pfi_headerbmpr.exe pfi_modern.exe Log Message: Use the UI files from NSIS 2.36 as the basis for the customised UI files for the installer and the other NSIS-based utilities. Index: pfi_headerbmp.exe =================================================================== RCS file: /cvsroot/popfile/windows/UI/pfi_headerbmp.exe,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvsPPwNga and /tmp/cvsdBHFut differ Index: pfi_headerbmpr.exe =================================================================== RCS file: /cvsroot/popfile/windows/UI/pfi_headerbmpr.exe,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvsZAchUd and /tmp/cvs2ubO9w differ Index: pfi_modern.exe =================================================================== RCS file: /cvsroot/popfile/windows/UI/pfi_modern.exe,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvswWZGgc and /tmp/cvsOlIUxv differ |
From: naoki i. <am...@us...> - 2008-04-13 03:08:04
|
Update of /cvsroot/popfile/engine/UI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23448/UI Modified Files: HTML.pm HTTP.pm Log Message: Change Log 1. New options in cloning user UI/HTML.pm Classifier/Bayes.pm skins/default/users-page.thtml languages/English.msg languages/Nihongo.msg Following two options are added: 1. Copy user's magnets 2. Copy user's corpus If these options are choosed, the magnets or corpus data of the cloned user will be copied to the new user. 2. The language cache is now updated correctly UI/HTML.pm 3. Admin's language setting is copied to the global language setting in the single user mode UI/HTML.pm 4. A new module 'POPFile::Random' A new option 'GLOBAL_random_module' A new function 'random_()' POPFile/Random.pm POPFile/Configuration.pm POPFile/Module.pm Classifier/Bayes.pm UI/HTML.pm UI/HTTP.pm tests/TestConfiguration.tst The new module 'POPFile::Random' is used for generating random strings. The new option 'GLOBAL_random_module' is used for specifying which module to be used in the POPFile::Random module. The new function 'random_()' is used for accessing the POPFile::Random module. 5. jump_to_message now works even if the UI is protected with a password UI/HTML.pm 6. The log files cannot be accessed from non admin users UI/HTML.pm 7. The log files won't be cached by the web browsers UI/HTTP.pm 8. The password input box is automatically selected in the single user mode skins/default/password-page.thtml 9. Fixed some typos skins/default/pop3-chain-panel.thtml languages/English.msg languages/Nihongo.msg Current state of the test suite: TestBayesScript PASS TestBayes PASS TestConfiguration PASS * TestHistory PASS * TestHTML PASS * TestHTTP PASS TestIMAP fail TestInsertScript PASS * TestLogger PASS TestMailParse PASS TestModule PASS TestMQ PASS TestMutex PASS TestPipeScript PASS TestPOP3 PASS TestProxy PASS TestWordMangle PASS TestXMLRPC PASS (but child process does not terminate) * : needs to add tests for multi user support TODO 1. multi user mode tests are needed tests/TestConfiguration.tst tests/TestHistory.tst tests/TestHTML.tst tests/TestInsertScript.tst Index: HTML.pm =================================================================== RCS file: /cvsroot/popfile/engine/UI/HTML.pm,v retrieving revision 1.387 retrieving revision 1.388 diff -C2 -d -r1.387 -r1.388 *** HTML.pm 9 Apr 2008 17:20:47 -0000 1.387 --- HTML.pm 13 Apr 2008 03:08:09 -0000 1.388 *************** *** 43,47 **** use MIME::Base64; use Crypt::CBC; - use Crypt::Random qw( makerandom_octet ); use Digest::MD5 qw( md5_hex ); --- 43,46 ---- *************** *** 217,224 **** # translated will still appear ! $self->load_language( 'English' ); ! if ( $self->global_config_( 'language' ) ne 'English' ) { ! $self->load_language( $self->global_config_( 'language' ) ); ! } return $self->SUPER::start(); --- 216,220 ---- # translated will still appear ! $self->cache_global_language( $self->global_config_( 'language' ) ); return $self->SUPER::start(); *************** *** 365,374 **** # translated will still appear ! if ( $self->user_config_( $user, 'language' ) ne $self->global_config_( 'language' ) ) { ! $self->load_language( 'English', $session ); ! if ( $self->user_config_( $user, 'language' ) ne 'English' ) { ! $self->load_language( $self->user_config_( $user, 'language' ), $session ); ! } ! } return $session; --- 361,366 ---- # translated will still appear ! $self->cache_language_for_user( $self->user_config_( $user, 'language' ), ! $session ); return $session; *************** *** 405,416 **** # The IP address of the client that set the cookie # MD5 checksum of the data (hex encoded) ! $self->log_( 1, "Generating random octet" ); ! $cookie_string = encode_base64( ! makerandom_octet( ! Length => 16, ! Strength => $self->global_config_( 'crypt_strength' ), ! Device => $self->global_config_( 'crypt_device' ) ! ), ! '' ); $cookie_string .= ' '; $cookie_string .= time; --- 397,412 ---- # The IP address of the client that set the cookie # MD5 checksum of the data (hex encoded) ! ! my $module = $self->global_config_( 'random_module' ); ! $self->log_( 1, "Generating random octet using $module" ); ! ! $cookie_string = encode_base64( ! $self->random_()->generate_random_string( ! $module, ! 16, ! $self->global_config_( 'crypt_strength' ), ! $self->global_config_( 'crypt_device' ) ! ), ! '' ); $cookie_string .= ' '; $cookie_string .= time; *************** *** 496,499 **** --- 492,499 ---- $url =~ s/#.*//; + # Save the original URL + + my $original_url = $url; + # If the URL was passed in through a GET then it may contain form # arguments separated by & signs, which we parse out into the *************** *** 522,526 **** # prevent caching ! if ( $url =~ /skins\/(([^\/]+)\/(([^\/]+\/)+)?)?([^\/]+)$/ ) { my $user = 1; my $path = ( $1 || ''); --- 522,526 ---- # prevent caching ! if ( $url =~ /^\/skins\/(([^\/]+)\/(([^\/]+\/)+)?)?([^\/]+)$/ ) { my $user = 1; my $path = ( $1 || ''); *************** *** 593,612 **** } ! if ( $url =~ /\/autogen_(.+)\.bmp/ ) { $self->bmp_file__( $client, $1 ); return 1; } ! if ( $url =~ /\/(.+\.gif)/ ) { $self->http_file_( $client, $self->get_root_path_( $1 ), 'image/gif' ); return 1; } ! if ( $url =~ /\/(.+\.png)/ ) { $self->http_file_( $client, $self->get_root_path_( $1 ), 'image/png' ); return 1; } ! if ( $url =~ /\/(.+\.ico)/ ) { $self->http_file_( $client, $self->get_root_path_( $1 ), 'image/x-icon' ); --- 593,612 ---- } ! if ( $url =~ /^\/autogen_(.+)\.bmp/ ) { $self->bmp_file__( $client, $1 ); return 1; } ! if ( $url =~ /^\/(.+\.gif)/ ) { $self->http_file_( $client, $self->get_root_path_( $1 ), 'image/gif' ); return 1; } ! if ( $url =~ /^\/(.+\.png)/ ) { $self->http_file_( $client, $self->get_root_path_( $1 ), 'image/png' ); return 1; } ! if ( $url =~ /^\/(.+\.ico)/ ) { $self->http_file_( $client, $self->get_root_path_( $1 ), 'image/x-icon' ); *************** *** 614,622 **** } ! if ( $url =~ /(manual\/.+\.html)/ ) { $self->http_file_( $client, $self->get_root_path_( $1 ), 'text/html' ); return 1; } if ( $url eq '/jump_to_message' ) { $self->{form_}{filter} = ''; --- 614,642 ---- } ! if ( $url =~ /^\/(manual\/.+\.html)/ ) { $self->http_file_( $client, $self->get_root_path_( $1 ), 'text/html' ); return 1; } + # If we don't have a valid session key, then insist that the user + # log in, or check the username and password for validity, if they + # are valid then create the session now. In single user mode get + # the key + + if ( !defined( $session ) ) { + my $continue; + + ( $session, $continue ) = $self->password_page( $client, $original_url ); + if ( !defined( $continue ) || + $continue eq '/password' ) { + $continue = '/'; + } + if ( defined( $session ) ) { + $self->http_redirect_( $client, $continue , $session ); + } + + return 1; + } + if ( $url eq '/jump_to_message' ) { $self->{form_}{filter} = ''; *************** *** 638,661 **** } ! # If we don't have a valid session key, then insist that the user ! # log in, or check the username and password for validity, if they ! # are valid then create the session now. In single user mode get ! # the key ! ! if ( !defined( $session ) ) { ! my $continue; ! ( $session, $continue ) = $self->password_page( $client, $url ); ! if ( !defined( $continue ) || ! $continue eq '/password' ) { ! $continue = '/'; ! } ! if ( defined( $session ) ) { ! $self->http_redirect_( $client, $continue , $session ); ! } ! ! return 1; ! } ! ! if ( $url =~ /(popfile.*\.log)/ ) { $self->http_file_( $client, $self->logger_()->debug_filename(), 'text/plain' ); --- 658,663 ---- } ! if ( ( $url =~ /^\/popfile.*\.log$/ ) && ! ( $self->classifier_()->is_admin_session( $session ) ) ) { $self->http_file_( $client, $self->logger_()->debug_filename(), 'text/plain' ); *************** *** 669,674 **** if ( ( $url eq '/shutdown' ) && ! ( $self->user_global_config_( $self->{sessions__}{$session}{user}, ! 'can_admin' ) ) ) { my $http_header = "HTTP/1.1 200 OK\r\n"; $http_header .= "Connection: close\r\n"; --- 671,675 ---- if ( ( $url eq '/shutdown' ) && ! ( $self->classifier_()->is_admin_session( $session ) ) ) { my $http_header = "HTTP/1.1 200 OK\r\n"; $http_header .= "Connection: close\r\n"; *************** *** 741,745 **** # not then remove the administration and advanced URLs ! if ( !$self->user_global_config_( $self->{sessions__}{$session}{user}, 'can_admin' ) ) { delete $url_table{'/administration'}; delete $url_table{'/advanced'}; --- 742,746 ---- # not then remove the administration and advanced URLs ! if ( !$self->classifier_()->is_admin_session( $session ) ) { delete $url_table{'/administration'}; delete $url_table{'/advanced'}; *************** *** 1063,1084 **** my ( $self, $client, $templ, $template, $page, $session ) = @_; if ( defined($self->{form_}{skin}) ) { ! $self->user_config_( $self->{sessions__}{$session}{user}, 'skin', $self->{form_}{skin} ); $templ = $self->load_template__( $template, $page, $session ); } if ( defined($self->{form_}{language}) ) { ! if ( $self->user_config_( $self->{sessions__}{$session}{user}, 'language' ) ne $self->{form_}{language} ) { ! $self->user_config_( $self->{sessions__}{$session}{user}, 'language', $self->{form_}{language} ); ! if ( $self->user_config_( $self->{sessions__}{$session}{user}, 'language' ) ne $self->global_config_( 'language' ) ) { ! if ( $self->user_config_( $self->{sessions__}{$session}{user}, 'language' ) ne 'English' ) { ! $self->load_language( 'English', $session ); ! } ! $self->load_language( $self->user_config_( $self->{sessions__}{$session}{user}, 'language' ), $session ); ! } else { ! delete $self->{language__}{$session}; } # Force a template relocalization because the language has been # changed which changes the localization of the template --- 1064,1095 ---- my ( $self, $client, $templ, $template, $page, $session ) = @_; + my $userid = $self->classifier_()->valid_session_key__( $session ); + if ( defined($self->{form_}{skin}) ) { ! $self->user_config_( $userid, 'skin', $self->{form_}{skin} ); $templ = $self->load_template__( $template, $page, $session ); } if ( defined($self->{form_}{language}) ) { ! if ( $self->user_config_( $userid, 'language' ) ne $self->{form_}{language} ) { ! my $language = $self->{form_}{language}; ! ! $self->user_config_( $userid, 'language', $language ); ! ! # If the language setting of the administrator is changed in the ! # multiuser mode, update the global language setting ! ! if ( $self->global_config_( 'single_user' ) && ! ( $userid eq 1 ) ) { ! $self->global_config_( 'language', $language ); ! ! $self->cache_language_for_user( $language, 'global' ); } + # Reload language cache + + $self->cache_language_for_user( $language, $session ); + # Force a template relocalization because the language has been # changed which changes the localization of the template *************** *** 1096,1100 **** $name =~ /\/([^\/]+)\/$/; $name = $1; ! my $selected = ( $name eq $self->user_config_( $self->{sessions__}{$session}{user}, 'skin' ) )?'selected':''; if ( $name =~ /tiny/ ) { --- 1107,1111 ---- $name =~ /\/([^\/]+)\/$/; $name = $1; ! my $selected = ( $name eq $self->user_config_( $userid, 'skin' ) )?'selected':''; if ( $name =~ /tiny/ ) { *************** *** 1121,1125 **** my %row_data; $row_data{Configuration_Language} = $lang; ! $row_data{Configuration_Selected_Language} = ( $lang eq $self->user_config_( $self->{sessions__}{$session}{user}, 'language' ) )?'selected':''; push ( @language_loop, \%row_data ); } --- 1132,1136 ---- my %row_data; $row_data{Configuration_Language} = $lang; ! $row_data{Configuration_Selected_Language} = ( $lang eq $self->user_config_( $userid, 'language' ) )?'selected':''; push ( @language_loop, \%row_data ); } *************** *** 1132,1141 **** if ( defined($self->{form_}{hide_configbar}) ) { ! $self->user_config_( $self->{sessions__}{$session}{user}, 'show_configbars', 0 ); $templ->param( 'If_Show_Config_Bars' => 0 ); } if ( defined ($self->{form_}{show_configbar}) ) { ! $self->user_config_( $self->{sessions__}{$session}{user}, 'show_configbars', 1 ); $templ->param( 'If_Show_Config_Bars' => 1 ); } --- 1143,1152 ---- if ( defined($self->{form_}{hide_configbar}) ) { ! $self->user_config_( $userid, 'show_configbars', 0 ); $templ->param( 'If_Show_Config_Bars' => 0 ); } if ( defined ($self->{form_}{show_configbar}) ) { ! $self->user_config_( $userid, 'show_configbars', 1 ); $templ->param( 'If_Show_Config_Bars' => 1 ); } *************** *** 1504,1508 **** if ( exists( $self->{form_}{create} ) && ( $self->{form_}{newuser} ne '' ) ) { ! my ( $result, $password ) = $self->classifier_()->create_user( $session, $self->{form_}{newuser}, $self->{form_}{clone} ); if ( $result == 0 ) { if ( $self->{form_}{clone} ne '' ) { --- 1515,1524 ---- if ( exists( $self->{form_}{create} ) && ( $self->{form_}{newuser} ne '' ) ) { ! my ( $result, $password ) = $self->classifier_()->create_user( ! $session, ! $self->{form_}{newuser}, ! $self->{form_}{clone}, ! $self->{form_}{users_copy_magnets}, ! $self->{form_}{users_copy_corpus} ); if ( $result == 0 ) { if ( $self->{form_}{clone} ne '' ) { *************** *** 3617,3623 **** --- 3633,3641 ---- my $user = 1; + my $can_admin = 0; if ( defined( $session ) ) { $user = $self->{sessions__}{$session}{user}; + $can_admin = $self->classifier_()->is_admin_session( $session ); } *************** *** 3658,3663 **** 'If_Show_Config_Bars' => $self->user_config_( $user, 'show_configbars' ), ! 'Common_Middle_If_CanAdmin' => ! $self->user_global_config_( $user, 'can_admin' ), 'If_Javascript_OK' => $self->config_( 'allow_javascript' ), 'If_Language_RTL' => --- 3676,3680 ---- 'If_Show_Config_Bars' => $self->user_config_( $user, 'show_configbars' ), ! 'Common_Middle_If_CanAdmin' => $can_admin, 'If_Javascript_OK' => $self->config_( 'allow_javascript' ), 'If_Language_RTL' => *************** *** 3754,3777 **** #---------------------------------------------------------------------------- # ! # load_language # ! # Fill the language hash with the language strings that are from the ! # named language file # ! # $lang - The language to load (no .msg extension) # #---------------------------------------------------------------------------- ! sub load_language { my ( $self, $lang, $session ) = @_; ! my $user = 1; ! if ( defined( $session ) ) { ! $user = $self->{sessions__}{$session}{user}; } else { ! $session = 'global'; } if ( open LANG, '<' . $self->get_root_path_( "languages/$lang.msg" ) ) { while ( <LANG> ) { --- 3771,3859 ---- #---------------------------------------------------------------------------- # ! # cache_global_language # ! # Cache the language file # ! # $lang - The language to cache # #---------------------------------------------------------------------------- ! sub cache_global_language ! { ! my ( $self, $lang ) = @_; ! ! $self->load_language( 'English', 'global', 0 ); ! if ( $lang ne 'English' ) { ! $self->load_language( $lang, 'global', 0 ); ! } ! $self->{language__}{global}{lang} = $lang; ! } ! ! #---------------------------------------------------------------------------- ! # ! # cache_language_for_user ! # ! # Cache the language file for the user ! # ! # $lang - The language to cache ! # $session - A valid session key ! # ! #---------------------------------------------------------------------------- ! sub cache_language_for_user { my ( $self, $lang, $session ) = @_; ! my $test_language = 0; ! my $need_to_load = 0; ! my $user = $self->classifier_()->valid_session_key__( $session ); ! return if ( !defined($user) ); ! ! $test_language = $self->user_config_( $user, 'test_language' ); ! ! if ( $test_language ) { ! $need_to_load = 1; } else { ! if ( $self->{language__}{global}{lang} ne $self->user_config_( $user, 'language' ) ) { ! if ( !defined($self->{language__}{$session}) ) { ! $need_to_load = 1; ! } else { ! if ( $self->{language__}{$session}{lang} ne $self->user_config_( $user, 'language' ) ) { ! $need_to_load = 1; ! } ! } ! } else { ! if ( defined($self->{language__}{$session}) ) { ! delete $self->{language__}{$session}; ! } ! } } + if ( $need_to_load ) { + $self->load_language( 'English', $session, $test_language ); + if ( $lang ne 'English' ) { + $self->load_language( $lang, $session, $test_language ); + } + $self->{language__}{$session}{lang} = $lang; + } + } + + #---------------------------------------------------------------------------- + # + # load_language + # + # Fill the language hash with the language strings that are from the + # named language file + # + # + # + # $lang - The language to load (no .msg extension) + # $session - A valid session key + # $test_language - If 1, language file test mode + # + #---------------------------------------------------------------------------- + sub load_language + { + my ( $self, $lang, $session, $test_language ) = @_; + if ( open LANG, '<' . $self->get_root_path_( "languages/$lang.msg" ) ) { while ( <LANG> ) { *************** *** 3783,3787 **** $value = $1; } ! my $msg = ($self->user_config_( $user, 'test_language' )) ? $id : $value; $msg =~ s/[\r\n]//g; --- 3865,3869 ---- $value = $1; } ! my $msg = $test_language ? $id : $value; $msg =~ s/[\r\n]//g; Index: HTTP.pm =================================================================== RCS file: /cvsroot/popfile/engine/UI/HTTP.pm,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** HTTP.pm 5 Apr 2008 16:50:46 -0000 1.38 --- HTTP.pm 13 Apr 2008 03:08:09 -0000 1.39 *************** *** 37,41 **** use Crypt::CBC; - use Crypt::Random qw/makerandom_octet/; use MIME::Base64; --- 37,40 ---- *************** *** 100,108 **** # Think of an encryption key for encrypting cookies using Blowfish ! $self->log_( 1, "Generating random octet" ); ! my $key = makerandom_octet( ! Length => 56, ! Strength => $self->global_config_( 'crypt_strength' ), ! Device => $self->global_config_( 'crypt_device' ) ); $self->{crypto__} = new Crypt::CBC( { 'key' => $key, --- 99,111 ---- # Think of an encryption key for encrypting cookies using Blowfish ! ! my $module = $self->global_config_( 'random_module' ); ! $self->log_( 1, "Generating random octet using $module" ); ! ! my $key = $self->random_()->generate_random_string( ! $module, ! 56, ! $self->global_config_( 'crypt_strength' ), ! $self->global_config_( 'crypt_devide' ) ); $self->{crypto__} = new Crypt::CBC( { 'key' => $key, *************** *** 455,459 **** my $expires = $self->zulu_offset_( 0, 1 ); ! my $header = "HTTP/1.0 200 OK$eol" . "Content-Type: $type$eol" . "Expires: $expires$eol" . "Content-Length: "; $header .= length($contents); $header .= "$eol$eol"; --- 458,473 ---- my $expires = $self->zulu_offset_( 0, 1 ); ! my $header = "HTTP/1.0 200 OK$eol"; ! $header .= "Content-Type: $type$eol"; ! if ( $file =~ /\.log$/ ) { ! # The log files should not been cached ! ! $header .= "Pragma: no-cache$eol"; ! $header .= "Cache-Control: no-cache$eol"; ! $header .= "Expires: 0$eol"; ! } else { ! $header .= "Expires: $expires$eol"; ! } ! $header .= "Content-Length: "; $header .= length($contents); $header .= "$eol$eol"; |
From: naoki i. <am...@us...> - 2008-04-13 03:08:04
|
Update of /cvsroot/popfile/engine/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23448/tests Modified Files: TestConfiguration.tst Log Message: Change Log 1. New options in cloning user UI/HTML.pm Classifier/Bayes.pm skins/default/users-page.thtml languages/English.msg languages/Nihongo.msg Following two options are added: 1. Copy user's magnets 2. Copy user's corpus If these options are choosed, the magnets or corpus data of the cloned user will be copied to the new user. 2. The language cache is now updated correctly UI/HTML.pm 3. Admin's language setting is copied to the global language setting in the single user mode UI/HTML.pm 4. A new module 'POPFile::Random' A new option 'GLOBAL_random_module' A new function 'random_()' POPFile/Random.pm POPFile/Configuration.pm POPFile/Module.pm Classifier/Bayes.pm UI/HTML.pm UI/HTTP.pm tests/TestConfiguration.tst The new module 'POPFile::Random' is used for generating random strings. The new option 'GLOBAL_random_module' is used for specifying which module to be used in the POPFile::Random module. The new function 'random_()' is used for accessing the POPFile::Random module. 5. jump_to_message now works even if the UI is protected with a password UI/HTML.pm 6. The log files cannot be accessed from non admin users UI/HTML.pm 7. The log files won't be cached by the web browsers UI/HTTP.pm 8. The password input box is automatically selected in the single user mode skins/default/password-page.thtml 9. Fixed some typos skins/default/pop3-chain-panel.thtml languages/English.msg languages/Nihongo.msg Current state of the test suite: TestBayesScript PASS TestBayes PASS TestConfiguration PASS * TestHistory PASS * TestHTML PASS * TestHTTP PASS TestIMAP fail TestInsertScript PASS * TestLogger PASS TestMailParse PASS TestModule PASS TestMQ PASS TestMutex PASS TestPipeScript PASS TestPOP3 PASS TestProxy PASS TestWordMangle PASS TestXMLRPC PASS (but child process does not terminate) * : needs to add tests for multi user support TODO 1. multi user mode tests are needed tests/TestConfiguration.tst tests/TestHistory.tst tests/TestHTML.tst tests/TestInsertScript.tst Index: TestConfiguration.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestConfiguration.tst,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** TestConfiguration.tst 9 Apr 2008 17:20:48 -0000 1.24 --- TestConfiguration.tst 13 Apr 2008 03:08:09 -0000 1.25 *************** *** 131,134 **** --- 131,136 ---- test_assert_regexp( $line, 'GLOBAL_msgdir messages/' ); $line = <FILE>; + test_assert_regexp( $line, 'GLOBAL_random_module Crypt::OpenSSL::Random' ); + $line = <FILE>; test_assert_regexp( $line, 'GLOBAL_single_user 1' ); $line = <FILE>; |
From: naoki i. <am...@us...> - 2008-04-13 03:08:04
|
Update of /cvsroot/popfile/engine/languages In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23448/languages Modified Files: English.msg Nihongo.msg Log Message: Change Log 1. New options in cloning user UI/HTML.pm Classifier/Bayes.pm skins/default/users-page.thtml languages/English.msg languages/Nihongo.msg Following two options are added: 1. Copy user's magnets 2. Copy user's corpus If these options are choosed, the magnets or corpus data of the cloned user will be copied to the new user. 2. The language cache is now updated correctly UI/HTML.pm 3. Admin's language setting is copied to the global language setting in the single user mode UI/HTML.pm 4. A new module 'POPFile::Random' A new option 'GLOBAL_random_module' A new function 'random_()' POPFile/Random.pm POPFile/Configuration.pm POPFile/Module.pm Classifier/Bayes.pm UI/HTML.pm UI/HTTP.pm tests/TestConfiguration.tst The new module 'POPFile::Random' is used for generating random strings. The new option 'GLOBAL_random_module' is used for specifying which module to be used in the POPFile::Random module. The new function 'random_()' is used for accessing the POPFile::Random module. 5. jump_to_message now works even if the UI is protected with a password UI/HTML.pm 6. The log files cannot be accessed from non admin users UI/HTML.pm 7. The log files won't be cached by the web browsers UI/HTTP.pm 8. The password input box is automatically selected in the single user mode skins/default/password-page.thtml 9. Fixed some typos skins/default/pop3-chain-panel.thtml languages/English.msg languages/Nihongo.msg Current state of the test suite: TestBayesScript PASS TestBayes PASS TestConfiguration PASS * TestHistory PASS * TestHTML PASS * TestHTTP PASS TestIMAP fail TestInsertScript PASS * TestLogger PASS TestMailParse PASS TestModule PASS TestMQ PASS TestMutex PASS TestPipeScript PASS TestPOP3 PASS TestProxy PASS TestWordMangle PASS TestXMLRPC PASS (but child process does not terminate) * : needs to add tests for multi user support TODO 1. multi user mode tests are needed tests/TestConfiguration.tst tests/TestHistory.tst tests/TestHTML.tst tests/TestInsertScript.tst Index: Nihongo.msg =================================================================== RCS file: /cvsroot/popfile/engine/languages/Nihongo.msg,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Nihongo.msg 9 Apr 2008 17:20:48 -0000 1.24 --- Nihongo.msg 13 Apr 2008 03:08:09 -0000 1.25 *************** *** 178,182 **** Configuration_SOCKSPortUpdate SOCKS V ¥×¥í¥¥·¤Î¥Ý¡¼¥ÈÈÖ¹æ¤ò %s ¤ËÊѹ¹¤·¤Þ¤·¤¿¡£ Configuration_SOCKSServerUpdate SOCKS V ¥×¥í¥¥·¤Î¥µ¡¼¥Ð¤ò %s ¤ËÊѹ¹¤·¤Þ¤·¤¿¡£ ! Configuration_Fields ÍúÎò¥¿¥Ö¤Ëɽ¼¨¤¹¤ë¹àÌÜ Configuration_ChangePassword ¥Ñ¥¹¥ï¡¼¥É¤ÎÊѹ¹ Configuration_OldPassword µì¥Ñ¥¹¥ï¡¼¥É --- 178,182 ---- Configuration_SOCKSPortUpdate SOCKS V ¥×¥í¥¥·¤Î¥Ý¡¼¥ÈÈÖ¹æ¤ò %s ¤ËÊѹ¹¤·¤Þ¤·¤¿¡£ Configuration_SOCKSServerUpdate SOCKS V ¥×¥í¥¥·¤Î¥µ¡¼¥Ð¤ò %s ¤ËÊѹ¹¤·¤Þ¤·¤¿¡£ ! Configuration_Fields ÍúÎò¥¿¥Ö¹àÌܤòÄɲà Configuration_ChangePassword ¥Ñ¥¹¥ï¡¼¥É¤ÎÊѹ¹ Configuration_OldPassword µì¥Ñ¥¹¥ï¡¼¥É *************** *** 213,221 **** Users_Change_Password ¥æ¡¼¥¶¡¼¥Ñ¥¹¥ï¡¼¥É¤ÎÊѹ¹/½é´ü²½ Users_CopyFrom ÀßÄê¤ò¥³¥Ô¡¼¤¹¤ë¥æ¡¼¥¶¡¼ Users_RemoveUser ¥æ¡¼¥¶¡¼¤Îºï½ü Users_CreateUser ¥æ¡¼¥¶¡¼¤ÎºîÀ® Users_EditUser ÊÔ½¸¤¹¤ë¥æ¡¼¥¶¡¼ Users_ChangePasswordUser ¥Ñ¥¹¥ï¡¼¥É¤òÊѹ¹¤¹¤ë¥æ¡¼¥¶¡¼ ! Users_ResetPassword ¥Ñ¥¹¥ï¡¼¥É¤Î½é´ü²½ Users_Parameters ¥Ñ¥é¥á¡¼¥¿¡¼ Users_Created ¥æ¡¼¥¶¡¼ '%s' ¤òºîÀ®¤·¤Þ¤·¤¿¡Ê½é´ü¥Ñ¥¹¥ï¡¼¥É¤Ï '%s'¡Ë --- 213,223 ---- Users_Change_Password ¥æ¡¼¥¶¡¼¥Ñ¥¹¥ï¡¼¥É¤ÎÊѹ¹/½é´ü²½ Users_CopyFrom ÀßÄê¤ò¥³¥Ô¡¼¤¹¤ë¥æ¡¼¥¶¡¼ + Users_CopyMagnets ¥æ¡¼¥¶¡¼¤Î¥Þ¥°¥Í¥Ã¥È¤ò¥³¥Ô¡¼¤¹¤ë + Users_CopyCorpus ¥æ¡¼¥¶¡¼¤Î¥³¡¼¥Ñ¥¹¤ò¥³¥Ô¡¼¤¹¤ë(¤³¤Î½èÍý¤Ë¤ÏŤ¤»þ´Ö¤¬¤«¤«¤ë¤«¤â¤·¤ì¤Þ¤»¤ó) Users_RemoveUser ¥æ¡¼¥¶¡¼¤Îºï½ü Users_CreateUser ¥æ¡¼¥¶¡¼¤ÎºîÀ® Users_EditUser ÊÔ½¸¤¹¤ë¥æ¡¼¥¶¡¼ Users_ChangePasswordUser ¥Ñ¥¹¥ï¡¼¥É¤òÊѹ¹¤¹¤ë¥æ¡¼¥¶¡¼ ! Users_ResetPassword ¥Ñ¥¹¥ï¡¼¥É¤ò½é´ü²½¤¹¤ë Users_Parameters ¥Ñ¥é¥á¡¼¥¿¡¼ Users_Created ¥æ¡¼¥¶¡¼ '%s' ¤òºîÀ®¤·¤Þ¤·¤¿¡Ê½é´ü¥Ñ¥¹¥ï¡¼¥É¤Ï '%s'¡Ë *************** *** 267,271 **** History_Increase ¹¤¯ History_Decrease ¶¹¤¯ ! History_Column_Characters From¡¢To¡¢Cc¡¢·ï̾Íó¤ÎÉý¤òÊѹ¹ History_Automatic ¼«Æ° History_Reclassified ºÆÊ¬Îव¤ì¤Þ¤·¤¿ --- 269,273 ---- History_Increase ¹¤¯ History_Decrease ¶¹¤¯ ! History_Column_Characters ÍúÎò¤ÎÎó¤ÎÉý History_Automatic ¼«Æ° History_Reclassified ºÆÊ¬Îव¤ì¤Þ¤·¤¿ *************** *** 516,520 **** tip_Users_Change_Password ¥æ¡¼¥¶¡¼¤Î¥Ñ¥¹¥ï¡¼¥É¤òÊѹ¹¤·¤Þ¤¹ ! tip_Account_Remove ¥æ¡¼¥¶¡¼¤Î¥¢¥«¥¦¥ó¥È¤òºï½ü¤·¤Þ¤¹ tip_Footer_HomePage POPFile ¥Û¡¼¥à¥Ú¡¼¥¸¤ËÀܳ¤·¤Þ¤¹ --- 518,522 ---- tip_Users_Change_Password ¥æ¡¼¥¶¡¼¤Î¥Ñ¥¹¥ï¡¼¥É¤òÊѹ¹¤·¤Þ¤¹ ! tip_Accounts_Remove ¥æ¡¼¥¶¡¼¤Î¥¢¥«¥¦¥ó¥È¤òºï½ü¤·¤Þ¤¹ tip_Footer_HomePage POPFile ¥Û¡¼¥à¥Ú¡¼¥¸¤ËÀܳ¤·¤Þ¤¹ Index: English.msg =================================================================== RCS file: /cvsroot/popfile/engine/languages/English.msg,v retrieving revision 1.111 retrieving revision 1.112 diff -C2 -d -r1.111 -r1.112 *** English.msg 9 Apr 2008 17:20:48 -0000 1.111 --- English.msg 13 Apr 2008 03:08:09 -0000 1.112 *************** *** 212,215 **** --- 212,217 ---- Users_Change_Password Change/Initialize User's Password Users_CopyFrom Copying settings from user + Users_CopyMagnets Copy user's magnets + Users_CopyCorpus Copy user's corpus (this may take a long time) Users_RemoveUser Remove user Users_CreateUser Create user named *************** *** 515,519 **** tip_Users_Change_Password Change user's password ! tip_Account_Remove Delete account from the user tip_Footer_HomePage Visit the POPFile home page --- 517,521 ---- tip_Users_Change_Password Change user's password ! tip_Accounts_Remove Delete account from the user tip_Footer_HomePage Visit the POPFile home page |
From: naoki i. <am...@us...> - 2008-04-13 03:08:04
|
Update of /cvsroot/popfile/engine/skins/default In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23448/skins/default Modified Files: password-page.thtml pop3-chain-panel.thtml users-page.thtml Log Message: Change Log 1. New options in cloning user UI/HTML.pm Classifier/Bayes.pm skins/default/users-page.thtml languages/English.msg languages/Nihongo.msg Following two options are added: 1. Copy user's magnets 2. Copy user's corpus If these options are choosed, the magnets or corpus data of the cloned user will be copied to the new user. 2. The language cache is now updated correctly UI/HTML.pm 3. Admin's language setting is copied to the global language setting in the single user mode UI/HTML.pm 4. A new module 'POPFile::Random' A new option 'GLOBAL_random_module' A new function 'random_()' POPFile/Random.pm POPFile/Configuration.pm POPFile/Module.pm Classifier/Bayes.pm UI/HTML.pm UI/HTTP.pm tests/TestConfiguration.tst The new module 'POPFile::Random' is used for generating random strings. The new option 'GLOBAL_random_module' is used for specifying which module to be used in the POPFile::Random module. The new function 'random_()' is used for accessing the POPFile::Random module. 5. jump_to_message now works even if the UI is protected with a password UI/HTML.pm 6. The log files cannot be accessed from non admin users UI/HTML.pm 7. The log files won't be cached by the web browsers UI/HTTP.pm 8. The password input box is automatically selected in the single user mode skins/default/password-page.thtml 9. Fixed some typos skins/default/pop3-chain-panel.thtml languages/English.msg languages/Nihongo.msg Current state of the test suite: TestBayesScript PASS TestBayes PASS TestConfiguration PASS * TestHistory PASS * TestHTML PASS * TestHTTP PASS TestIMAP fail TestInsertScript PASS * TestLogger PASS TestMailParse PASS TestModule PASS TestMQ PASS TestMutex PASS TestPipeScript PASS TestPOP3 PASS TestProxy PASS TestWordMangle PASS TestXMLRPC PASS (but child process does not terminate) * : needs to add tests for multi user support TODO 1. multi user mode tests are needed tests/TestConfiguration.tst tests/TestHistory.tst tests/TestHTML.tst tests/TestInsertScript.tst Index: users-page.thtml =================================================================== RCS file: /cvsroot/popfile/engine/skins/default/users-page.thtml,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** users-page.thtml 6 Apr 2008 08:27:08 -0000 1.11 --- users-page.thtml 13 Apr 2008 03:08:09 -0000 1.12 *************** *** 20,23 **** --- 20,34 ---- </TMPL_LOOP> </select> + <br /> + <input type="checkbox" name="users_copy_magnets" id="usersCopyMagnet" /> + <label class="usersLabel" for="usersCopyMagnet"> + <TMPL_VAR NAME="Localize_Users_CopyMagnets"> + </label> + <br /> + <input type="checkbox" name="users_copy_corpus" id="usersCopyCorpus" /> + <label class="usersLabel" for="usersCopyCorpus"> + <TMPL_VAR NAME="Localize_Users_CopyCorpus"> + </label> + <br /> <input type="submit" class="submit" name="create" value="<TMPL_VAR NAME="Localize_Create">" /> *************** *** 39,44 **** <input type="submit" class="submit" name="remove" onClick="return confirmClick('<TMPL_VAR NAME="Localize_tip_Users_Remove">')" value="<TMPL_VAR NAME="Localize_Remove">" /> </form> - </TMPL_IF> <br /> <TMPL_IF NAME="Users_If_Remove"> <hr /> --- 50,55 ---- <input type="submit" class="submit" name="remove" onClick="return confirmClick('<TMPL_VAR NAME="Localize_tip_Users_Remove">')" value="<TMPL_VAR NAME="Localize_Remove">" /> </form> <br /> + </TMPL_IF> <TMPL_IF NAME="Users_If_Remove"> <hr /> Index: password-page.thtml =================================================================== RCS file: /cvsroot/popfile/engine/skins/default/password-page.thtml,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** password-page.thtml 9 Apr 2008 17:20:48 -0000 1.12 --- password-page.thtml 13 Apr 2008 03:08:09 -0000 1.13 *************** *** 29,33 **** --- 29,37 ---- <!-- function OnLoadHandler() { // redefine default OnLoadHandler + <TMPL_IF NAME="Password_If_SingleUser"> + document.getElementById("thePassword").focus(); + <TMPL_ELSE> document.getElementById("theUsername").focus(); + </TMPL_IF> } //--> Index: pop3-chain-panel.thtml =================================================================== RCS file: /cvsroot/popfile/engine/skins/default/pop3-chain-panel.thtml,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** pop3-chain-panel.thtml 6 Apr 2008 08:27:08 -0000 1.9 --- pop3-chain-panel.thtml 13 Apr 2008 03:08:09 -0000 1.10 *************** *** 18,22 **** </label> ! <input type="checkbox" name="sssl" id="securitySecurePOP3SSL" value="UseSSL" <TMPL_IF NAME="POP3_Chain_Secure_SSL">checked</TMPL_IF>" /> <br /> --- 18,22 ---- </label> ! <input type="checkbox" name="sssl" id="securitySecurePOP3SSL" value="UseSSL" <TMPL_IF NAME="POP3_Chain_Secure_SSL">checked</TMPL_IF> /> <br /> |
From: naoki i. <am...@us...> - 2008-04-13 03:08:04
|
Update of /cvsroot/popfile/engine/Classifier In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23448/Classifier Modified Files: Bayes.pm Log Message: Change Log 1. New options in cloning user UI/HTML.pm Classifier/Bayes.pm skins/default/users-page.thtml languages/English.msg languages/Nihongo.msg Following two options are added: 1. Copy user's magnets 2. Copy user's corpus If these options are choosed, the magnets or corpus data of the cloned user will be copied to the new user. 2. The language cache is now updated correctly UI/HTML.pm 3. Admin's language setting is copied to the global language setting in the single user mode UI/HTML.pm 4. A new module 'POPFile::Random' A new option 'GLOBAL_random_module' A new function 'random_()' POPFile/Random.pm POPFile/Configuration.pm POPFile/Module.pm Classifier/Bayes.pm UI/HTML.pm UI/HTTP.pm tests/TestConfiguration.tst The new module 'POPFile::Random' is used for generating random strings. The new option 'GLOBAL_random_module' is used for specifying which module to be used in the POPFile::Random module. The new function 'random_()' is used for accessing the POPFile::Random module. 5. jump_to_message now works even if the UI is protected with a password UI/HTML.pm 6. The log files cannot be accessed from non admin users UI/HTML.pm 7. The log files won't be cached by the web browsers UI/HTTP.pm 8. The password input box is automatically selected in the single user mode skins/default/password-page.thtml 9. Fixed some typos skins/default/pop3-chain-panel.thtml languages/English.msg languages/Nihongo.msg Current state of the test suite: TestBayesScript PASS TestBayes PASS TestConfiguration PASS * TestHistory PASS * TestHTML PASS * TestHTTP PASS TestIMAP fail TestInsertScript PASS * TestLogger PASS TestMailParse PASS TestModule PASS TestMQ PASS TestMutex PASS TestPipeScript PASS TestPOP3 PASS TestProxy PASS TestWordMangle PASS TestXMLRPC PASS (but child process does not terminate) * : needs to add tests for multi user support TODO 1. multi user mode tests are needed tests/TestConfiguration.tst tests/TestHistory.tst tests/TestHTML.tst tests/TestInsertScript.tst Index: Bayes.pm =================================================================== RCS file: /cvsroot/popfile/engine/Classifier/Bayes.pm,v retrieving revision 1.364 retrieving revision 1.365 diff -C2 -d -r1.364 -r1.365 *** Bayes.pm 10 Apr 2008 11:20:55 -0000 1.364 --- Bayes.pm 13 Apr 2008 03:08:09 -0000 1.365 *************** *** 40,44 **** use Digest::SHA qw( sha256_hex ); use MIME::Base64; - use Crypt::Random qw( makerandom_octet ); # This is used to get the hostname of the current machine --- 40,43 ---- *************** *** 1544,1552 **** # get a random session key in hex ! $self->log_( 1, "Generating random octet" ); ! my $random = makerandom_octet( ! Length => 128, ! Strength => $self->global_config_( 'crypt_strength' ), ! Device => $self->global_config_( 'crypt_device' ), ); my $now = time; --- 1543,1554 ---- # get a random session key in hex ! my $module = $self->global_config_( 'random_module' ); ! $self->log_( 1, "Generating random octet using $module" ); ! ! my $random = $self->random_()->generate_random_string( ! $module, ! 128, ! $self->global_config_( 'crypt_strength' ), ! $self->global_config_( 'crypt_device' ) ); my $now = time; *************** *** 1868,1872 **** $self->{api_sessions__}{$user_session} = $user; $self->db_update_cache__( $user_session ); ! $self->log_( 1, "get_session_key_from_token returning key $user_session for user $self->{api_sessions__}{$user_session}" ); # Send the session to the parent so that it is recorded and can --- 1870,1874 ---- $self->{api_sessions__}{$user_session} = $user; $self->db_update_cache__( $user_session ); ! $self->log_( 1, "get_session_key_from_token returning key $user_session for user $user" ); # Send the session to the parent so that it is recorded and can *************** *** 3450,3453 **** --- 3452,3457 ---- # $new_user The name for the new user # $clone (optional) Name of user to clone + # $copy_magnets (optional) If 1 copy user's magnets + # $copy_corpus (optional) If 1 copy user's corpus (words in buckets) # # Returns 0 for success, 1 for user already exists, 2 for other error, *************** *** 3458,3462 **** sub create_user { ! my ( $self, $session, $new_user, $clone ) = @_; my $userid = $self->valid_session_key__( $session ); --- 3462,3466 ---- sub create_user { ! my ( $self, $session, $new_user, $clone, $copy_magnets, $copy_corpus ) = @_; my $userid = $self->valid_session_key__( $session ); *************** *** 3497,3502 **** return ( 3, undef ); } ! my $h = $self->db_()->prepare( "select utid, val from user_params where userid = $clid;" ); ! $h->execute; my %add; while ( my $row = $h->fetchrow_arrayref ) { --- 3501,3515 ---- return ( 3, undef ); } ! ! # Begin transaction ! ! $self->log_( 1, "Start cloning user..." ); ! $self->db_()->begin_work; ! ! # Clone user's parameters ! ! my $h = $self->db_()->prepare( "select utid, val from user_params where userid = ?;" ); ! $h->execute( $clid ); ! my %add; while ( my $row = $h->fetchrow_arrayref ) { *************** *** 3504,3515 **** } $h->finish; foreach my $utid (keys %add) { ! $self->db_()->do( "insert into user_params ( userid, utid, val ) values ( $id, $utid, '$add{$utid}' );" ); } ! # Clone buckets ! $h = $self->db_()->prepare( "select name, pseudo from buckets where userid = $clid;" ); ! $h->execute; my %buckets; while ( my $row = $h->fetchrow_arrayref ) { --- 3517,3532 ---- } $h->finish; + + $h = $self->db_()->prepare( "insert into user_params ( userid, utid, val ) + values ( ?, ?, ? );" ); foreach my $utid (keys %add) { ! $h->execute( $id, $utid, $add{$utid} ); } + $h->finish; ! # Clone buckets (optional) ! $h = $self->db_()->prepare( "select name, pseudo from buckets where userid = ?;" ); ! $h->execute( $clid ); my %buckets; while ( my $row = $h->fetchrow_arrayref ) { *************** *** 3517,3523 **** } $h->finish; foreach my $name (keys %buckets) { ! $self->db_()->do( "insert into buckets ( userid, name, pseudo ) values ( $id, '$name', $buckets{$name} );" ); } # Fetch new bucket ids and cloned bucket ids --- 3534,3544 ---- } $h->finish; + + $h = $self->db_()->prepare( "insert into buckets ( userid, name, pseudo ) + values ( ?, ?, ? );" ); foreach my $name (keys %buckets) { ! $h->execute( $id, $name, $buckets{$name} ); } + $h->finish; # Fetch new bucket ids and cloned bucket ids *************** *** 3525,3530 **** $h = $self->db_()->prepare( "select bucket1.id, bucket2.id from buckets as bucket1, buckets as bucket2 ! where bucket1.userid = $id and bucket1.name = bucket2.name and bucket2.userid = $clid;" ); ! $h->execute; my %new_buckets; while ( my $row = $h->fetchrow_arrayref ) { --- 3546,3552 ---- $h = $self->db_()->prepare( "select bucket1.id, bucket2.id from buckets as bucket1, buckets as bucket2 ! where bucket1.userid = $id and bucket1.name = bucket2.name and bucket2.userid = ?;" ); ! $h->execute( $clid ); ! my %new_buckets; while ( my $row = $h->fetchrow_arrayref ) { *************** *** 3537,3560 **** $h = $self->db_()->prepare( "select bucketid, btid, val from buckets, bucket_params ! where userid = $clid and buckets.id = bucket_params.bucketid;" ); ! $h->execute; my %bucket_params; ! while (my $row = $h->fetchrow_arrayref ) { $bucket_params{$new_buckets{$row->[0]}}{$row->[1]} = $row->[2]; } $h->finish; foreach my $bucketid ( keys %bucket_params ) { foreach my $btid ( keys %{$bucket_params{$bucketid}} ) { ! my $val = $self->db_()->quote( $bucket_params{$bucketid}{$btid} ); ! $self->db_()->do( ! "insert into bucket_params ( bucketid, btid, val ) ! values ( $bucketid, $btid, $val );" ); } } ! # TODO : Clone magnets ! # TODO : Clone corpus data (optional) } else { --- 3559,3635 ---- $h = $self->db_()->prepare( "select bucketid, btid, val from buckets, bucket_params ! where userid = ? and buckets.id = bucket_params.bucketid;" ); ! $h->execute( $clid ); ! my %bucket_params; ! while ( my $row = $h->fetchrow_arrayref ) { $bucket_params{$new_buckets{$row->[0]}}{$row->[1]} = $row->[2]; } $h->finish; + $h = $self->db_()->prepare( "insert into bucket_params ( bucketid, btid, val) + values ( ?, ?, ? );" ); foreach my $bucketid ( keys %bucket_params ) { foreach my $btid ( keys %{$bucket_params{$bucketid}} ) { ! my $val = $bucket_params{$bucketid}{$btid}; ! $h->execute( $bucketid, $btid, $val ); } } + $h->finish; ! # Clone magnets (optional) ! if ( $copy_magnets ) { ! $h = $self->db_()->prepare( ! "select magnets.bucketid, magnets.mtid, magnets.val from magnets, buckets ! where magnets.bucketid = buckets.id and buckets.userid = ?;" ); ! $h->execute( $clid ); ! ! my %magnets; ! while ( my $row = $h->fetchrow_arrayref ) { ! $magnets{$new_buckets{$row->[0]}}{$row->[1]} = $row->[2]; ! } ! $h->finish; ! ! $h = $self->db_()->prepare( "insert into magnets ( bucketid, mtid, val ) ! values ( ?, ?, ? );" ); ! foreach my $bucketid ( keys %magnets ) { ! foreach my $mtid ( keys %{$magnets{$bucketid}} ) { ! my $val = $magnets{$bucketid}{$mtid}; ! $h->execute( $bucketid, $mtid, $val ); ! } ! } ! $h->finish; ! } ! ! # Clone corpus data (optional) ! ! if ( $copy_corpus ) { ! $h = $self->db_()->prepare( ! "select matrix.bucketid, matrix.wordid, matrix.times from matrix, buckets ! where matrix.bucketid = buckets.id and buckets.userid = ?;" ); ! $h->execute( $clid ); ! ! my %matrix; ! while ( my $row = $h->fetchrow_arrayref ) { ! $matrix{$new_buckets{$row->[0]}}{$row->[1]} = $row->[2]; ! } ! $h->finish; ! ! $h = $self->db_()->prepare( "insert into matrix ( bucketid, wordid, times ) ! values ( ?, ?, ? );" ); ! foreach my $bucketid ( keys %matrix ) { ! foreach my $wordid ( keys %{$matrix{$bucketid}} ) { ! my $times = $matrix{$bucketid}{$wordid}; ! $h->execute( $bucketid, $wordid, $times ); ! } ! } ! $h->finish; ! } ! ! # Commit transaction ! ! $self->db_()->commit; ! $self->log_( 1, "Finish cloning user" ); } else { *************** *** 3889,3893 **** return undef if ( !defined( $userid ) ); ! my ( $val, $def )= $self->get_user_parameter_from_id( $userid,$parameter ); return $val; --- 3964,3968 ---- return undef if ( !defined( $userid ) ); ! my ( $val, $def )= $self->get_user_parameter_from_id( $userid, $parameter ); return $val; *************** *** 3941,3944 **** --- 4016,4022 ---- my ( $self, $session ) = @_; + # my ( $package, $filename, $line, $subroutine ) = caller; + # $self->log_( 1, "is_admin_session is called from $package @ $line to check the session key $session" ); + my $result = $self->get_user_parameter( $session, 'GLOBAL_can_admin' ); |
From: naoki i. <am...@us...> - 2008-04-13 03:08:04
|
Update of /cvsroot/popfile/engine/POPFile In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23448/POPFile Modified Files: Configuration.pm Module.pm Log Message: Change Log 1. New options in cloning user UI/HTML.pm Classifier/Bayes.pm skins/default/users-page.thtml languages/English.msg languages/Nihongo.msg Following two options are added: 1. Copy user's magnets 2. Copy user's corpus If these options are choosed, the magnets or corpus data of the cloned user will be copied to the new user. 2. The language cache is now updated correctly UI/HTML.pm 3. Admin's language setting is copied to the global language setting in the single user mode UI/HTML.pm 4. A new module 'POPFile::Random' A new option 'GLOBAL_random_module' A new function 'random_()' POPFile/Random.pm POPFile/Configuration.pm POPFile/Module.pm Classifier/Bayes.pm UI/HTML.pm UI/HTTP.pm tests/TestConfiguration.tst The new module 'POPFile::Random' is used for generating random strings. The new option 'GLOBAL_random_module' is used for specifying which module to be used in the POPFile::Random module. The new function 'random_()' is used for accessing the POPFile::Random module. 5. jump_to_message now works even if the UI is protected with a password UI/HTML.pm 6. The log files cannot be accessed from non admin users UI/HTML.pm 7. The log files won't be cached by the web browsers UI/HTTP.pm 8. The password input box is automatically selected in the single user mode skins/default/password-page.thtml 9. Fixed some typos skins/default/pop3-chain-panel.thtml languages/English.msg languages/Nihongo.msg Current state of the test suite: TestBayesScript PASS TestBayes PASS TestConfiguration PASS * TestHistory PASS * TestHTML PASS * TestHTTP PASS TestIMAP fail TestInsertScript PASS * TestLogger PASS TestMailParse PASS TestModule PASS TestMQ PASS TestMutex PASS TestPipeScript PASS TestPOP3 PASS TestProxy PASS TestWordMangle PASS TestXMLRPC PASS (but child process does not terminate) * : needs to add tests for multi user support TODO 1. multi user mode tests are needed tests/TestConfiguration.tst tests/TestHistory.tst tests/TestHTML.tst tests/TestInsertScript.tst Index: Configuration.pm =================================================================== RCS file: /cvsroot/popfile/engine/POPFile/Configuration.pm,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** Configuration.pm 9 Apr 2008 17:20:47 -0000 1.63 --- Configuration.pm 13 Apr 2008 03:08:09 -0000 1.64 *************** *** 125,131 **** $self->global_config_( 'single_user', 1 ); # The Strength value used in calls to Crypt::Random::makerandom_octet # The default is weak (0), but should work on all systems without ! # blocking POPFile. Set this to 1 if your syste provides enough # entropy and you need extra-random randomness. --- 125,136 ---- $self->global_config_( 'single_user', 1 ); + # The module to use to generate random string. + # This can be 'Crypt::OpenSSL::Random' (default) or 'Crypt::Random' + + $self->global_config_( 'random_module', 'Crypt::OpenSSL::Random' ); + # The Strength value used in calls to Crypt::Random::makerandom_octet # The default is weak (0), but should work on all systems without ! # blocking POPFile. Set this to 1 if your system provides enough # entropy and you need extra-random randomness. Index: Module.pm =================================================================== RCS file: /cvsroot/popfile/engine/POPFile/Module.pm,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** Module.pm 20 Feb 2006 02:01:57 -0000 1.53 --- Module.pm 13 Apr 2008 03:08:09 -0000 1.54 *************** *** 26,29 **** --- 26,30 ---- use strict; use IO::Select; + use POPFile::Random; # ---------------------------------------------------------------------------- *************** *** 949,952 **** --- 950,964 ---- } + sub random_ + { + my ( $self ) = @_; + + if ( !defined( $self->{random__} ) ) { + $self->{random__} = new POPFile::Random(); + } + + return $self->{random__}; + } + sub history_ { |
From: Manni H. <man...@us...> - 2008-04-11 08:42:58
|
Update of /cvsroot/popfile/engine/Classifier In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14894/Classifier Modified Files: Tag: db_handling_in_v1 Bayes.pm Log Message: Non-working version of Bayes, stripped of all the statement handles. Index: Bayes.pm =================================================================== RCS file: /cvsroot/popfile/engine/Classifier/Bayes.pm,v retrieving revision 1.327.4.16 retrieving revision 1.327.4.16.2.1 diff -C2 -d -r1.327.4.16 -r1.327.4.16.2.1 *** Bayes.pm 6 Mar 2008 08:52:46 -0000 1.327.4.16 --- Bayes.pm 11 Apr 2008 08:43:00 -0000 1.327.4.16.2.1 *************** *** 1,3 **** ! # POPFILE LOADABLE MODULE package Classifier::Bayes; --- 1,3 ---- ! # POPFILE LOADABLE MODULE 3 package Classifier::Bayes; *************** *** 38,43 **** use DBI; [...3310 lines suppressed...] *** 4071,4088 **** } - sub db - { - my ( $self ) = @_; - - return $self->{db__}; - } - - sub history - { - my ( $self, $history ) = @_; - - $self->{history__} = $history; - } - 1; --- 4728,4731 ---- |
From: Manni H. <man...@us...> - 2008-04-11 08:42:03
|
Update of /cvsroot/popfile/engine/POPFile In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14778/POPFile Added Files: Tag: db_handling_in_v1 Database.pm Log Message: Created a new CVS branch to work on the new database module. --- NEW FILE: Database.pm --- # POPFILE LOADABLE MODULE 2 package POPFile::Database; use POPFile::Module; @ISA = ("POPFile::Module"); #---------------------------------------------------------------------------- # # This module handles POPFile's database. It maintains all database # connections # # Copyright (c) 2001-2006 John Graham-Cumming # # This file is part of POPFile # # POPFile is free software; you can redistribute it and/or modify it # under the terms of version 2 of the GNU General Public License as # published by the Free Software Foundation. # # POPFile is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with POPFile; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # #---------------------------------------------------------------------------- use strict; use warnings; use locale; use DBI; use File::Copy; #---------------------------------------------------------------------------- # new # # Class new() function #---------------------------------------------------------------------------- sub new { my $proto = shift; my $class = ref($proto) || $proto; my $self = POPFile::Module->new(); # Database handle $self->{db__} = 0; bless($self, $class); $self->name( 'database' ); return $self; } #---------------------------------------------------------------------------- # # initialize # # Called to initialize the database # # --------------------------------------------------------------------------- sub initialize { my ( $self ) = @_; # This is the name for the database $self->config_( 'database', 'popfile.db' ); # This is the 'connect' string used by DBI to connect to the # database, if you decide to change from using SQLite to some # other database (e.g. MySQL, Oracle, ... ) this *should* be all # you need to change. The additional parameters user and auth are # needed for some databases. # # Note that the dbconnect string will be interpolated before being # passed to DBI and the variable $dbname can be used within it and # it resolves to the full path to the database named in the # database parameter above. $self->config_( 'dbconnect', 'dbi:SQLite2:dbname=$dbname' ); $self->config_( 'dbuser', '' ); $self->config_( 'dbauth', '' ); # SQLite 1.05+ have some problems we are resolving. This lets us # give a nice message and then disable the version checking later $self->config_( 'bad_sqlite_version', '3.0.0' ); # This is a bit mask used to control options when we are using the # default SQLite database. By default all the options are on. # # 1 = Asynchronous deletes # 2 = Backup database every hour $self->config_( 'sqlite_tweaks', 0xFFFFFFFF ); # Register for the TICKD message which is sent hourly by the # Logger module. We use this to hourly save the database if bit 1 # of the sqlite_tweaks is set and we are using SQLite $self->mq_register_( 'TICKD', $self ); return 1; } # --------------------------------------------------------------------------- # # deliver # # Called by the message queue to deliver a message # # There is no return value from this method # # --------------------------------------------------------------------------- sub deliver { my ( $self, $type, @message ) = @_; if ( $type eq 'TICKD' ) { $self->backup_database__(); } } #---------------------------------------------------------------------------- # # start # # Called to start access to the database # #---------------------------------------------------------------------------- sub start { my ( $self ) = @_; if ( !$self->db_connect__() ) { return 0; } return 1; } #---------------------------------------------------------------------------- # # stop # # Called to terminate access to the database # #---------------------------------------------------------------------------- sub stop { my ( $self ) = @_; $self->db_disconnect__(); $self->SUPER::stop(); } #---------------------------------------------------------------------------- # # backup_database__ # # Called when the TICKD message is received each hour and if we are using # the default SQLite database will make a copy with the .backup extension # #---------------------------------------------------------------------------- sub backup_database__ { my ( $self ) = @_; # If database backup is turned on and we are using SQLite then # backup the database by copying it if ( ( $self->config_( 'sqlite_tweaks' ) & 2 ) && $self->{db_is_sqlite__} ) { if ( !copy( $self->{db_name__}, $self->{db_name__} . ".backup" ) ) { $self->log_( 0, "Failed to backup database ".$self->{db_name__} ); } } } #---------------------------------------------------------------------------- # # tweak_sqlite # # Called when a module wants is to tweak access to the SQLite database. # # $tweak The tweak to apply (a bit in the sqlite_tweaks mask) # $state 1 to enable the tweak, 0 to disable # $db The db handle to tweak # #---------------------------------------------------------------------------- sub tweak_sqlite { my ( $self, $tweak, $state, $db ) = @_; if ( $self->{db_is_sqlite__} && ( $self->config_( 'sqlite_tweaks' ) & $tweak ) ) { $self->log_( 1, "Performing tweak $tweak to $state" ); if ( $tweak == 1 ) { my $sync = $state?'off':'normal'; $db->do( "pragma synchronous=$sync;" ); } } } #---------------------------------------------------------------------------- # # db_disconnect__ # # Disconnects from the POPFile database # #---------------------------------------------------------------------------- sub db_disconnect__ { my ( $self ) = @_; if ( defined( $self->{db__} ) ) { $self->{db__}->disconnect; undef $self->{db__}; } } #---------------------------------------------------------------------------- # # db_connect__ # # Connects to the POPFile database and returns 1 if successful # #---------------------------------------------------------------------------- sub db_connect__ { my ( $self ) = @_; $self->{db__} = $self->db_connect_helper__(1); return defined( $self->{db__} ); } #---------------------------------------------------------------------------- # # db_connect_helper__ # # Connects to the POPFile database and returns the handle # # $upgrade 1 if it's ok to upgrade the database # #---------------------------------------------------------------------------- sub db_connect_helper__ { my ( $self, $upgrade ) = @_; # Connect to the database, note that the database must exist for # this to work, to make this easy for people POPFile we will # create the database automatically here using the file # 'popfile.sql' which should be located in the same directory the # Classifier/Bayes.pm module # If we are using SQLite then the dbname is actually the name of a # file, and hence we treat it like one, otherwise we leave it # alone my $dbname; my $dbconnect = $self->config_( 'dbconnect' ); my $dbpresent; my $sqlite = ( $dbconnect =~ /sqlite/i ); if ( $sqlite ) { $dbname = $self->get_user_path_( $self->config_( 'database' ) ); $dbpresent = ( -e $dbname ) || 0; } else { $dbname = $self->config_( 'database' ); $dbpresent = 1; } # Record whether we are using SQLite or not and the name of the # database so that other routines can access it; this is used by # the backup_database__ routine to make a backup copy of the # database when using SQLite. $self->{db_is_sqlite__} = $sqlite; $self->{db_name__} = $dbname; # Now perform the connect, note that this is database independent # at this point, the actual database that we connect to is defined # by the dbconnect parameter. $dbconnect =~ s/\$dbname/$dbname/g; $self->log_( 0, "Attempting to connect to $dbconnect ($dbpresent)" ); my $db = DBI->connect( $dbconnect, # PROFILE BLOCK START $self->config_( 'dbuser' ), $self->config_( 'dbauth' ) ); # PROFILE BLOCK STOP $self->log_( 0, "Using SQLite library version " . $db->{sqlite_version}); # We check to make sure we're not using DBD::SQLite 1.05 or greater # which uses SQLite V 3 If so, we'll use DBD::SQLite2 and SQLite 2.8, # which is still compatible with old databases if ( $db->{sqlite_version} gt $self->config_('bad_sqlite_version' ) ) { $self->log_( 0, "Substituting DBD::SQLite2 for DBD::SQLite 1.05" ); $self->log_( 0, "Please install DBD::SQLite2 and set dbconnect to use DBD::SQLite2" ); $dbconnect =~ s/SQLite:/SQLite2:/; $db = DBI->connect( $dbconnect, # PROFILE BLOCK START $self->config_( 'dbuser' ), $self->config_( 'dbauth' ) ); # PROFILE BLOCK STOP } if ( !defined( $db ) ) { $self->log_( 0, "Failed to connect to database and got error $DBI::errstr" ); return undef } if ( !$dbpresent ) { if ( !$self->insert_schema__( $db, $sqlite ) ) { return undef; } } if ( $upgrade ) { # Now check for a need to upgrade the database because the schema # has been changed. From POPFile v0.22.0 there's a special # 'popfile' table inside the database that contains the schema # version number. If the version number doesn't match or is # missing then do the upgrade. open SCHEMA, '<' . $self->get_root_path_( 'Classifier/popfile.sql' ); <SCHEMA> =~ /-- POPFILE SCHEMA (\d+)/; my $version = $1; close SCHEMA; my $need_upgrade = 1; # retrieve the SQL_IDENTIFIER_QUOTE_CHAR for the database then use it # to strip off any sqlquotechars from the table names we retrieve my $sqlquotechar = $db->get_info(29) || ''; my @tables = map { s/$sqlquotechar//g; $_ } ($db->tables()); foreach my $table (@tables) { if ( $table eq 'popfile' ) { my @row = $db->selectrow_array( 'select version from popfile;' ); if ( $#row == 0 ) { $need_upgrade = ( $row[0] != $version ); } } } if ( $need_upgrade ) { print "\n\nDatabase schema is outdated, performing automatic upgrade\n"; # The database needs upgrading, so we are going to dump # out all the data in the database as INSERT OR IGNORE # statements in a temporary file, then DROP all the tables # in the database, then recreate the schema from the new # schema and finally rerun the inserts. my $i = 0; my $ins_file = $self->get_user_path_( 'insert.sql' ); open INSERT, '>' . $ins_file; foreach my $table (@tables) { next if ( $table eq 'popfile' ); if ( $sqlite && ( $table =~ /^sqlite_/ ) ) { next; } if ( $i > 99 ) { print "\n"; } print " Saving table $table\n "; my $t = $db->prepare( "select * from $table;" ); $t->execute; $i = 0; while ( 1 ) { if ( ( ++$i % 100 ) == 0 ) { print "[$i]"; flush STDOUT; } if ( ( $i % 1000 ) == 0 ) { print "\n"; flush STDOUT; } my @rows = $t->fetchrow_array; last if ( $#rows == -1 ); print INSERT "INSERT OR IGNORE INTO $table ("; for my $i (0..$t->{NUM_OF_FIELDS}-1) { if ( $i != 0 ) { print INSERT ','; } print INSERT $t->{NAME}->[$i]; } print INSERT ') VALUES ('; for my $i (0..$t->{NUM_OF_FIELDS}-1) { if ( $i != 0 ) { print INSERT ','; } my $val = $rows[$i]; if ( $t->{TYPE}->[$i] !~ /^int/i ) { $val = '' if ( !defined( $val ) ); $val = $db->quote( $val ); } else { $val = 'NULL' if ( !defined( $val ) ); } print INSERT $val; } print INSERT ");\n"; } } close INSERT; if ( $i > 99 ) { print "\n"; } foreach my $table (@tables) { if ( $sqlite && ( $table =~ /^sqlite_/ ) ) { next; } print " Dropping old table $table\n"; $db->do( "DROP TABLE $table;" ); } print " Inserting new database schema\n"; if ( !$self->insert_schema__( $db, $sqlite ) ) { return undef; } print " Restoring old data\n "; $db->begin_work; open INSERT, '<' . $ins_file; $i = 0; while ( <INSERT> ) { if ( ( ++$i % 100 ) == 0 ) { print "[$i]"; flush STDOUT; } if ( ( $i % 1000 ) == 0 ) { print "\n"; flush STDOUT; } s/[\r\n]//g; $db->do( $_ ); } close INSERT; $db->commit; # Now write the current version to the database $db->do( "INSERT OR REPLACE into popfile ( version ) values ( $version ); " ); unlink $ins_file; print "\nDatabase upgrade complete\n\n"; } } return $db; } #---------------------------------------------------------------------------- # # insert_schema__ # # Insert the POPFile schema in a database # # $db Database handle # $sqlite Set to 1 if this is a SQLite database # #---------------------------------------------------------------------------- sub insert_schema__ { my ( $self, $db, $sqlite ) = @_; if ( -e $self->get_root_path_( 'Classifier/popfile.sql' ) ) { my $schema = ''; $self->log_( 0, "Creating database schema" ); open SCHEMA, '<' . $self->get_root_path_( 'Classifier/popfile.sql' ); while ( <SCHEMA> ) { next if ( /^--/ ); next if ( !/[a-z;]/ ); s/--.*$//; # If the line begins 'alter' and we are doing SQLite then ignore # the line if ( $sqlite && ( /^alter/i ) ) { next; } $schema .= $_; if ( ( /end;/ ) || ( /\);/ ) || ( /^alter/i ) ) { $db->do( $schema ); $schema = ''; } } close SCHEMA; return 1; } else { $self->log_( 0, "Can't find the database schema" ); return 0; } } #---------------------------------------------------------------------------- # # forked # # This is called inside a child process that has just forked, since # the child needs access to the database we open it # #---------------------------------------------------------------------------- sub forked { my ( $self, $writer ) = @_; $self->SUPER::forked( $writer ); $self->db_connect__(); } # GETTER sub db { my ( $self ) = @_; return $self->db_connect_helper__(0); } 1; |
From: Manni H. <man...@us...> - 2008-04-10 15:17:41
|
Update of /cvsroot/popfile/engine/Services In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2153/Services Modified Files: IMAP.pm Log Message: 1. Make the IMAP module aware of multi-user mode. - Get an administrator session key in service() - get a list of users in the DB - Keep track of the user-id that the module is currently working with. TODO: - Add a per-user configuration variable that let's users en/disable the use of IMAP. - Check this variable in service(). 2. Update the IMAP tests in the test suite. - Get an administrato session key - Correctly call History::get_slot_fields(). => The tests now run without errors TODO: Make this work in multi-user mode. Index: IMAP.pm =================================================================== RCS file: /cvsroot/popfile/engine/Services/IMAP.pm,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** IMAP.pm 5 Apr 2008 11:02:20 -0000 1.35 --- IMAP.pm 10 Apr 2008 15:17:35 -0000 1.36 *************** *** 210,263 **** my $self = shift; ! if ( time - $self->{last_update__} >= $self->user_config_( 1, 'update_interval' ) ) { ! # Since the IMAP-Client module can throw an exception, i.e. die if ! # it detects a lost connection, we eval the following code to be able ! # to catch the exception. We also tell Perl to ignore broken pipes. ! eval { ! local $SIG{'PIPE'} = 'IGNORE'; ! local $SIG{'__DIE__'}; ! if ( $self->user_config_( 1, 'training_mode' ) == 1 ) { ! $self->train_on_archive__(); ! } ! else { ! # If we haven't yet set up a list of serviced folders, ! # or if the list was changed by the user, build up a ! # list of folder in $self->{folders__} ! if ( ( keys %{$self->{folders__}} == 0 ) || ( $self->{folder_change_flag__} == 1 ) ) { ! $self->build_folder_list__(); ! } ! $self->connect_server__(); ! # Reset the hash containing the hash values we have seen the ! # last time through service. ! $self->{hash_values__} = (); ! # Now do the real job ! foreach my $folder ( keys %{$self->{folders__}} ) { ! $self->scan_folder( $folder ) if exists $self->{folders__}{$folder}{imap}; ! } ! } ! }; ! # if an exception occurred, we try to catch it here ! if ( $@ ) { ! $self->disconnect_folders__(); ! # If we caught an exception, we better reset training_mode ! $self->user_config_( 1, 'training_mode', 0 ); ! # say__() and get_response__() will die with this message: ! if ( $@ =~ /^POPFILE-IMAP-EXCEPTION: (.+\)\))/ ) { ! $self->log_( 0, $1 ); ! } ! # If we didn't die but somebody else did, we have empathy. ! else { ! die $@; ! } ! } ! # Save the current time. ! $self->{last_update__} = time; } --- 210,274 ---- my $self = shift; ! # We have to get a session key first, then loop over all users that ! # wish to use our services. ! my $sessionKey = $self->classifier_()->get_administrator_session_key(); ! my $users = $self->classifier_()->get_user_list( $sessionKey ); ! foreach my $userId ( keys %{$users} ) { ! $self->log_( 1, "Checking user $users->{$userId} for IMAP settings." ); ! $self->user_id( $userId ); ! if ( time - $self->{last_update__} >= $self->user_config_( $userId, 'update_interval' ) ) { ! # Since the IMAP-Client module can throw an exception, i.e. die if ! # it detects a lost connection, we eval the following code to be able ! # to catch the exception. We also tell Perl to ignore broken pipes. ! eval { ! local $SIG{'PIPE'} = 'IGNORE'; ! local $SIG{'__DIE__'}; ! if ( $self->user_config_( $userId, 'training_mode' ) == 1 ) { ! $self->train_on_archive__(); ! } ! else { ! # If we haven't yet set up a list of serviced folders, ! # or if the list was changed by the user, build up a ! # list of folder in $self->{folders__} ! if ( ( keys %{$self->{folders__}} == 0 ) || ( $self->{folder_change_flag__} == 1 ) ) { ! $self->build_folder_list__(); ! } ! $self->connect_server__(); ! ! # Reset the hash containing the hash values we have seen the ! # last time through service. ! $self->{hash_values__} = (); ! ! # Now do the real job ! foreach my $folder ( keys %{$self->{folders__}} ) { ! $self->scan_folder( $folder ) if exists $self->{folders__}{$folder}{imap}; ! } ! } ! }; ! # if an exception occurred, we try to catch it here ! if ( $@ ) { ! $self->disconnect_folders__(); ! # If we caught an exception, we better reset training_mode ! $self->user_config_( $userId, 'training_mode', 0 ); ! ! # say__() and get_response__() will die with this message: ! if ( $@ =~ /^POPFILE-IMAP-EXCEPTION: (.+\)\))/ ) { ! $self->log_( 0, $1 ); ! } ! # If we didn't die but somebody else did, we have empathy. ! else { ! die $@; ! } ! } ! # Save the current time. ! $self->{last_update__} = time; ! } } *************** *** 559,563 **** # After we are done with the folder, we issue an EXPUNGE command # if we were told to do so. ! if ( $moved_message && $self->user_config_( 1, 'expunge' ) ) { $imap->expunge(); } --- 570,574 ---- # After we are done with the folder, we issue an EXPUNGE command # if we were told to do so. ! if ( $moved_message && $self->user_config_( $self->user_id(), 'expunge' ) ) { $imap->expunge(); } *************** *** 775,779 **** my $folder = shift; ! my $all = $self->user_config_( 1, 'bucket_folder_mappings' ); my %mapping = split /$cfg_separator/, $all; --- 786,790 ---- my $folder = shift; ! my $all = $self->user_config_( $self->user_id(), 'bucket_folder_mappings' ); my %mapping = split /$cfg_separator/, $all; *************** *** 786,790 **** $all .= "$k$cfg_separator$v$cfg_separator"; } ! $self->user_config_( 1, 'bucket_folder_mappings', $all ); } # get --- 797,801 ---- $all .= "$k$cfg_separator$v$cfg_separator"; } ! $self->user_config_( $self->user_id(), 'bucket_folder_mappings', $all ); } # get *************** *** 813,817 **** my @folders = @_; ! my $all = $self->user_config_( 1, 'watched_folders' ); # set --- 824,828 ---- my @folders = @_; ! my $all = $self->user_config_( $self->user_id(), 'watched_folders' ); # set *************** *** 821,825 **** $all .= "$_$cfg_separator"; } ! $self->user_config_( 1, 'watched_folders', $all ); } # get --- 832,836 ---- $all .= "$_$cfg_separator"; } ! $self->user_config_( $self->user_id(), 'watched_folders', $all ); } # get *************** *** 841,844 **** --- 852,857 ---- if ( ! $self->{api_session__} ) { + # TODO: Where the hell should I get a session from?? + # my $user = $self->classifier_()->valid_session_key__( $session ); $self->{api_session__} = $self->classifier_()->get_session_key( 'admin', '' ); } *************** *** 847,850 **** --- 860,879 ---- } + #---------------------------------------------------------------------------- + # + # user_id + # + # Get or set the id of the user that we are currently working for. + #---------------------------------------------------------------------------- + + sub user_id { + my $self = shift; + + if ( @_ ) { + $self->{ current_userid } = shift; + } + + return $self->{ current_userid }; + } #---------------------------------------------------------------------------- *************** *** 1032,1042 **** my $language = shift; # conection details if ( $name eq 'imap_0_connection_details' ) { ! $templ->param( 'IMAP_hostname', $self->user_config_( 1, 'hostname' ) ); ! $templ->param( 'IMAP_port', $self->user_config_( 1, 'port' ) ); ! $templ->param( 'IMAP_login', $self->user_config_( 1, 'login' ) ); ! $templ->param( 'IMAP_password', $self->user_config_( 1, 'password' ) ); ! $templ->param( 'IMAP_ssl_checked', $self->user_config_( 1, 'use_ssl' ) ? 'checked="checked"' : '' ); } --- 1061,1074 ---- my $language = shift; + my $userId = $self->user_id(); + # conection details if ( $name eq 'imap_0_connection_details' ) { ! ! $templ->param( 'IMAP_hostname', $self->user_config_( $userId, 'hostname' ) ); ! $templ->param( 'IMAP_port', $self->user_config_( $userId, 'port' ) ); ! $templ->param( 'IMAP_login', $self->user_config_( $userId, 'login' ) ); ! $templ->param( 'IMAP_password', $self->user_config_( $userId, 'password' ) ); ! $templ->param( 'IMAP_ssl_checked', $self->user_config_( $userId, 'use_ssl' ) ? 'checked="checked"' : '' ); } *************** *** 1158,1162 **** # Read the list of mailboxes from the server. Now! if ( $name eq 'imap_4_update_mailbox_list' ) { ! if ( $self->user_config_( 1, 'hostname' ) eq '' ) { $templ->param( IMAP_if_connection_configured => 0 ); } --- 1190,1194 ---- # Read the list of mailboxes from the server. Now! if ( $name eq 'imap_4_update_mailbox_list' ) { ! if ( $self->user_config_( $userId, 'hostname' ) eq '' ) { $templ->param( IMAP_if_connection_configured => 0 ); } *************** *** 1170,1183 **** # Are we expunging after moving messages? ! my $checked = $self->user_config_( 1, 'expunge' ) ? 'checked="checked"' : ''; $templ->param( IMAP_expunge_is_checked => $checked ); # Update interval in seconds ! $templ->param( IMAP_interval => $self->user_config_( 1, 'update_interval' ) ); } # Switch the module to training mode if ( $name eq 'imap_6_training' ) { ! $templ->param( imap_currently_training => $self->user_config_( 1, 'training_mode' ) ); } } --- 1202,1215 ---- # Are we expunging after moving messages? ! my $checked = $self->user_config_( $userId, 'expunge' ) ? 'checked="checked"' : ''; $templ->param( IMAP_expunge_is_checked => $checked ); # Update interval in seconds ! $templ->param( IMAP_interval => $self->user_config_( $userId, 'update_interval' ) ); } # Switch the module to training mode if ( $name eq 'imap_6_training' ) { ! $templ->param( imap_currently_training => $self->user_config_( $userId, 'training_mode' ) ); } } *************** *** 1223,1227 **** if ( $name eq 'imap_6_training' ) { if ( defined $form->{do_imap_training} ) { ! $self->user_config_( 1, 'training_mode', 1 ); return ( $language->{Imap_DoingTraining}, undef ); } --- 1255,1259 ---- if ( $name eq 'imap_6_training' ) { if ( defined $form->{do_imap_training} ) { ! $self->user_config_( $self->user_id(), 'training_mode', 1 ); return ( $language->{Imap_DoingTraining}, undef ); } *************** *** 1240,1249 **** my ( $status_message, $error_message ); if ( defined $form->{update_imap_0_connection_details} ) { my $something_happened = 0; if ( $form->{imap_hostname} && $form->{imap_hostname} =~ /^\S+/ ) { ! if ( $self->user_config_( 1, 'hostname' ) ne $form->{imap_hostname} ) { ! $self->user_config_( 1, 'hostname', $form->{imap_hostname} ); $something_happened++; } --- 1272,1283 ---- my ( $status_message, $error_message ); + my $userId = $self->user_id(); + if ( defined $form->{update_imap_0_connection_details} ) { my $something_happened = 0; if ( $form->{imap_hostname} && $form->{imap_hostname} =~ /^\S+/ ) { ! if ( $self->user_config_( $userId, 'hostname' ) ne $form->{imap_hostname} ) { ! $self->user_config_( $userId, 'hostname', $form->{imap_hostname} ); $something_happened++; } *************** *** 1254,1259 **** if ( $form->{imap_port} && $form->{imap_port} =~ m/^\d+$/ && $form->{imap_port} >= 1 && $form->{imap_port} < 65536 ) { ! if ( $self->user_config_( 1, 'port' ) != $form->{imap_port} ) { ! $self->user_config_( 1, 'port', $form->{imap_port} ); $something_happened++; } --- 1288,1293 ---- if ( $form->{imap_port} && $form->{imap_port} =~ m/^\d+$/ && $form->{imap_port} >= 1 && $form->{imap_port} < 65536 ) { ! if ( $self->user_config_( $userId, 'port' ) != $form->{imap_port} ) { ! $self->user_config_( $userId, 'port', $form->{imap_port} ); $something_happened++; } *************** *** 1264,1269 **** if ( defined $form->{imap_login} && $form->{imap_login} =~ /^\S/ ) { ! if ( $self->user_config_( 1, 'login' ) ne $form->{imap_login} ) { ! $self->user_config_( 1, 'login', $form->{imap_login} ); $something_happened++; } --- 1298,1303 ---- if ( defined $form->{imap_login} && $form->{imap_login} =~ /^\S/ ) { ! if ( $self->user_config_( $userId, 'login' ) ne $form->{imap_login} ) { ! $self->user_config_( $userId, 'login', $form->{imap_login} ); $something_happened++; } *************** *** 1274,1279 **** if ( defined $form->{imap_password} && $form->{imap_password} =~ /^\S/ ) { ! if ( $self->user_config_( 1, 'password' ) ne $form->{imap_password} ) { ! $self->user_config_( 1, 'password', $form->{imap_password} ); $something_happened++; } --- 1308,1313 ---- if ( defined $form->{imap_password} && $form->{imap_password} =~ /^\S/ ) { ! if ( $self->user_config_( $userId, 'password' ) ne $form->{imap_password} ) { ! $self->user_config_( $userId, 'password', $form->{imap_password} ); $something_happened++; } *************** *** 1283,1289 **** } ! my $use_ssl_now = $self->user_config_( 1, 'use_ssl' ); if ( $form->{imap_use_ssl} ) { ! $self->user_config_( 1, 'use_ssl', 1 ); if ( ! $use_ssl_now ) { $something_happened = 1; --- 1317,1323 ---- } ! my $use_ssl_now = $self->user_config_( $userId, 'use_ssl' ); if ( $form->{imap_use_ssl} ) { ! $self->user_config_( $userId, 'use_ssl', 1 ); if ( ! $use_ssl_now ) { $something_happened = 1; *************** *** 1291,1295 **** } else { ! $self->user_config_( 1, 'use_ssl', 0 ); if ( $use_ssl_now ) { $something_happened = 1; --- 1325,1329 ---- } else { ! $self->user_config_( $userId, 'use_ssl', 0 ); if ( $use_ssl_now ) { $something_happened = 1; *************** *** 1405,1414 **** my ( $status_message, $error_message ); if ( defined $form->{do_imap_4_update_mailbox_list} ) { ! if ( $self->user_config_( 1, 'hostname' ) ! && $self->user_config_( 1, 'login' ) ! && $self->user_config_( 1, 'login' ) ! && $self->user_config_( 1, 'port' ) ! && $self->user_config_( 1, 'password' ) ) { my $imap = $self->new_imap_client(); --- 1439,1450 ---- my ( $status_message, $error_message ); + my $userId = $self->user_id(); + if ( defined $form->{do_imap_4_update_mailbox_list} ) { ! if ( $self->user_config_( $userId, 'hostname' ) ! && $self->user_config_( $userId, 'login' ) ! && $self->user_config_( $userId, 'login' ) ! && $self->user_config_( $userId, 'port' ) ! && $self->user_config_( $userId, 'password' ) ) { my $imap = $self->new_imap_client(); *************** *** 1445,1455 **** if ( defined $form->{update_imap_5_options} ) { # expunge or not? if ( defined $form->{imap_options_expunge} ) { ! $self->user_config_( 1, 'expunge', 1 ); } else { ! $self->user_config_( 1, 'expunge', 0 ); } --- 1481,1492 ---- if ( defined $form->{update_imap_5_options} ) { + my $userId = $self->user_id(); # expunge or not? if ( defined $form->{imap_options_expunge} ) { ! $self->user_config_( $userId, 'expunge', 1 ); } else { ! $self->user_config_( $userId, 'expunge', 0 ); } *************** *** 1457,1461 **** my $form_interval = $form->{imap_options_update_interval}; if ( $form_interval =~ /^\d+$/ && $form_interval >= 10 && $form_interval <= 60*60 ) { ! $self->user_config_( 1, 'update_interval', $form_interval ); } else { --- 1494,1498 ---- my $form_interval = $form->{imap_options_update_interval}; if ( $form_interval =~ /^\d+$/ && $form_interval >= 10 && $form_interval <= 60*60 ) { ! $self->user_config_( $userId, 'update_interval', $form_interval ); } else { *************** *** 1546,1550 **** # And disable training mode so we won't do this again the next time service is called. ! $self->user_config_( 1, 'training_mode', 0 ); } --- 1583,1587 ---- # And disable training mode so we won't do this again the next time service is called. ! $self->user_config_( $self->user_id(), 'training_mode', 0 ); } *************** *** 1568,1572 **** my $imap = Services::IMAP::Client->new( ! sub { $self->user_config_( 1, @_ ) }, $self->get_module__( 'logger', 'POPFile::Logger' ), sub { $self->global_config_( @_ ) }, --- 1605,1609 ---- my $imap = Services::IMAP::Client->new( ! sub { $self->user_config_( $self->user_id(), @_ ) }, $self->get_module__( 'logger', 'POPFile::Logger' ), sub { $self->global_config_( @_ ) }, |
From: Manni H. <man...@us...> - 2008-04-10 15:17:35
|
Update of /cvsroot/popfile/engine/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2153/tests Modified Files: TestIMAP.tst Log Message: 1. Make the IMAP module aware of multi-user mode. - Get an administrator session key in service() - get a list of users in the DB - Keep track of the user-id that the module is currently working with. TODO: - Add a per-user configuration variable that let's users en/disable the use of IMAP. - Check this variable in service(). 2. Update the IMAP tests in the test suite. - Get an administrato session key - Correctly call History::get_slot_fields(). => The tests now run without errors TODO: Make this work in multi-user mode. Index: TestIMAP.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestIMAP.tst,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** TestIMAP.tst 10 Apr 2008 11:18:39 -0000 1.12 --- TestIMAP.tst 10 Apr 2008 15:17:35 -0000 1.13 *************** *** 56,60 **** # First, start POPFile. my ( $c, $mq, $l, $b, $h, $im ) = start_popfile(); - my $session = $b->get_session_key( 'admin', '' ); # Configure the IMAP module so it will --- 56,59 ---- *************** *** 82,86 **** my ( $im, $c, $mq, $l, $b, $h ) = @_; ! my $session = $b->get_session_key( 'admin', '' ); test_assert( $im->start() ); --- 81,85 ---- my ( $im, $c, $mq, $l, $b, $h ) = @_; ! my $session = $b->get_administrator_session_key(); test_assert( $im->start() ); *************** *** 144,148 **** # The module should not allow reclassification to the same # bucket. ! my $hash = ( $h->get_slot_fields( 1 ) )[6]; test_assert( ! $im->can_reclassify__( $hash, 'spam' ) ); # If the hash is unknown, it should reclassify either --- 143,147 ---- # The module should not allow reclassification to the same # bucket. ! my $hash = ( $h->get_slot_fields( 1, $session ) )[6]; test_assert( ! $im->can_reclassify__( $hash, 'spam' ) ); # If the hash is unknown, it should reclassify either *************** *** 171,194 **** # check classification stored in history ! test_assert_equal( ($h->get_slot_fields( 1 ))[8], 'personal' ); ! test_assert_equal( ($h->get_slot_fields( 2 ))[8], 'personal' ); ! test_assert_equal( ($h->get_slot_fields( 3 ))[8], 'personal' ); ! test_assert_equal( ($h->get_slot_fields( 4 ))[8], 'other' ); ! test_assert_equal( ($h->get_slot_fields( 5 ))[8], 'other' ); # check that history knows that the msgs were reclassfified ! test_assert_equal( ($h->get_slot_fields( 1 ))[9], 4 ); ! test_assert_equal( ($h->get_slot_fields( 2 ))[9], 4 ); ! test_assert_equal( ($h->get_slot_fields( 3 ))[9], 4 ); ! test_assert_equal( ($h->get_slot_fields( 4 ))[9], 4 ); ! test_assert_equal( ($h->get_slot_fields( 5 ))[9], 4 ); # history should also know about the used manget ! test_assert_equal( ($h->get_slot_fields( 6 ))[11], 'cxc...@ya...' ); # get the msgs hashes and ask the imap module whether those messages # can be reclassified. It should say 'no!' foreach ( 1 .. 6 ) { ! $hash = ($h->get_slot_fields( $_ ))[6]; test_assert_equal( $im->can_reclassify__( $hash, 'spam' ), undef ); test_assert( ! $im->can_classify__( $hash ) ); --- 170,193 ---- # check classification stored in history ! test_assert_equal( ($h->get_slot_fields( 1, $session ))[8], 'personal' ); ! test_assert_equal( ($h->get_slot_fields( 2, $session ))[8], 'personal' ); ! test_assert_equal( ($h->get_slot_fields( 3, $session ))[8], 'personal' ); ! test_assert_equal( ($h->get_slot_fields( 4, $session ))[8], 'other' ); ! test_assert_equal( ($h->get_slot_fields( 5, $session ))[8], 'other' ); # check that history knows that the msgs were reclassfified ! test_assert_equal( ($h->get_slot_fields( 1, $session ))[9], 4 ); ! test_assert_equal( ($h->get_slot_fields( 2, $session ))[9], 4 ); ! test_assert_equal( ($h->get_slot_fields( 3, $session ))[9], 4 ); ! test_assert_equal( ($h->get_slot_fields( 4, $session ))[9], 4 ); ! test_assert_equal( ($h->get_slot_fields( 5, $session ))[9], 4 ); # history should also know about the used manget ! test_assert_equal( ($h->get_slot_fields( 6, $session ))[11], 'cxc...@ya...' ); # get the msgs hashes and ask the imap module whether those messages # can be reclassified. It should say 'no!' foreach ( 1 .. 6 ) { ! $hash = ($h->get_slot_fields( $_, $session ))[6]; test_assert_equal( $im->can_reclassify__( $hash, 'spam' ), undef ); test_assert( ! $im->can_classify__( $hash ) ); *************** *** 431,438 **** # Now let the IMAP module populate the template ! $im->user_config_( 1, hostname => 'some host' ); ! $im->user_config_( 1, port => 1234 ); ! $im->user_config_( 1, password => 'some password' ); ! $im->user_config_( 1, login => 'some login' ); $im->configure_item( 'imap_0_connection_details', $tmpl, $language ); --- 430,437 ---- # Now let the IMAP module populate the template ! $im->user_config_( 1, hostname => 'some host' ); ! $im->user_config_( 1, port => 1234 ); ! $im->user_config_( 1, password => 'some password' ); ! $im->user_config_( 1, login => 'some login' ); $im->configure_item( 'imap_0_connection_details', $tmpl, $language ); *************** *** 457,461 **** # We set both, the mailboxes__ arrayref and the list of watched folders, to be empty $im->{mailboxes__} = []; ! $im->user_config_( 1, 'watched_folders', '' ); $im->configure_item( 'imap_1_watch_folders', $tmpl, $language ); test_assert( ! $tmpl->param( 'IMAP_if_mailboxes' ) ); --- 456,460 ---- # We set both, the mailboxes__ arrayref and the list of watched folders, to be empty $im->{mailboxes__} = []; ! $im->user_config_( 1, 'watched_folders', '' ); $im->configure_item( 'imap_1_watch_folders', $tmpl, $language ); test_assert( ! $tmpl->param( 'IMAP_if_mailboxes' ) ); *************** *** 805,809 **** --- 804,810 ---- my ( $im, $c, $mq, $l, $b, $h ) = @_; + $im->user_id( 1 ); $im->initialize(); + my $s = $b->get_administrator_session_key(); # We should not do anything when we're not enabled: *************** *** 811,820 **** test_assert_equal( $im->start(), 2 ); $im->config_( 'enabled', 1 ); ! $im->user_config_( 1, 'expunge', 1 ); ! $im->user_config_( 1, 'hostname', '127.0.0.1' ); ! $im->user_config_( 1, 'password', 'password' ); ! $im->user_config_( 1, 'port', '1143' ); ! $im->user_config_( 1, 'update_interval', 10 ); ! $im->user_config_( 1, 'watched_folders', '' ); $im->global_config_( 'message_cutoff', 100000 ); --- 812,821 ---- test_assert_equal( $im->start(), 2 ); $im->config_( 'enabled', 1 ); ! $im->user_config_( 1, 'expunge', 1 ); ! $im->user_config_( 1, 'hostname', '127.0.0.1' ); ! $im->user_config_( 1, 'password', 'password' ); ! $im->user_config_( 1, 'port', '1143' ); ! $im->user_config_( 1, 'update_interval', 10 ); ! $im->user_config_( 1, 'watched_folders', '' ); $im->global_config_( 'message_cutoff', 100000 ); *************** *** 872,878 **** $im->config_( enabled => 1 ); ! $l->config_( 'level', 1 ); ! $l->config_( logdir => '/tmp/' ); ! $im->module_config_( 'html', 'port', 8082 ); --- 873,880 ---- $im->config_( enabled => 1 ); ! #$l->config_( 'level', 2 ); ! #$l->config_( logdir => '/tmp' ); ! #$h->global_config_( 'debug', 1 ); ! $h->global_config_( 'single_user', 1 ); $im->module_config_( 'html', 'port', 8082 ); |
From: Manni H. <man...@us...> - 2008-04-10 11:20:52
|
Update of /cvsroot/popfile/engine/Classifier In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3763/Classifier Modified Files: Bayes.pm Log Message: Correct log message Index: Bayes.pm =================================================================== RCS file: /cvsroot/popfile/engine/Classifier/Bayes.pm,v retrieving revision 1.363 retrieving revision 1.364 diff -C2 -d -r1.363 -r1.364 *** Bayes.pm 9 Apr 2008 17:20:47 -0000 1.363 --- Bayes.pm 10 Apr 2008 11:20:55 -0000 1.364 *************** *** 1768,1772 **** $self->{api_sessions__}{$single_user_session} = 1; $self->db_update_cache__( $single_user_session ); ! $self->log_( 1, "get_session_key_from_token returning key $single_user_session for the single user mode" ); # Send the session to the parent so that it is recorded and can --- 1768,1772 ---- $self->{api_sessions__}{$single_user_session} = 1; $self->db_update_cache__( $single_user_session ); ! $self->log_( 1, "get_single_user_session_key returning key $single_user_session for the single user mode" ); # Send the session to the parent so that it is recorded and can |
From: Manni H. <man...@us...> - 2008-04-10 11:18:54
|
Update of /cvsroot/popfile/engine/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2895/tests Modified Files: TestIMAP.tst Log Message: Adapt the test that checks the changed options. Index: TestIMAP.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestIMAP.tst,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** TestIMAP.tst 9 Feb 2008 10:09:12 -0000 1.11 --- TestIMAP.tst 10 Apr 2008 11:18:39 -0000 1.12 *************** *** 685,691 **** test_assert( ! $error ); my $expected = sprintf $language->{Imap_MapUpdated}, 'other', 'personal'; - $expected .= '<br />'; $expected .= sprintf $language->{Imap_MapUpdated}, 'personal', 'other'; - $expected .= '<br />'; test_assert_equal( $status, $expected ); test_assert_equal( $im->{folder_change_flag__}, 1 ); --- 685,689 ---- |
From: naoki i. <am...@us...> - 2008-04-09 17:20:50
|
Update of /cvsroot/popfile/engine/POPFile In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12124/POPFile Modified Files: Configuration.pm History.pm MQ.pm Log Message: Change Log 1. The parameters are now automatically upgraded Classifier/Bayes.pm Parameters in the configration file (popfile.cfg) are automatically upgraded to the POPFile database as the admin's parameters exept for the password of the UI (html_password). 2. A new global option 'language' (GLOBAL_language) POPFile/Configuration.pm Classifier/Bayes.pm tests/TestBayes.tst tests/TestMailParse.tst This setting is used by POPFile to decide whether it runs some language specific codes. e.g. if GLOBAL_language is 'Nihongo', POPFile will handle Japanese texts correctly. And it is used as the default language setting for the users. TODO: In the single user mode, POPFile's 'global' language setting should be equaled to the admin's setting. 3. Localized UI strings are now cached per user (session) UI/HTML.pm tests/TestHTML.tst All of the users shared the language cache till now. If a user changed the language setting, the cache will be updated, and affect the other users' UI. The user's cache will be cleared when the session is rleased. 4. The magnet tab always show the localized magnet types UI/HTML.pm skins/default/magnet-page.thtml 5. Cookie will be deleted when closing web browsers UI/HTML.pm I think there's no need to store the cookie for two weeks. 6. Removed almost all of the hardcoded user id 1 UI/HTML.pm Classifier/Bayes.pm POPFile/History.pm 7. Login page for the single user mode UI/HTML.pm skins/default/password-page.thtml languages/English.msg languages/Nihongo.msg If admin has a password, login page will be shown even in the single user mode 8. commit_history is called before the session key is released Classifier/Bayes.pm POPFile/History.pm Avoid the 'Invalid session key' error occuring when POPFile is updating the history. 9. Messages are now ordered by their types. POPFile/MQ.pm Messages are handled in following order: 1 CREAT 2 LOGIN 3 UIREG 4 COMIT 5 TICKD 6 RELSE In some case, COMIT had been processed before the session key is created by CREAT. This caused the 'Invalid session key' errors. 10. TestPOP3 is now passed tests/TestPOP3.tst tests/TestMailParse029.msg tests/TestMailParse029.cam tests/TestMailParse029.wrd 11. Fixed some tests to output their result correctly tests/TestBayesScript.tst tests/TestConfiguration.tst tests/TestHTTP.tst tests/TestInsertScript.tst tests/TestProxy.tst Current state of the test suite: TestBayesScript PASS TestBayes PASS TestConfiguration PASS * TestHistory fail * TestHTML PASS * TestHTTP PASS TestIMAP not tested yet TestInsertScript PASS * TestLogger PASS TestMailParse PASS TestModule PASS TestMQ PASS TestMutex PASS TestPipeScript PASS TestPOP3 PASS TestProxy PASS TestWordMangle PASS TestXMLRPC PASS (but child process does not terminate) * : needs to add tests for multi user support TODO 1. multi user mode tests are needed tests/TestConfiguration.tst tests/TestHistory.tst tests/TestHTML.tst tests/TestInsertScript.tst Index: History.pm =================================================================== RCS file: /cvsroot/popfile/engine/POPFile/History.pm,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** History.pm 6 Apr 2008 08:27:07 -0000 1.50 --- History.pm 9 Apr 2008 17:20:47 -0000 1.51 *************** *** 133,137 **** # added to the queue and before service() is called ! $self->commit_history__(); # Clean up the database handle --- 133,137 ---- # added to the queue and before service() is called ! $self->commit_history(); # Clean up the database handle *************** *** 161,165 **** # a COMIT message. ! $self->commit_history__(); return 1; --- 161,165 ---- # a COMIT message. ! $self->commit_history(); return 1; *************** *** 187,190 **** --- 187,191 ---- if ( $type eq 'COMIT' ) { push ( @{$self->{commit_list__}}, \@message ); + # $self->commit_history(); } } *************** *** 467,471 **** #--------------------------------------------------------------------------- # ! # commit_history__ # # (private) Used internally to commit messages that have been committed --- 468,472 ---- #--------------------------------------------------------------------------- # ! # commit_history # # (private) Used internally to commit messages that have been committed *************** *** 473,477 **** # #---------------------------------------------------------------------------- ! sub commit_history__ { my ( $self ) = @_; --- 474,478 ---- # #---------------------------------------------------------------------------- ! sub commit_history { my ( $self ) = @_; *************** *** 1207,1213 **** if ( $bucket ne 'unknown_class' ) { ! # TODO : hardcoded userid 1 ! my ( $slot, $file ) = $self->reserve_slot( $session, 1 ); rename $msg, $file; my @message = ( $session, $slot, $bucket, 0 ); --- 1208,1214 ---- if ( $bucket ne 'unknown_class' ) { ! # Import the message to the admin's history table ! my ( $slot, $file ) = $self->reserve_slot( $session ); rename $msg, $file; my @message = ( $session, $slot, $bucket, 0 ); *************** *** 1219,1223 **** print "\nDone upgrading history\n"; ! $self->commit_history__(); $self->classifier_()->release_session_key( $session ); --- 1220,1224 ---- print "\nDone upgrading history\n"; ! $self->commit_history(); $self->classifier_()->release_session_key( $session ); Index: MQ.pm =================================================================== RCS file: /cvsroot/popfile/engine/POPFile/MQ.pm,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** MQ.pm 20 Feb 2006 02:01:57 -0000 1.23 --- MQ.pm 9 Apr 2008 17:20:47 -0000 1.24 *************** *** 69,72 **** --- 69,83 ---- use POSIX ":sys_wait_h"; + # Messages are handled in this order. + + my %message_type_list = ( + 'CREAT' => 1, + 'LOGIN' => 2, + 'UIREG' => 3, + 'COMIT' => 4, + 'TICKD' => 5, + 'RELSE' => 6, + ); + #---------------------------------------------------------------------------- # new *************** *** 125,136 **** # Iterate through all the messages in all the queues ! for my $type (sort keys %{$self->{queue__}}) { ! while ( my $ref = shift @{$self->{queue__}{$type}} ) { ! my @message = @$ref; ! my $flat = join(':', @message); ! $self->log_( 2, "Message $type ($flat) ready for delivery" ); ! for my $waiter (@{$self->{waiters__}{$type}}) { $self->log_( 2, "Delivering message $type ($flat) to " . $waiter->name() ); --- 136,149 ---- # Iterate through all the messages in all the queues ! for my $type ( sort sort_message__ ! keys %{$self->{queue__}} ) { ! while ( my $ref = shift @{$self->{queue__}{$type}} ) { ! my @message = @$ref; ! my $flat = join(':', @message); ! $self->log_( 2, "Message $type ($flat) ready for delivery" ); ! ! for my $waiter (@{$self->{waiters__}{$type}}) { $self->log_( 2, "Delivering message $type ($flat) to " . $waiter->name() ); *************** *** 146,149 **** --- 159,180 ---- #---------------------------------------------------------------------------- # + # sort_message__ + # + # Sort message types + # + #---------------------------------------------------------------------------- + sub sort_message__ + { + if ( defined($message_type_list{$a}) && defined($message_type_list{$b}) ) { + $message_type_list{$a} <=> $message_type_list{$b}; + } elsif ( !defined($message_type_list{$a}) && !defined($message_type_list{$b}) ) { + $a cmp $b; + } else { + !defined($message_type_list{$a}) <=> !defined($message_type_list{$b}); + } + } + + #---------------------------------------------------------------------------- + # # stop # Index: Configuration.pm =================================================================== RCS file: /cvsroot/popfile/engine/POPFile/Configuration.pm,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** Configuration.pm 2 Dec 2007 17:27:47 -0000 1.62 --- Configuration.pm 9 Apr 2008 17:20:47 -0000 1.63 *************** *** 141,144 **** --- 141,148 ---- $self->global_config_( 'crypt_device', '' ); + # GLOBAL language setting + + $self->global_config_( 'language', 'English' ); + # Register for the TICKD message which is sent hourly by the # Logger module. We use this to hourly save the configuration file *************** *** 491,494 **** --- 495,500 ---- 'timeout', 'GLOBAL_timeout', + # 'html_language', 'GLOBAL_language', + # Parameters that are now handled by POPFile::Logger |
Update of /cvsroot/popfile/engine/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12124/tests Modified Files: TestBayes.tst TestBayesScript.tst TestConfiguration.tst TestHTML.tst TestHTTP.tst TestHistory.tst TestInsertScript.tst TestLogger.tst TestMQ.tst TestMailParse.tst TestMailParse029.cam TestMailParse029.msg TestMailParse029.wrd TestModule.tst TestPOP3.tst TestProxy.tst Log Message: Change Log 1. The parameters are now automatically upgraded Classifier/Bayes.pm Parameters in the configration file (popfile.cfg) are automatically upgraded to the POPFile database as the admin's parameters exept for the password of the UI (html_password). 2. A new global option 'language' (GLOBAL_language) POPFile/Configuration.pm Classifier/Bayes.pm tests/TestBayes.tst tests/TestMailParse.tst This setting is used by POPFile to decide whether it runs some language specific codes. e.g. if GLOBAL_language is 'Nihongo', POPFile will handle Japanese texts correctly. And it is used as the default language setting for the users. TODO: In the single user mode, POPFile's 'global' language setting should be equaled to the admin's setting. 3. Localized UI strings are now cached per user (session) UI/HTML.pm tests/TestHTML.tst All of the users shared the language cache till now. If a user changed the language setting, the cache will be updated, and affect the other users' UI. The user's cache will be cleared when the session is rleased. 4. The magnet tab always show the localized magnet types UI/HTML.pm skins/default/magnet-page.thtml 5. Cookie will be deleted when closing web browsers UI/HTML.pm I think there's no need to store the cookie for two weeks. 6. Removed almost all of the hardcoded user id 1 UI/HTML.pm Classifier/Bayes.pm POPFile/History.pm 7. Login page for the single user mode UI/HTML.pm skins/default/password-page.thtml languages/English.msg languages/Nihongo.msg If admin has a password, login page will be shown even in the single user mode 8. commit_history is called before the session key is released Classifier/Bayes.pm POPFile/History.pm Avoid the 'Invalid session key' error occuring when POPFile is updating the history. 9. Messages are now ordered by their types. POPFile/MQ.pm Messages are handled in following order: 1 CREAT 2 LOGIN 3 UIREG 4 COMIT 5 TICKD 6 RELSE In some case, COMIT had been processed before the session key is created by CREAT. This caused the 'Invalid session key' errors. 10. TestPOP3 is now passed tests/TestPOP3.tst tests/TestMailParse029.msg tests/TestMailParse029.cam tests/TestMailParse029.wrd 11. Fixed some tests to output their result correctly tests/TestBayesScript.tst tests/TestConfiguration.tst tests/TestHTTP.tst tests/TestInsertScript.tst tests/TestProxy.tst Current state of the test suite: TestBayesScript PASS TestBayes PASS TestConfiguration PASS * TestHistory fail * TestHTML PASS * TestHTTP PASS TestIMAP not tested yet TestInsertScript PASS * TestLogger PASS TestMailParse PASS TestModule PASS TestMQ PASS TestMutex PASS TestPipeScript PASS TestPOP3 PASS TestProxy PASS TestWordMangle PASS TestXMLRPC PASS (but child process does not terminate) * : needs to add tests for multi user support TODO 1. multi user mode tests are needed tests/TestConfiguration.tst tests/TestHistory.tst tests/TestHTML.tst tests/TestInsertScript.tst Index: TestMailParse029.msg =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestMailParse029.msg,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestMailParse029.msg 1 Mar 2004 10:46:30 -0000 1.1 --- TestMailParse029.msg 9 Apr 2008 17:20:48 -0000 1.2 *************** *** 7,9 **** id 3FD9B5E909B60A72 for fo...@in...; Sun, 22 Feb 2004 04:10:52 +0100 Received: from 67.172.52.188 by 24.85.91.39; Sun, 22 Feb 2004 04:03:40 +0100 ! Message-ID: <H[20 \ No newline at end of file --- 7,10 ---- id 3FD9B5E909B60A72 for fo...@in...; Sun, 22 Feb 2004 04:10:52 +0100 Received: from 67.172.52.188 by 24.85.91.39; Sun, 22 Feb 2004 04:03:40 +0100 ! Message-ID: <H[20 ! . \ No newline at end of file Index: TestMailParse029.wrd =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestMailParse029.wrd,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestMailParse029.wrd 1 Mar 2004 10:46:30 -0000 1.1 --- TestMailParse029.wrd 9 Apr 2008 17:20:48 -0000 1.2 *************** *** 11,14 **** --- 11,15 ---- h24-85-91-39.vc.shawcable.net 1 header:Date 1 + header:Message-ID 1 header:Received 3 header:Return-Path 1 Index: TestBayesScript.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestBayesScript.tst,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TestBayesScript.tst 5 Apr 2008 16:50:46 -0000 1.7 --- TestBayesScript.tst 9 Apr 2008 17:20:48 -0000 1.8 *************** *** 45,48 **** --- 45,52 ---- test_assert_regexp( $line, 'output the classification of a message' ); + # Save STDERR + + open my $old_stderr, ">&STDERR"; + # Bad file name open STDERR, ">temp.tmp"; *************** *** 56,59 **** --- 60,67 ---- test_assert_regexp( $line, 'Error: File `doesnotexist\' does not exist, classification aborted' ); + # Restore STDERR + + open STDERR, ">&", $old_stderr; + # Check the output Index: TestConfiguration.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestConfiguration.tst,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** TestConfiguration.tst 5 Apr 2008 16:50:46 -0000 1.23 --- TestConfiguration.tst 9 Apr 2008 17:20:48 -0000 1.24 *************** *** 23,26 **** --- 23,27 ---- unlink 'popfile.cfg'; + unlink 'popfile.pid'; use POPFile::Loader; *************** *** 58,61 **** --- 59,67 ---- test_assert_equal( $c->global_config_( 'msgdir' ), 'messages/' ); + # Save STDERR + + my $old_stderr; + open $old_stderr, ">&STDERR"; + # Check that the PID file gets created and then deleted and # contains the correct process ID *************** *** 119,122 **** --- 125,130 ---- test_assert_regexp( $line, 'GLOBAL_debug 0' ); $line = <FILE>; + test_assert_regexp( $line, 'GLOBAL_language English' ); + $line = <FILE>; test_assert_regexp( $line, 'GLOBAL_message_cutoff 100000' ); $line = <FILE>; *************** *** 247,250 **** --- 255,262 ---- test_assert_regexp( $line, 'Expected a command line option and got baz' ); + # Restore STDERR + + open STDERR, ">&", $old_stderr; + # path_join__ Index: TestInsertScript.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestInsertScript.tst,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** TestInsertScript.tst 20 Feb 2006 02:20:57 -0000 1.8 --- TestInsertScript.tst 9 Apr 2008 17:20:48 -0000 1.9 *************** *** 51,54 **** --- 51,58 ---- test_assert_regexp( shift @stdout, 'insert mail messages into' ); + # Save STDERR + + open my $old_stderr, ">&STDERR"; + # Bad bucket name *************** *** 94,97 **** --- 98,105 ---- close STDERR; + # Restore STDERR + + open STDERR, ">&", $old_stderr; + test_assert_equal( $code, 0 ); Index: TestMailParse029.cam =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestMailParse029.cam,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestMailParse029.cam 1 Mar 2004 10:46:30 -0000 1.1 --- TestMailParse029.cam 9 Apr 2008 17:20:48 -0000 1.2 *************** *** 7,11 **** id 3FD9B5E909B60A72 for fo...@in...; Sun, 22 Feb 2004 04:10:52 +0100 Received: from 67.172.52.188 by 24.85.91.39; Sun, 22 Feb 2004 04:03:40 +0100 ! Message-ID: <H[20Subject: [spam] X-Text-Classification: spam X-POPFile-Link: http://127.0.0.1:8080/jump_to_message?view=popfile0=0.msg --- 7,12 ---- id 3FD9B5E909B60A72 for fo...@in...; Sun, 22 Feb 2004 04:10:52 +0100 Received: from 67.172.52.188 by 24.85.91.39; Sun, 22 Feb 2004 04:03:40 +0100 ! Message-ID: <H[20 ! Subject: [spam] X-Text-Classification: spam X-POPFile-Link: http://127.0.0.1:8080/jump_to_message?view=popfile0=0.msg Index: TestHTML.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestHTML.tst,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** TestHTML.tst 5 Apr 2008 16:50:46 -0000 1.38 --- TestHTML.tst 9 Apr 2008 17:20:48 -0000 1.39 *************** *** 83,91 **** test_assert_equal( $h->url_encode_( '[foo]' ), '%5bfoo%5d' ); ! $h->{language__}{Locale_Thousands} = ','; test_assert_equal( $h->pretty_number( 1234 ), '1,234' ); ! $h->{language__}{Locale_Thousands} = ' '; test_assert_equal( $h->pretty_number( 1234 ), '1 234' ); ! $h->{language__}{Locale_Thousands} = ''; --- 83,91 ---- test_assert_equal( $h->url_encode_( '[foo]' ), '%5bfoo%5d' ); ! $h->{language__}{global}{Locale_Thousands} = ','; test_assert_equal( $h->pretty_number( 1234 ), '1,234' ); ! $h->{language__}{global}{Locale_Thousands} = ' '; test_assert_equal( $h->pretty_number( 1234 ), '1 234' ); ! $h->{language__}{global}{Locale_Thousands} = ''; *************** *** 160,165 **** $mq->service(); ! my %lang = $h->language(); ! test_assert_equal( $lang{LanguageCode}, 'en' ); while ( 1 ) { --- 160,165 ---- $mq->service(); ! my $lang = $h->language(); ! test_assert_equal( $lang->{LanguageCode}, 'en' ); while ( 1 ) { Index: TestLogger.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestLogger.tst,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** TestLogger.tst 20 Feb 2006 02:20:57 -0000 1.12 --- TestLogger.tst 9 Apr 2008 17:20:48 -0000 1.13 *************** *** 22,25 **** --- 22,27 ---- # ---------------------------------------------------------------------------- + unlink 'popfile.cfg'; + use POPFile::Loader; my $POPFile = POPFile::Loader->new(); Index: TestMQ.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestMQ.tst,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TestMQ.tst 20 Feb 2006 02:20:57 -0000 1.7 --- TestMQ.tst 9 Apr 2008 17:20:48 -0000 1.8 *************** *** 52,58 **** $mq->register( 'MESG1', $r ); ! $mq->register( 'MSG1', $r ); ! $mq->register( 'MSG2', $r ); ! $mq->register( 'MSG3', $r ); # Now send messages and check for their receipt --- 52,58 ---- $mq->register( 'MESG1', $r ); ! $mq->register( 'MSG1', $r ); ! $mq->register( 'MSG2', $r ); ! $mq->register( 'MSG3', $r ); # Now send messages and check for their receipt Index: TestModule.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestModule.tst,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** TestModule.tst 20 Feb 2006 02:20:57 -0000 1.19 --- TestModule.tst 9 Apr 2008 17:20:48 -0000 1.20 *************** *** 22,25 **** --- 22,27 ---- # ---------------------------------------------------------------------------- + unlink 'popfile.cfg'; + use POPFile::Loader; my $POPFile = POPFile::Loader->new(); Index: TestMailParse.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestMailParse.tst,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** TestMailParse.tst 5 Apr 2008 16:50:46 -0000 1.47 --- TestMailParse.tst 9 Apr 2008 17:20:48 -0000 1.48 *************** *** 518,522 **** if ( $have_text_kakasi ) { ! $b->user_module_config_( 1, 'html', 'language', 'Nihongo' ); # $b->{parser__}->mangle( $w ); $b->initialize(); --- 518,522 ---- if ( $have_text_kakasi ) { ! $b->global_config_( 'language', 'Nihongo' ); # $b->{parser__}->mangle( $w ); $b->initialize(); Index: TestBayes.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestBayes.tst,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** TestBayes.tst 6 Apr 2008 08:27:08 -0000 1.62 --- TestBayes.tst 9 Apr 2008 17:20:48 -0000 1.63 *************** *** 62,74 **** # Test the unclassified_probability parameter ! test_assert_equal( $b->{unclassified__}, log(100) ); $b->user_config_( 1, 'unclassified_weight', 9 ); ! test_assert( $b->start() ); ! test_assert_equal( $b->{unclassified__}, log( 9) ); $b->user_config_( 1, 'unclassified_weight', 5 ); ! test_assert( $b->start() ); ! test_assert_equal( $b->{unclassified__}, log( 5) ); # test the API functions --- 62,74 ---- # Test the unclassified_probability parameter ! test_assert_equal( $b->user_config_( 1, 'unclassified_weight' ), 100 ); $b->user_config_( 1, 'unclassified_weight', 9 ); ! #test_assert( $b->start() ); ! test_assert_equal( $b->user_config_( 1, 'unclassified_weight' ), 9 ); $b->user_config_( 1, 'unclassified_weight', 5 ); ! #test_assert( $b->start() ); ! test_assert_equal( $b->user_config_( 1, 'unclassified_weight' ), 5 ); # test the API functions *************** *** 1251,1255 **** if ( $have_text_kakasi ) { ! $b->user_module_config_( 1, 'html', 'language', 'Nihongo' ); $b->initialize(); test_assert( $b->start() ); --- 1251,1255 ---- if ( $have_text_kakasi ) { ! $b->global_config_( 'language', 'Nihongo' ); $b->initialize(); test_assert( $b->start() ); Index: TestPOP3.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestPOP3.tst,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** TestPOP3.tst 20 Feb 2006 02:20:57 -0000 1.34 --- TestPOP3.tst 9 Apr 2008 17:20:48 -0000 1.35 *************** *** 25,53 **** - use POPFile::Loader; - my $POPFile = POPFile::Loader->new(); - $POPFile->CORE_loader_init(); - $POPFile->CORE_signals(); - - my %valid = ( 'POPFile/Logger' => 1, - 'POPFile/MQ' => 1, - 'POPFile/Configuration' => 1, [...1667 lines suppressed...] + # $p->forked( $writer ); + close $reader; + + use IO::Handle; + $writer->autoflush( 1 ); + + return ( 0, $writer ); + } + + $l->log_( 2, "Child process has pid $pid" ); + + $b->postfork( $pid, $reader ); + $mq->postfork( $pid, $reader ); + $h->postfork( $pid, $reader ); + $db->postfork( $pid, $reader ); + $p->postfork( $pid, $reader ); + close $writer; + return ($pid, $reader); + } + Index: TestHistory.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestHistory.tst,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** TestHistory.tst 5 Apr 2008 16:50:46 -0000 1.17 --- TestHistory.tst 9 Apr 2008 17:20:48 -0000 1.18 *************** *** 28,31 **** --- 28,32 ---- unlink 'popfile.db'; + unlink 'popfile.pid'; unlink 'stopwords'; test_assert( copy ( 'stopwords.base', 'stopwords' ) ); *************** *** 411,415 **** @rows = $h->get_query_rows( $q, 1, 2 ); $h->set_query( $q, '', 's', '', 0 ); ! test_assert_equal( $#{$h->{queries__}{$q}{cache}}, 2 ); $h->set_query( $q, '', 't', '', 0 ); test_assert_equal( $#{$h->{queries__}{$q}{cache}}, -1 ); --- 412,416 ---- @rows = $h->get_query_rows( $q, 1, 2 ); $h->set_query( $q, '', 's', '', 0 ); ! test_assert_equal( $#{$h->{queries__}{$q}{cache}}, 1 ); $h->set_query( $q, '', 't', '', 0 ); test_assert_equal( $#{$h->{queries__}{$q}{cache}}, -1 ); Index: TestProxy.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestProxy.tst,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** TestProxy.tst 20 Feb 2006 02:20:57 -0000 1.26 --- TestProxy.tst 9 Apr 2008 17:20:48 -0000 1.27 *************** *** 23,26 **** --- 23,27 ---- unlink 'popfile.db'; + unlink 'popfile.cfg'; use POPFile::Loader; *************** *** 29,38 **** $POPFile->CORE_signals(); ! my %valid = ( 'POPFile/Module' => 1, ! 'POPFile/Logger' => 1, ! 'POPFile/MQ' => 1, 'POPFile/Configuration' => 1, ! 'POPFile/Database' =>1, ! 'Classifier/Bayes' => 1 ); $POPFile->CORE_load( 0, \%valid ); --- 30,39 ---- $POPFile->CORE_signals(); ! my %valid = ( 'POPFile/Module' => 1, ! 'POPFile/Logger' => 1, ! 'POPFile/MQ' => 1, 'POPFile/Configuration' => 1, ! 'POPFile/Database' =>1, ! 'Classifier/Bayes' => 1 ); $POPFile->CORE_load( 0, \%valid ); *************** *** 642,648 **** #$sp2->classifier( $b ); ! open (STDERR, ">stdout.tmp"); test_assert( !$sp2->start() ); close STDERR; open TEMP, "<stdout.tmp"; $line = <TEMP>; --- 643,651 ---- #$sp2->classifier( $b ); ! open my $old_stderr, ">&STDERR"; ! open STDERR, ">stdout.tmp"; test_assert( !$sp2->start() ); close STDERR; + open STDERR, ">&", $old_stderr; open TEMP, "<stdout.tmp"; $line = <TEMP>; Index: TestHTTP.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestHTTP.tst,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** TestHTTP.tst 5 Apr 2008 16:50:46 -0000 1.13 --- TestHTTP.tst 9 Apr 2008 17:20:48 -0000 1.14 *************** *** 206,212 **** --- 206,214 ---- $h2->config_( 'port', -1 ); + open my $old_stderr, ">&STDERR"; open (STDERR, ">stdout.tmp"); test_assert( !$h2->start() ); close STDERR; + open STDERR, ">&", $old_stderr; open TEMP, "<stdout.tmp"; $line = <TEMP>; |
From: naoki i. <am...@us...> - 2008-04-09 17:20:44
|
Update of /cvsroot/popfile/engine/Classifier In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12124/Classifier Modified Files: Bayes.pm Log Message: Change Log 1. The parameters are now automatically upgraded Classifier/Bayes.pm Parameters in the configration file (popfile.cfg) are automatically upgraded to the POPFile database as the admin's parameters exept for the password of the UI (html_password). 2. A new global option 'language' (GLOBAL_language) POPFile/Configuration.pm Classifier/Bayes.pm tests/TestBayes.tst tests/TestMailParse.tst This setting is used by POPFile to decide whether it runs some language specific codes. e.g. if GLOBAL_language is 'Nihongo', POPFile will handle Japanese texts correctly. And it is used as the default language setting for the users. TODO: In the single user mode, POPFile's 'global' language setting should be equaled to the admin's setting. 3. Localized UI strings are now cached per user (session) UI/HTML.pm tests/TestHTML.tst All of the users shared the language cache till now. If a user changed the language setting, the cache will be updated, and affect the other users' UI. The user's cache will be cleared when the session is rleased. 4. The magnet tab always show the localized magnet types UI/HTML.pm skins/default/magnet-page.thtml 5. Cookie will be deleted when closing web browsers UI/HTML.pm I think there's no need to store the cookie for two weeks. 6. Removed almost all of the hardcoded user id 1 UI/HTML.pm Classifier/Bayes.pm POPFile/History.pm 7. Login page for the single user mode UI/HTML.pm skins/default/password-page.thtml languages/English.msg languages/Nihongo.msg If admin has a password, login page will be shown even in the single user mode 8. commit_history is called before the session key is released Classifier/Bayes.pm POPFile/History.pm Avoid the 'Invalid session key' error occuring when POPFile is updating the history. 9. Messages are now ordered by their types. POPFile/MQ.pm Messages are handled in following order: 1 CREAT 2 LOGIN 3 UIREG 4 COMIT 5 TICKD 6 RELSE In some case, COMIT had been processed before the session key is created by CREAT. This caused the 'Invalid session key' errors. 10. TestPOP3 is now passed tests/TestPOP3.tst tests/TestMailParse029.msg tests/TestMailParse029.cam tests/TestMailParse029.wrd 11. Fixed some tests to output their result correctly tests/TestBayesScript.tst tests/TestConfiguration.tst tests/TestHTTP.tst tests/TestInsertScript.tst tests/TestProxy.tst Current state of the test suite: TestBayesScript PASS TestBayes PASS TestConfiguration PASS * TestHistory fail * TestHTML PASS * TestHTTP PASS TestIMAP not tested yet TestInsertScript PASS * TestLogger PASS TestMailParse PASS TestModule PASS TestMQ PASS TestMutex PASS TestPipeScript PASS TestPOP3 PASS TestProxy PASS TestWordMangle PASS TestXMLRPC PASS (but child process does not terminate) * : needs to add tests for multi user support TODO 1. multi user mode tests are needed tests/TestConfiguration.tst tests/TestHistory.tst tests/TestHTML.tst tests/TestInsertScript.tst Index: Bayes.pm =================================================================== RCS file: /cvsroot/popfile/engine/Classifier/Bayes.pm,v retrieving revision 1.362 retrieving revision 1.363 diff -C2 -d -r1.362 -r1.363 *** Bayes.pm 6 Apr 2008 08:27:07 -0000 1.362 --- Bayes.pm 9 Apr 2008 17:20:47 -0000 1.363 *************** *** 262,265 **** --- 262,270 ---- if ( $type eq 'RELSE' ) { + # Before releasing the session key we have to make sure that all of + # the histories are committed + + $self->history_()->commit_history() if ( defined($self->history_()) ); + $self->release_session_key_private__( $message[0] ); } *************** *** 297,304 **** # characters(EUC-JP). ! # TODO : hardcoded 1 ! if ( defined( $self->user_module_config_( 1, 'html', 'language' ) ) && ! ( $self->user_module_config_( 1, 'html', 'language' ) =~ /^Nihongo|Korean$/ )) { use POSIX qw( locale_h ); setlocale( LC_COLLATE, 'C' ); --- 302,308 ---- # characters(EUC-JP). ! my $language = $self->global_config_( 'language' ); ! if ( defined( $language ) && ( $language =~ /^Nihongo|Korean$/ ) ) { use POSIX qw( locale_h ); setlocale( LC_COLLATE, 'C' ); *************** *** 307,317 **** # Pass in the current interface language for language specific parsing ! # TODO : hardcoded 1 ! ! $self->{parser__}->{lang__} = $self->user_module_config_( 1, 'html', 'language' ) || ''; ! $self->{unclassified__} = log( $self->user_config_( 1, 'unclassified_weight' ) ); $self->upgrade_predatabase_data__(); # Since Text::Kakasi is not thread-safe, we use it under the # control of a Mutex to avoid a crash if we are running on --- 311,320 ---- # Pass in the current interface language for language specific parsing ! $self->{parser__}->{lang__} = $language || ''; $self->upgrade_predatabase_data__(); + $self->upgrade_v1_data__(); + # Since Text::Kakasi is not thread-safe, we use it under the # control of a Mutex to avoid a crash if we are running on *************** *** 1194,1197 **** --- 1197,1239 ---- #---------------------------------------------------------------------------- # + # upgrade_v1_data__ + # + # If the deprecated parameters found, upgrades them to the SQL database. + # + #---------------------------------------------------------------------------- + sub upgrade_v1_data__ + { + my ( $self ) = @_; + + # Copy deprecated parameters to database + + if ( defined($self->configuration_()->{deprecated_parameters__}) ) { + $self->log_( 1, "Upgrade the deprecated parameters in popfile.cfg to the admin's parameters\n" ); + + foreach my $parameter ( keys %{$self->configuration_()->{deprecated_parameters__}} ) { + $parameter =~ m/^([^_]+)_(.*)$/; + my $module = $1; + my $config = $2; + my $value = $self->configuration_()->{deprecated_parameters__}{$parameter}; + + if ( defined($module) && defined($config) && defined($value) && + defined($self->user_module_config_( 1, $module, $config )) ) { + + # Upgrade parameters to admin's + + $self->user_module_config_( 1, $module, $config, $value ); + + # Upgrade language parameter to global + + if ( ( $module eq 'html' ) && ( $config eq 'language' ) ) { + $self->global_config_( 'language', $value ); + } + } + } + } + } + + #---------------------------------------------------------------------------- + # # magnet_match_helper__ # *************** *** 1214,1221 **** $match = lc($match); - # In Japanese and Korean mode, disable locale. Sorting Japanese - # and Korean with "use locale" is memory and time consuming, and - # may cause perl crash. - my @magnets; --- 1256,1259 ---- *************** *** 1905,1909 **** return undef if ( !defined( $userid ) ); ! $self->{unclassified__} = log( $self->user_config_( 1, 'unclassified_weight' ) ); $self->{magnet_used__} = 0; --- 1943,1947 ---- return undef if ( !defined( $userid ) ); ! $self->{unclassified__} = log( $self->user_config_( $userid, 'unclassified_weight' ) ); $self->{magnet_used__} = 0; *************** *** 2469,2473 **** if ( $class eq '' ) { $self->{parser__}->start_parse(); ! ( $slot, $msg_file ) = $self->history_()->reserve_slot( $session, $userid ); } else { $msg_file = $self->history_()->get_slot_file( $slot ); --- 2507,2511 ---- if ( $class eq '' ) { $self->{parser__}->start_parse(); ! ( $slot, $msg_file ) = $self->history_()->reserve_slot( $session ); } else { $msg_file = $self->history_()->get_slot_file( $slot ); *************** *** 3216,3223 **** # perl crash. ! if ( $self->user_module_config_( 1, 'html', 'language' ) eq 'Nihongo' ) { return grep {$_ ne $prev && ($prev = $_, 1)} sort map {substr_euc__($_,0,1)} @{$result}; } else { ! if ( $self->user_module_config_( 1, 'html', 'language' ) eq 'Korean' ) { return grep {$_ ne $prev && ($prev = $_, 1)} sort map {$_ =~ /([\x20-\x80]|$eksc)/} @{$result}; } else { --- 3254,3261 ---- # perl crash. ! if ( $self->global_config_( 'language' ) eq 'Nihongo' ) { return grep {$_ ne $prev && ($prev = $_, 1)} sort map {substr_euc__($_,0,1)} @{$result}; } else { ! if ( $self->global_config_( 'language' ) eq 'Korean' ) { return grep {$_ ne $prev && ($prev = $_, 1)} sort map {$_ =~ /([\x20-\x80]|$eksc)/} @{$result}; } else { *************** *** 4647,4653 **** # Pass language parameter to add_stopword() ! # TODO : hardcoded 1 ! ! return $self->{parser__}->{mangle__}->add_stopword( $stopword, $self->user_module_config_( 1, 'html', 'language' ) ); } --- 4685,4689 ---- # Pass language parameter to add_stopword() ! return $self->{parser__}->{mangle__}->add_stopword( $stopword, $self->global_config_( 'language' ) ); } *************** *** 4661,4667 **** # Pass language parameter to remove_stopword() ! # TODO : hardcoded 1 ! ! return $self->{parser__}->{mangle__}->remove_stopword( $stopword, $self->user_module_config_( 1, 'html', 'language' ) ); } --- 4697,4701 ---- # Pass language parameter to remove_stopword() ! return $self->{parser__}->{mangle__}->remove_stopword( $stopword, $self->global_config_( 'language' ) ); } |
From: naoki i. <am...@us...> - 2008-04-09 17:20:44
|
Update of /cvsroot/popfile/engine/UI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12124/UI Modified Files: HTML.pm Log Message: Change Log 1. The parameters are now automatically upgraded Classifier/Bayes.pm Parameters in the configration file (popfile.cfg) are automatically upgraded to the POPFile database as the admin's parameters exept for the password of the UI (html_password). 2. A new global option 'language' (GLOBAL_language) POPFile/Configuration.pm Classifier/Bayes.pm tests/TestBayes.tst tests/TestMailParse.tst This setting is used by POPFile to decide whether it runs some language specific codes. e.g. if GLOBAL_language is 'Nihongo', POPFile will handle Japanese texts correctly. And it is used as the default language setting for the users. TODO: In the single user mode, POPFile's 'global' language setting should be equaled to the admin's setting. 3. Localized UI strings are now cached per user (session) UI/HTML.pm tests/TestHTML.tst All of the users shared the language cache till now. If a user changed the language setting, the cache will be updated, and affect the other users' UI. The user's cache will be cleared when the session is rleased. 4. The magnet tab always show the localized magnet types UI/HTML.pm skins/default/magnet-page.thtml 5. Cookie will be deleted when closing web browsers UI/HTML.pm I think there's no need to store the cookie for two weeks. 6. Removed almost all of the hardcoded user id 1 UI/HTML.pm Classifier/Bayes.pm POPFile/History.pm 7. Login page for the single user mode UI/HTML.pm skins/default/password-page.thtml languages/English.msg languages/Nihongo.msg If admin has a password, login page will be shown even in the single user mode 8. commit_history is called before the session key is released Classifier/Bayes.pm POPFile/History.pm Avoid the 'Invalid session key' error occuring when POPFile is updating the history. 9. Messages are now ordered by their types. POPFile/MQ.pm Messages are handled in following order: 1 CREAT 2 LOGIN 3 UIREG 4 COMIT 5 TICKD 6 RELSE In some case, COMIT had been processed before the session key is created by CREAT. This caused the 'Invalid session key' errors. 10. TestPOP3 is now passed tests/TestPOP3.tst tests/TestMailParse029.msg tests/TestMailParse029.cam tests/TestMailParse029.wrd 11. Fixed some tests to output their result correctly tests/TestBayesScript.tst tests/TestConfiguration.tst tests/TestHTTP.tst tests/TestInsertScript.tst tests/TestProxy.tst Current state of the test suite: TestBayesScript PASS TestBayes PASS TestConfiguration PASS * TestHistory fail * TestHTML PASS * TestHTTP PASS TestIMAP not tested yet TestInsertScript PASS * TestLogger PASS TestMailParse PASS TestModule PASS TestMQ PASS TestMutex PASS TestPipeScript PASS TestPOP3 PASS TestProxy PASS TestWordMangle PASS TestXMLRPC PASS (but child process does not terminate) * : needs to add tests for multi user support TODO 1. multi user mode tests are needed tests/TestConfiguration.tst tests/TestHistory.tst tests/TestHTML.tst tests/TestInsertScript.tst Index: HTML.pm =================================================================== RCS file: /cvsroot/popfile/engine/UI/HTML.pm,v retrieving revision 1.386 retrieving revision 1.387 diff -C2 -d -r1.386 -r1.387 *** HTML.pm 6 Apr 2008 08:27:08 -0000 1.386 --- HTML.pm 9 Apr 2008 17:20:47 -0000 1.387 *************** *** 186,189 **** --- 186,190 ---- $self->mq_register_( 'UIREG', $self ); $self->mq_register_( 'LOGIN', $self ); + $self->mq_register_( 'RELSE', $self ); $self->calculate_today(); *************** *** 216,234 **** # translated will still appear [...1097 lines suppressed...] *** 3970,3976 **** sub language { ! my ( $self ) = @_; ! return %{$self->{language__}}; } --- 3997,4007 ---- sub language { ! my ( $self, $session ) = @_; ! if ( defined($session) && defined($self->{language__}{$session}) ) { ! return $self->{language__}{$session}; ! } else { ! return $self->{language__}{global}; ! } } |