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