mirror of
				https://github.com/fabianonline/telegram_backup.git
				synced 2025-11-04 01:27:47 +00:00 
			
		
		
		
	WIP: Some more rewriting.
This commit is contained in:
		@@ -78,6 +78,10 @@ class CommandLineController {
 | 
				
			|||||||
			Utils.print_accounts(target_dir)
 | 
								Utils.print_accounts(target_dir)
 | 
				
			||||||
			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 {
 | 
				
			||||||
@@ -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()
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user