ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Convert-UUlib/example-decoder
(Generate patch)

Comparing Convert-UUlib/example-decoder (file contents):
Revision 1.3 by root, Sun Mar 31 21:42:36 2002 UTC vs.
Revision 1.6 by root, Mon Aug 19 23:25:34 2002 UTC

18 0; 18 0;
19} 19}
20 20
21SetOption (OPT_IGNMODE, 1); 21SetOption (OPT_IGNMODE, 1);
22SetOption (OPT_VERBOSE, 1); 22SetOption (OPT_VERBOSE, 1);
23#SetOption (OPT_DOTDOT, 1);
23 24
24# show the three ways you can set callback functions 25# show the three ways you can set callback functions
25SetFNameFilter (\&namefilter); 26SetFNameFilter (\&namefilter);
26 27
27SetBusyCallback ("busycb",333); 28SetBusyCallback ("busycb",333);
31 print uc(strmsglevel($_[1])),": $msg\n"; 32 print uc(strmsglevel($_[1])),": $msg\n";
32}); 33});
33 34
34SetFileNameCallback sub { 35SetFileNameCallback sub {
35 return unless $_[1]; # skip "Re:"-plies et al. 36 return unless $_[1]; # skip "Re:"-plies et al.
36 my ($subject, $filename) = @_; 37 local $_ = $_[0];
38
39 # the following rules are rather effective on some newsgroups,
40 # like alt.binaries.games.anime, where non-mime, uuencoded data
41 # is very common
42
37 ## if we find some *.rar, take it 43 # if we find some *.rar, take it
38 return $1 if $subject =~ /(\S+\.(?:[rstuvwxyz]\d\d|rar))\s/i; 44 return $1 if /(\S+\.(?:[rstuvwxyz]\d\d|rar))\s/i;
45
46 # - filename.par (04/55)
47 return $1 if /- "?(\S+\.\S+?)"? (:yenc )?\(\d+\/\d+\)/i;
48
49 return $1 if /No\.[ 0-9]+ (\S+\....) (?:\d+ bytes )?\[/;
50
39 # otherwise just pass what we have 51 # otherwise just pass what we have
40 return (); 52 return ();
41}; 53};
42 54
43 55
68 print "$k > $v, "; 80 print "$k > $v, ";
69 } 81 }
70 print "\n"; 82 print "\n";
71 } 83 }
72 84
85 if ($uu->state & FILE_OK) {
73 print strerror($uu->decode_temp)."\n"; 86 print strerror($uu->decode_temp)."\n";
74 print " temporarily decoded to ",$uu->binfile,"\n"; 87 print " temporarily decoded to ",$uu->binfile,"\n";
75 $uu->remove_temp; 88 $uu->remove_temp;
76 89
77 print strerror($uu->decode)."\n"; 90 print strerror($uu->decode)."\n";
78 print " saved as uudst/",$uu->filename,"\n"; 91 print " saved as uudst/",$uu->filename,"\n";
92 } else {
93 print "file NOT ok, not decoding\n";
94 }
79} 95}
80 96
81print "cleanup...\n"; 97print "cleanup...\n";
82 98
83CleanUp(); 99CleanUp();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines