lib/client.rb in navi_client-1.3.4 vs lib/client.rb in navi_client-1.3.5

- old
+ new

@@ -43,11 +43,11 @@ capabilities = imap.capability @logger.debug("imap capabilities: #{capabilities.join(',')}") if @debug if @client_type == 'local' - unless capabilities.include? "IDLE" + unless capabilities.include? "IDLE" && @debug @logger.info "'IDLE' IMAP capability not available in server: #{server}" imap.disconnect exit end end @@ -83,16 +83,18 @@ meta_dir = @download_path + 'meta/' message_ids_saved = File.directory?(meta_dir) ? (Dir.entries meta_dir).map { |i| i.split("_").first.to_i } : [] message_ids = message_ids - message_ids_saved - if message_ids.empty? - @logger.info "No new emails found..." - elsif message_ids_saved.any? - @logger.info "Found emails saved in your #{@client_type}. Downloading only #{message_ids.count} new emails..." - else - @logger.info "Downloading #{message_ids.count} emails." + if @debug + if message_ids.empty? + @logger.info "No new emails found..." + elsif message_ids_saved.any? + @logger.info "Found emails saved in your #{@client_type}. Downloading only #{message_ids.count} new emails..." + else + @logger.info "Downloading #{message_ids.count} emails." + end end message_ids.each_with_index do |message_id, i| # fetch all the email contents data = imap.uid_fetch(message_id, "RFC822") @@ -208,11 +210,13 @@ rescue true end else - @logger.info "Logging to Loggly disabled" - @logger.info messageBody + if @debug + @logger.info "Logging to Loggly disabled" + @logger.info messageBody + end end end def setupLoggly(tag)