Author: sparky
Date: Wed Jul 28 15:22:30 2010
New Revision: 11719

Modified:
   toys/rsget.pl/RSGet/FileList.pm
Log:
- added list_link_new and list_link_failed callbacks


Modified: toys/rsget.pl/RSGet/FileList.pm
==============================================================================
--- toys/rsget.pl/RSGet/FileList.pm     (original)
+++ toys/rsget.pl/RSGet/FileList.pm     Wed Jul 28 15:22:30 2010
@@ -7,10 +7,11 @@
 
 use strict;
 use warnings;
+use RSGet::Tools;
+use RSGet::Hook;
 use URI::Escape;
 use Fcntl qw(:DEFAULT :flock SEEK_SET);
 use IO::Handle;
-use RSGet::Tools;
 set_rev qq$Id$;
 
 def_settings(
@@ -26,7 +27,15 @@
                allowed => qr/.+/,
                type => "PATH",
                user => 1,
-       }
+       },
+       list_link_new => {
+               desc => "Command executed after adding new link directly to the 
list.",
+               type => "COMMAND",
+       },
+       list_link_failed => {
+               desc => "Command executed if link wasn't recognized.",
+               type => "COMMAND",
+       },
 );
 
 my $file;
@@ -292,11 +301,25 @@
                                        $opt->{getter} = $getter->{pkg};
                                        $decoded{ $newuri } = [ $getter, $opt ];
                                        delete $decoded{ $uri } if $newuri ne 
$uri;
+
+                                       if ( my $call = setting( 
"list_link_new" ) ) {
+                                               RSGet::Hook::call( $call,
+                                                       uri => $uri,
+                                                       newuri => $newuri,
+                                                       getter => 
$getter->{pkg},
+                                               );
+                                       }
                                } else {
                                        my $line = "# invalid uri: $uri " . 
(join " ", h2a( $opt ));
                                        push @new, $line . "\n";
                                        push @actual, $line;
                                        delete $decoded{ $uri };
+
+                                       if ( my $call = setting( 
"list_link_failed" ) ) {
+                                               RSGet::Hook::call( $call,
+                                                       uri => $uri,
+                                               );
+                                       }
                                }
                        }
                }
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to