From 70c130d89a920abd9e3b9082d22ffd83b3d193b4 Mon Sep 17 00:00:00 2001 From: Ward Wouts Date: Fri, 28 Jan 2005 20:06:45 +0000 Subject: [PATCH] implement file inclusion --- trunk/ripnews/CHANGELOG | 5 +++-- trunk/ripnews/README | 3 ++- trunk/ripnews/TODO | 3 +-- trunk/ripnews/ripnews.rb | 18 ++++++++++++++++-- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/trunk/ripnews/CHANGELOG b/trunk/ripnews/CHANGELOG index f869b05..2011d53 100644 --- a/trunk/ripnews/CHANGELOG +++ b/trunk/ripnews/CHANGELOG @@ -1,11 +1,12 @@ -# $Dwarf: CHANGELOG,v 1.32 2004/10/14 21:51:26 ward Exp $ +# $Dwarf: CHANGELOG,v 1.33 2004/10/18 08:14:36 ward Exp $ # $Source$ from 0.2.3 to .... - changes to make it work with ruby 1.8.1 - internal structures changed in article.rb - - huge of memory usage improvements... e0 - 90% less memory usage + - huge of memory usage improvements... - 90% less memory usage - (more) gracefully handle bad yencodings + - enable file inclusion from 0.2.2 to 0.2.3 - notify when cachedir doesn't exist diff --git a/trunk/ripnews/README b/trunk/ripnews/README index 6317e1b..7072abd 100644 --- a/trunk/ripnews/README +++ b/trunk/ripnews/README @@ -1,4 +1,4 @@ -# $Dwarf: README,v 1.11 2003/06/25 07:30:58 ward Exp $ +# $Dwarf: README,v 1.12 2003/06/28 19:26:25 ward Exp $ # $Source$ Ripnews is a bulk downloader for usenet. It's quite flexible in terms of @@ -127,6 +127,7 @@ OPT_S= Set EXTENSIONS just for single part messages. DELEXT= Set extension "mark read" pattern. OPT_MD= Set DELEXT just for multi part messages. OPT_SD= Set DELEXT just for single part messages. +INCLUDEFILE= Include another file, only works in main config. Ruby patterns: -------------- diff --git a/trunk/ripnews/TODO b/trunk/ripnews/TODO index 450f8a8..726b21f 100644 --- a/trunk/ripnews/TODO +++ b/trunk/ripnews/TODO @@ -1,4 +1,4 @@ -# $Dwarf: TODO,v 1.25 2004/10/14 21:51:14 ward Exp $ +# $Dwarf: TODO,v 1.26 2005/01/04 12:19:37 ward Exp $ # $Source$ [ ] check for multiple servers (ip adresses) for each name and pick @@ -18,7 +18,6 @@ [ ] more regression tests [ ] update documentation [ ] start useing file locking (needed for safe threading) -[ ] implement include statement in config file [ ] implement "skip current article" signal handle [ ] add user/pass authentication [ ] optionaly save parts of incomplete posts diff --git a/trunk/ripnews/ripnews.rb b/trunk/ripnews/ripnews.rb index 6ccdc57..d4f1816 100755 --- a/trunk/ripnews/ripnews.rb +++ b/trunk/ripnews/ripnews.rb @@ -1,6 +1,6 @@ #!/usr/local/bin/ruby -w -# $Dwarf: ripnews.rb,v 1.84 2004/09/01 11:24:15 ward Exp $ +# $Dwarf: ripnews.rb,v 1.85 2004/10/14 11:47:37 ward Exp $ # $Source$ # @@ -192,6 +192,13 @@ def parse_config(default = {}) grouparr = [] config = {} + lines.collect!{|x| + if x =~ /^\s*INCLUDEFILE=(.*?)\s*$/i + x = File.new($1).readlines + end + x + } + lines.collect!{|x| x.sub!(/^\s*/, "") x.sub!(/\#.*$/, "") @@ -380,7 +387,14 @@ def get_multi(subj, group) print "filename #{filename}\n" return false unless check_ext(group, filename, "m", subj) print " YDecoding...\n" - mode, filename, body = YEnc.ydecode(body) + begin + mode, filename, body = YEnc.ydecode(body) + rescue YencError + # XXX if there is a yenc problem I want the data so I can research it + output_data(subj, 0600, "YencProblem", body) + # XXX return succes even though it's not true + return true + end else print " Unknown encoding (not UU, not yEnc), skipping...\n" return false