Don't ask for password if passed as argument

release-0.6
thomascube 16 years ago
parent 4b6dd1f1f3
commit 9787ca6063

@ -77,11 +77,14 @@ if (empty($args['user']))
} }
// prompt for password // prompt for password
echo "Password: "; if (empty($args['pass']))
$args['pass'] = trim(fgets(STDIN)); {
echo "Password: ";
$args['pass'] = trim(fgets(STDIN));
// clear password input // clear password input
echo chr(8)."\rPassword: ".str_repeat("*", strlen($args['pass']))."\n"; echo chr(8)."\rPassword: ".str_repeat("*", strlen($args['pass']))."\n";
}
// parse $host URL // parse $host URL
$a_host = parse_url($args['host']); $a_host = parse_url($args['host']);
@ -119,7 +122,7 @@ if ($IMAP->connect($host, $args['user'], $args['pass'], $imap_port, $imap_ssl))
if ($IMAP->save_message($args['mbox'], rtrim($message))) if ($IMAP->save_message($args['mbox'], rtrim($message)))
$count++; $count++;
else else
die("Failed to save message to $mailbox\n"); die("Failed to save message to {$args['mbox']}\n");
$message = ''; $message = '';
} }
continue; continue;
@ -134,7 +137,7 @@ if ($IMAP->connect($host, $args['user'], $args['pass'], $imap_port, $imap_ssl))
// upload message from file // upload message from file
if ($count) if ($count)
print "$count messages successfully added to $mailbox.\n"; print "$count messages successfully added to {$args['mbox']}.\n";
else else
print "Adding messages failed!\n"; print "Adding messages failed!\n";
} }

Loading…
Cancel
Save