}
+sub new_link {
+ my ( $self, $data ) = @_;
+
+ warn "# new_link ",dump $data;
+
+ if ( $data->{file} =~ m{^(.*/?)\.send/([^/]+)/(.+)} ) {
+ my ( $dir, $to, $name ) = ( $1, $2, $3 );
+ my $path = "users/$data->{login}/blob/" . $data->{file};
+ my $file = readlink $path;
+ if ( $file =~ s{^\Q/rsyncd-munged/../../\E}{$dir} ) {
+ warn "SEND To:$to Name:$name File:$file\n";
+ my $s = "users/$data->{login}/blob/$file";
+ my $d = "users/$to/blob/$name";
+ link $s, $d;
+ warn "link $s -> $d\n";
+ } else {
+ warn "ERROR: can't SEND To:$to Name:$name File:$file";
+ }
+ }
+}
+
sub transfer {
my ( $self,$data ) = @_;
my $blob = "users/$data->{login}/blob";
my $path = "$blob/$data->{file}";
- if ( $data->{itemize} =~ m/^[c>]([fd])/ ) { # received change/create
+ if ( $data->{itemize} =~ m/^[c>]([fdL])/ ) { # received change/create
my $type = $1;
if ( $type eq 'f' ) {
$self->dedup( $data, $path );
} elsif ( $type eq 'd' ) {
$self->make_dir( $data );
+ } elsif ( $type eq 'L' ) {
+ $self->new_link( $data );
} else {
die "unknown type $type ", dump $data;
}