From: Manni H. <man...@us...> - 2007-11-26 11:07:37
|
Update of /cvsroot/popfile/engine/Services In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9951/Services Modified Files: Tag: b0_22_2 IMAP.pm Log Message: Add yet more tests and make the module disconnect when the connection options are changed so that the changes will take immediate effect. Index: IMAP.pm =================================================================== RCS file: /cvsroot/popfile/engine/Services/IMAP.pm,v retrieving revision 1.9.4.13 retrieving revision 1.9.4.14 diff -C2 -d -r1.9.4.13 -r1.9.4.14 *** IMAP.pm 25 Nov 2007 12:07:52 -0000 1.9.4.13 --- IMAP.pm 26 Nov 2007 11:07:37 -0000 1.9.4.14 *************** *** 1499,1505 **** if ( defined $form->{update_imap_0_connection_details} ) { ! if ( $form->{imap_hostname} ne '' ) { $templ->param( IMAP_connection_if_hostname_error => 0 ); ! $self->config_( 'hostname', $form->{imap_hostname} ); } else { --- 1499,1510 ---- if ( defined $form->{update_imap_0_connection_details} ) { ! my $something_changed = undef; ! ! if ( $form->{imap_hostname} ) { $templ->param( IMAP_connection_if_hostname_error => 0 ); ! if ( $self->config_( 'hostname' ) ne $form->{imap_hostname} ) { ! $self->config_( 'hostname', $form->{imap_hostname} ); ! $something_changed = 1; ! } } else { *************** *** 1507,1512 **** } ! if ( $form->{imap_port} >= 1 && $form->{imap_port} < 65536 ) { ! $self->config_( 'port', $form->{imap_port} ); $templ->param( IMAP_connection_if_port_error => 0 ); } --- 1512,1520 ---- } ! if ( $form->{imap_port} && $form->{imap_port} =~ m/^\d+$/ && $form->{imap_port} >= 1 && $form->{imap_port} < 65536 ) { ! if ( $self->config_( 'port' ) != $form->{imap_port} ) { ! $self->config_( 'port', $form->{imap_port} ); ! $something_changed = 1; ! } $templ->param( IMAP_connection_if_port_error => 0 ); } *************** *** 1515,1520 **** } ! if ( $form->{imap_login} ne '' ) { ! $self->config_( 'login', $form->{imap_login} ); $templ->param( IMAP_connection_if_login_error => 0 ); } --- 1523,1531 ---- } ! if ( $form->{imap_login} ) { ! if ( $self->config_( 'login' ) ne $form->{imap_login} ) { ! $self->config_( 'login', $form->{imap_login} ); ! $something_changed = 1; ! } $templ->param( IMAP_connection_if_login_error => 0 ); } *************** *** 1523,1528 **** } ! if ( $form->{imap_password} ne '' ) { ! $self->config_( 'password', $form->{imap_password} ); $templ->param( IMAP_connection_if_password_error => 0 ); } --- 1534,1542 ---- } ! if ( $form->{imap_password} ) { ! if ( $self->config_( 'password' ) ne $form->{imap_password} ) { ! $self->config_( 'password', $form->{imap_password} ); ! $something_changed = 1; ! } $templ->param( IMAP_connection_if_password_error => 0 ); } *************** *** 1531,1541 **** --- 1545,1570 ---- } + my $use_ssl_now = $self->config_( 'use_ssl' ); + if ( $form->{imap_use_ssl} ) { $self->config_( 'use_ssl', 1 ); + if ( ! $use_ssl_now ) { + $something_changed = 1; + } } else { $self->config_( 'use_ssl', 0 ); + if ( $use_ssl_now ) { + $something_changed = 1; + } + } + + if ( $something_changed ) { + $self->log_( 1, 'Configuration has changed. Terminating any old connections.' ); + $self->disconnect_folders__(); } } + + return; } |