mirror of
https://github.com/fabianonline/telegram_backup.git
synced 2024-11-22 08:46:15 +00:00
WIP: Some more rewriting.
This commit is contained in:
parent
97cf26b46d
commit
2d409352bc
@ -79,6 +79,10 @@ class CommandLineController {
|
||||
System.exit(0)
|
||||
}
|
||||
|
||||
if (CommandLineOptions.cmd_login) {
|
||||
cmd_login(target_dir, CommandLineOptions.val_account)
|
||||
}
|
||||
|
||||
logger.trace("Checking accounts")
|
||||
try {
|
||||
phone_number = selectAccount(target_dir, CommandLineOptions.val_account)
|
||||
@ -86,7 +90,7 @@ class CommandLineController {
|
||||
show_error("The specified account could not be found.")
|
||||
} catch(e: NoAccountsException) {
|
||||
println("No accounts found. Starting login process...")
|
||||
CommandLineOptions.cmd_login = true
|
||||
cmd_login(target_dir, CommandLineOptions.val_account)
|
||||
}
|
||||
|
||||
file_base = target_dir + File.separatorChar + account_to_use
|
||||
@ -273,9 +277,7 @@ class CommandLineController {
|
||||
}
|
||||
}
|
||||
|
||||
@Throws(RpcErrorException::class, IOException::class)
|
||||
private fun cmd_login(phoneToUse: String?) {
|
||||
val user = UserManager.getInstance()
|
||||
private fun cmd_login(target_dir: String, phoneToUse: String?): Nothing {
|
||||
val phone: String
|
||||
if (phoneToUse == null) {
|
||||
println("Please enter your phone number in international format.")
|
||||
@ -284,6 +286,7 @@ class CommandLineController {
|
||||
} else {
|
||||
phone = phoneToUse
|
||||
}
|
||||
|
||||
user.sendCodeToPhoneNumber(phone)
|
||||
println("Telegram sent you a code. Please enter it here.")
|
||||
val code = getLine()
|
||||
|
Loading…
Reference in New Issue
Block a user