From 1a1a4b32dd98cfd4bd96fd369a5e173a5457f9bd Mon Sep 17 00:00:00 2001 From: CausticKirbyZ Date: Wed, 11 Oct 2023 19:42:35 -0500 Subject: [PATCH] added some user prompts for imap. updated so the regex also is now case insensitive and searches for auth disable/disallowed --- src/spray_types/imap.cr | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/spray_types/imap.cr b/src/spray_types/imap.cr index def9465..0aa3b4f 100644 --- a/src/spray_types/imap.cr +++ b/src/spray_types/imap.cr @@ -77,20 +77,24 @@ class IMAP < Sprayer if i =~ /^tag OK/ resp << i break - elsif i =~ /^tag NO Authentication disabled/ + elsif i =~ /Authentication (disabled|disallowed)/i + STDERR.puts "\n(#{username}, #{password} , #{host}) - Authentication disabled/disallowed Try Using SSL/TLS(IMAPS)" raise "Use change to tls or try not using tls" - elsif i =~ /^tag NO Invalid credentials/ - raise "Invalid Credentials" - elsif i =~ /^tag NO/ - raise "Command error" - elsif i =~ /^tag BAD/ - raise "Unknown command or arguments invalid" + elsif i =~ /Invalid credentials/i + # raise "Invalid Credentials" + return false + elsif i =~ /^tag NO/i + STDERR.puts "\n(#{username}, #{password} , #{host}) - Command error: RESULT: #{i}" + raise "Command error: RESULT: #{i}" + elsif i =~ /^tag BAD/i + STDERR.puts "\n(#{username}, #{password} , #{host}) - Unknown command or arguments invalid: #{i}\n".colorize(:red) + raise "Unknown command or arguments invalid: #{i}" else resp << i end end - if resp.join(" ") =~ /LOGIN completed/ + if resp.join(" ") =~ /LOGIN completed/i return true end return false