From 3846e0d7d177e5328c6650bc49d46a0497dceac2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Thu, 2 Dec 2010 13:00:10 +0100 Subject: Fix pythonism --- lib/feed2imap/config.rb | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/lib/feed2imap/config.rb b/lib/feed2imap/config.rb index 3e43292..b94ffc1 100644 --- a/lib/feed2imap/config.rb +++ b/lib/feed2imap/config.rb @@ -69,7 +69,7 @@ class F2IConfig @imap_accounts = ImapAccounts::new @maildir_account = MaildirAccount::new - @conf['feeds'].each &(push_feed @target.to_s) + @conf['feeds'].each { |f| push_feed @target.to_s, f } end def calc_target(global, new) @@ -85,22 +85,20 @@ class F2IConfig end end - def push_feed(target) - Proc.new do |f| - if f.has_key? 'group' - ftarget = calc_target(target, (f.has_key? 'target') ? f['target'].to_s : f['group'].to_s) - f['feeds'].each &(push_feed ftarget) - elsif f['disable'].nil? - ftarget = calc_target(target, (f.has_key? 'target') ? f['target'].to_s : f['name'].to_s) - uri = URI::parse(Array(ftarget).join('')) - path = URI::unescape(uri.path) - if uri.scheme == 'maildir' - @feeds.push(ConfigFeed::new(f, @maildir_account, path, self)) - else - # remove leading slash from IMAP mailbox names - path = path[1..-1] if path[0,1] == '/' - @feeds.push(ConfigFeed::new(f, @imap_accounts.add_account(uri), path, self)) - end + def push_feed(target, f) + if f.has_key? 'group' + ftarget = calc_target(target, (f.has_key? 'target') ? f['target'].to_s : f['group'].to_s) + f['feeds'].each { |f| push_feed ftarget, f} + elsif f['disable'].nil? + ftarget = calc_target(target, (f.has_key? 'target') ? f['target'].to_s : f['name'].to_s) + uri = URI::parse(Array(ftarget).join('')) + path = URI::unescape(uri.path) + if uri.scheme == 'maildir' + @feeds.push(ConfigFeed::new(f, @maildir_account, path, self)) + else + # remove leading slash from IMAP mailbox names + path = path[1..-1] if path[0,1] == '/' + @feeds.push(ConfigFeed::new(f, @imap_accounts.add_account(uri), path, self)) end end end -- cgit v1.2.3