1
0
mirror of https://github.com/imapsync/imapsync.git synced 2024-11-17 00:02:29 +01:00

created subscibe function to use from create_folder and create_folder_old, also removed subscribe from FOLDER method

This commit is contained in:
Sági György 2020-09-04 16:26:49 +02:00
parent 1709fee78f
commit ad0c0ef6e2

View File

@ -2127,12 +2127,12 @@ FOLDER: foreach my $h1_fold ( @{ $sync->{h1_folders_wanted} } )
}
}
if ( ( ( $subscribe and exists $h1_subscribed_folder{ $h1_fold } ) or $subscribeall )
and not exists $h2_subscribed_folder{ $h2_fold } )
{
myprint( "Host2: Subscribing to folder $h2_fold\n" ) ;
if ( ! $sync->{dry} ) { $sync->{imap2}->subscribe( $h2_fold ) } ;
}
#if ( ( ( $subscribe and exists $h1_subscribed_folder{ $h1_fold } ) or $subscribeall )
# and not exists $h2_subscribed_folder{ $h2_fold } )
#{
# myprint( "Host2: Subscribing to folder $h2_fold\n" ) ;
# if ( ! $sync->{dry} ) { $sync->{imap2}->subscribe( $h2_fold ) } ;
#}
next FOLDER if ( $sync->{ justfolders } ) ;
@ -7506,6 +7506,8 @@ sub create_folder_old
}else{
#create succeeded
myprint( "Created ( the old way ) folder [$h2_fold] on host2\n" ) ;
subscribe_to_folder($mysync, $imap, $h2_fold, $h1_fold);
return( 1 ) ;
}
}else{
@ -7569,6 +7571,8 @@ sub create_folder
}else{
#create succeeded
myprint( "Created folder [$h2_fold] on host2\n" ) ;
subscribe_to_folder($mysync, $myimap2, $h2_fold, $h1_fold);
return( 1 ) ;
}
}else{
@ -7582,6 +7586,21 @@ sub create_folder
}
}
# Subscribe to folder sub
# arguments: $mysync, $myimap2, $subscribed_h2_fold, $h1_fold
sub subscribe_to_folder
{
my $mysync = shift @ARG ;
my( $myimap2 , $subscribed_h2_fold, $h1_fold ) = @ARG ;
if ( ( ( $subscribe and exists $h1_subscribed_folder{ $h1_fold } ) or $subscribeall )
and not exists $h2_subscribed_folder{ $subscribed_h2_fold } )
{
myprint( "Host2: Subscribing to folder $subscribed_h2_fold\n" ) ;
if ( ! $mysync->{dry} ) { $myimap2->subscribe( $subscribed_h2_fold ) } ;
}
}
sub tests_folder_routines