From: Sam S. <ssc...@us...> - 2005-02-20 10:06:11
|
Update of /cvsroot/popfile/engine/Proxy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24865/Proxy Modified Files: Proxy.pm POP3.pm Log Message: Begin refactoring HTML UI "status" and "error" messages to use the new status_message__ and error_message__ functions. Progress: Admin page complete. POP3 widget(s) complete. validate_item now returns ($status, $error), both strings, indicating a status or error string to print to the UI. Index: POP3.pm =================================================================== RCS file: /cvsroot/popfile/engine/Proxy/POP3.pm,v retrieving revision 1.106 retrieving revision 1.107 diff -C2 -d -r1.106 -r1.107 *** POP3.pm 27 Dec 2004 16:51:28 -0000 1.106 --- POP3.pm 20 Feb 2005 10:06:02 -0000 1.107 *************** *** 505,509 **** if ( $response == 0 ) { $self->echo_to_dot_( $mail, $client ); ! } } --- 505,509 ---- if ( $response == 0 ) { $self->echo_to_dot_( $mail, $client ); ! } } *************** *** 524,528 **** if ( $response == 0 ) { $self->echo_to_dot_( $mail, $client ); ! } } else { next; --- 524,528 ---- if ( $response == 0 ) { $self->echo_to_dot_( $mail, $client ); ! } } else { next; *************** *** 692,702 **** if ( $name eq 'pop3_security' ) { $templ->param( 'POP3_Security_Local' => ( $self->config_( 'local' ) == 1 ) ); ! } else { ! if ( $name eq 'pop3_chain' ) { $templ->param( 'POP3_Chain_Secure_Server' => $self->config_( 'secure_server' ) ); $templ->param( 'POP3_Chain_Secure_Port' => $self->config_( 'secure_port' ) ); ! } else { $self->SUPER::configure_item( $name, $templ, $language ); ! } } } --- 692,702 ---- if ( $name eq 'pop3_security' ) { $templ->param( 'POP3_Security_Local' => ( $self->config_( 'local' ) == 1 ) ); ! } else { ! if ( $name eq 'pop3_chain' ) { $templ->param( 'POP3_Chain_Secure_Server' => $self->config_( 'secure_server' ) ); $templ->param( 'POP3_Chain_Secure_Port' => $self->config_( 'secure_port' ) ); ! } else { $self->SUPER::configure_item( $name, $templ, $language ); ! } } } *************** *** 719,730 **** my ( $self, $name, $templ, $language, $form ) = @_; if ( $name eq 'pop3_configuration' ) { if ( defined($$form{pop3_port}) ) { if ( ( $$form{pop3_port} >= 1 ) && ( $$form{pop3_port} < 65536 ) ) { $self->config_( 'port', $$form{pop3_port} ); ! $templ->param( 'POP3_Configuration_If_Port_Updated' => 1 ); ! $templ->param( 'POP3_Configuration_Port_Updated' => sprintf( $$language{Configuration_POP3Update}, $self->config_( 'port' ) ) ); } else { ! $templ->param( 'POP3_Configuration_If_Port_Error' => 1 ); } } --- 719,731 ---- my ( $self, $name, $templ, $language, $form ) = @_; + my ($status_message,$error_message); + if ( $name eq 'pop3_configuration' ) { if ( defined($$form{pop3_port}) ) { if ( ( $$form{pop3_port} >= 1 ) && ( $$form{pop3_port} < 65536 ) ) { $self->config_( 'port', $$form{pop3_port} ); ! $status_message = sprintf( $$language{Configuration_POP3Update}, $self->config_( 'port' ) ); } else { ! $error_message .= $$language{Configuration_Error3}; } } *************** *** 733,740 **** if ( length($$form{pop3_separator}) == 1 ) { $self->config_( 'separator', $$form{pop3_separator} ); ! $templ->param( 'POP3_Configuration_If_Sep_Updated' => 1 ); ! $templ->param( 'POP3_Configuration_Sep_Updated' => sprintf( $$language{Configuration_POP3SepUpdate}, $self->config_( 'separator' ) ) ); } else { ! $templ->param( 'POP3_Configuration_If_Sep_Error' => 1 ); } } --- 734,742 ---- if ( length($$form{pop3_separator}) == 1 ) { $self->config_( 'separator', $$form{pop3_separator} ); ! $status_message .= "\n" if ( defined( $status_message ) ); ! $status_message .= sprintf( $$language{Configuration_POP3SepUpdate}, $self->config_( 'separator' ) ) } else { ! $error_message .= "\n" if ( defined( $error_message ) ); ! $error_message .= $$language{Configuration_Error1}; } } *************** *** 744,748 **** } ! return; } --- 746,750 ---- } ! return($status_message, $error_message); } *************** *** 750,754 **** $self->config_( 'local', $$form{pop3_local}-1 ) if ( defined($$form{pop3_local}) ); ! return; } --- 752,756 ---- $self->config_( 'local', $$form{pop3_local}-1 ) if ( defined($$form{pop3_local}) ); ! return(undef, undef); } *************** *** 756,777 **** if ( defined( $$form{server} ) ) { $self->config_( 'secure_server', $$form{server} ); ! $templ->param( 'POP3_Chain_If_Server_Updated' => 1 ); ! $templ->param( 'POP3_Chain_Server_Updated' => sprintf( $$language{Security_SecureServerUpdate}, $self->config_( 'secure_server' ) ) ); ! } if ( defined($$form{sport}) ) { if ( ( $$form{sport} >= 1 ) && ( $$form{sport} < 65536 ) ) { $self->config_( 'secure_port', $$form{sport} ); ! $templ->param( 'POP3_Chain_If_Port_Updated' => 1 ); ! $templ->param( 'POP3_Chain_Port_Updated' => sprintf( $$language{Security_SecurePortUpdate}, $self->config_( 'secure_port' ) ) ); } else { ! $templ->param( 'POP3_Chain_If_Port_Error' => 1 ); } } ! return; } ! $self->SUPER::validate_item( $name, $templ, $language, $form ); } --- 758,777 ---- if ( defined( $$form{server} ) ) { $self->config_( 'secure_server', $$form{server} ); ! $status_message .= sprintf( $$language{Security_SecureServerUpdate}, $self->config_( 'secure_server' ) ); ! } if ( defined($$form{sport}) ) { if ( ( $$form{sport} >= 1 ) && ( $$form{sport} < 65536 ) ) { $self->config_( 'secure_port', $$form{sport} ); ! $status_message .= sprintf( $$language{Security_SecurePortUpdate}, $self->config_( 'secure_port' ) ); } else { ! $error_message .= $$language{Security_Error1}; } } ! return( $status_message, $error_message ); } ! return $self->SUPER::validate_item( $name, $templ, $language, $form ); } Index: Proxy.pm =================================================================== RCS file: /cvsroot/popfile/engine/Proxy/Proxy.pm,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** Proxy.pm 4 Jan 2005 22:50:57 -0000 1.56 --- Proxy.pm 20 Feb 2005 10:06:01 -0000 1.57 *************** *** 223,227 **** $self->{api_session__} = $self->classifier_()->get_session_key( 'admin', '' ); ! } # Check that this is a connection from the local machine, --- 223,227 ---- $self->{api_session__} = $self->classifier_()->get_session_key( 'admin', '' ); ! } # Check that this is a connection from the local machine, *************** *** 256,260 **** } } ! } else { pipe my $reader, my $writer; --- 256,260 ---- } } ! } else { pipe my $reader, my $writer; *************** *** 340,346 **** } ! if ( $line =~ $regexp ) { last; ! } } } --- 340,346 ---- } ! if ( $line =~ $regexp ) { last; ! } } } *************** *** 458,462 **** if ( $response =~ /$self->{good_response_}/ ) { return 0; ! } else { return 1; } --- 458,462 ---- if ( $response =~ /$self->{good_response_}/ ) { return 0; ! } else { return 1; } *************** *** 506,510 **** PeerAddr => $hostname, PeerPort => $port ); # PROFILE BLOCK STOP ! } else { $mail = IO::Socket::INET->new( # PROFILE BLOCK START Proto => "tcp", --- 506,510 ---- PeerAddr => $hostname, PeerPort => $port ); # PROFILE BLOCK STOP ! } else { $mail = IO::Socket::INET->new( # PROFILE BLOCK START Proto => "tcp", *************** *** 525,529 **** if ( !$ssl ) { binmode( $mail ); ! } # Wait 10 seconds for a response from the remote server and if --- 525,529 ---- if ( !$ssl ) { binmode( $mail ); ! } # Wait 10 seconds for a response from the remote server and if *************** *** 604,608 **** # $form Hash containing all form items # - # Must return the HTML for this item # ---------------------------------------------------------------------------- sub validate_item --- 604,607 ---- *************** *** 612,622 **** my $me = $self->name(); if ( defined($$form{"$me" . "_socks_port"}) ) { if ( ( $$form{"$me" . "_socks_port"} >= 1 ) && ( $$form{"$me" . "_socks_port"} < 65536 ) ) { $self->config_( 'socks_port', $$form{"$me" . "_socks_port"} ); ! $templ->param( 'Socks_Widget_If_Port_Updated' => 1 ); ! $templ->param( 'Socks_Widget_Port_Updated' => sprintf( $$language{Configuration_SOCKSPortUpdate}, $self->config_( 'socks_port' ) ) ); } else { ! $templ->param( 'Socks_Widget_If_Port_Error' => 1 ); } } --- 611,622 ---- my $me = $self->name(); + my ($status, $error); + if ( defined($$form{"$me" . "_socks_port"}) ) { if ( ( $$form{"$me" . "_socks_port"} >= 1 ) && ( $$form{"$me" . "_socks_port"} < 65536 ) ) { $self->config_( 'socks_port', $$form{"$me" . "_socks_port"} ); ! $status = sprintf( $$language{Configuration_SOCKSPortUpdate}, $self->config_( 'socks_port' ) ); } else { ! $error = $$language{Configuration_Error8}; } } *************** *** 624,630 **** if ( defined($$form{"$me" . "_socks_server"}) ) { $self->config_( 'socks_server', $$form{"$me" . "_socks_server"} ); ! $templ->param( 'Socks_Widget_If_Server_Updated' => 1 ); ! $templ->param( 'Socks_Widget_Server_Updated' => sprintf( $$language{Configuration_SOCKSServerUpdate}, $self->config_( 'socks_server' ) ) ); } } --- 624,632 ---- if ( defined($$form{"$me" . "_socks_server"}) ) { $self->config_( 'socks_server', $$form{"$me" . "_socks_server"} ); ! $status .= "\n" if (defined $status); ! $status .= sprintf( $$language{Configuration_SOCKSServerUpdate}, $self->config_( 'socks_server' ) ); } + + return( $status, $error ); } |