diff options
Diffstat (limited to 'lib/feed2imap')
-rw-r--r-- | lib/feed2imap/config.rb | 1 | ||||
-rw-r--r-- | lib/feed2imap/imap.rb | 8 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/feed2imap/config.rb b/lib/feed2imap/config.rb index a9c796c..53e6543 100644 --- a/lib/feed2imap/config.rb +++ b/lib/feed2imap/config.rb @@ -47,6 +47,7 @@ class F2IConfig @updateddebug = (@conf['debug-updated'] and @conf['debug-updated'] != 'false') @include_images = (@conf['include-images'] and @conf['include-images'] != 'false') @default_email = (@conf['default-email'] || "#{LOGNAME}@#{HOSTNAME}") + ImapAccount.no_ssl_verify = (@conf['disable-ssl-verification'] and @conf['disable-ssl-verification'] != 'false') @hostname = HOSTNAME # FIXME: should this be configurable as well? @imap_accounts = ImapAccounts::new maildir_account = MaildirAccount::new diff --git a/lib/feed2imap/imap.rb b/lib/feed2imap/imap.rb index 6840c11..c4e7106 100644 --- a/lib/feed2imap/imap.rb +++ b/lib/feed2imap/imap.rb @@ -30,6 +30,7 @@ require 'uri' # using the same IMAP account will create only one # IMAP connection. class ImapAccounts < Hash + def add_account(uri) u = URI::Generic::build({ :scheme => uri.scheme, :userinfo => uri.userinfo, @@ -48,6 +49,11 @@ end class ImapAccount attr_reader :uri + @@no_ssl_verify = false + def ImapAccount::no_ssl_verify=(v) + @@no_ssl_verify = v + end + def initialize(uri) @uri = uri @existing_folders = [] @@ -70,7 +76,7 @@ class ImapAccount end # use given port if port given port = uri.port if uri.port - @connection = Net::IMAP::new(uri.host, port, usessl) + @connection = Net::IMAP::new(uri.host, port, usessl, nil, !@@no_ssl_verify) user, password = URI::unescape(uri.userinfo).split(':',2) @connection.login(user, password) self |