From 7875a5e5e9f90b84fb2893adb2ac779f61e85668 Mon Sep 17 00:00:00 2001 From: Ragner Magalhaes Date: Tue, 2 Dec 2008 20:17:50 +0000 Subject: [PATCH] Add support to console's input to nullclient.py Allow user input name and password to nullclient.py Signed-off-by: Ragner Magalhaes git-svn-id: https://garage.maemo.org/svn/carman/branches/carman-0.7-beta2/python-purple@1291 596f6dd7-e928-0410-a184-9e12fd12cf7e --- nullclient.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/nullclient.py b/nullclient.py index 93fd270..c9e1953 100644 --- a/nullclient.py +++ b/nullclient.py @@ -1,5 +1,7 @@ import purple import ecore +import getpass +import sys class NullClient: def __init__(self): @@ -22,12 +24,22 @@ class NullClient: self.account.set_password(password) self.account.set_enabled("carman-purple-python", True) +def getuser(): + sys.stdout.write("GTalk account: ") + username = sys.stdin.readline() + return username[:-1] + +def getpassword(): + return getpass.getpass() + if __name__ == '__main__': client = NullClient() client.execute() client.set_protocol("XMPP") - client.new_account("seu_email@email.com", client.protocol,"sua_senha_aqui") + username = getuser() + password = getpassword() + client.new_account(username, client.protocol, password) client.p.connect() ecore.main_loop_begin() -- 1.7.9.5