X-Git-Url: http://git.maemo.org/git/?p=python-purple;a=blobdiff_plain;f=nullclient.py;h=d0fcb9baf46c40b566d289818e319c86349b2aa7;hp=375625fc30c55f52fde7570a93a3adfa6e352dac;hb=96cd4db66ee4749fb6d00e74e0bc9e3101e43079;hpb=f73c4168c56d09ed8a2e280d391d0ca094892056 diff --git a/nullclient.py b/nullclient.py index 375625f..d0fcb9b 100644 --- a/nullclient.py +++ b/nullclient.py @@ -1,4 +1,7 @@ import purple +import ecore +import getpass +import sys class NullClient: def __init__(self): @@ -21,12 +24,27 @@ class NullClient: self.account.set_password(password) self.account.set_enabled("carman-purple-python", True) + def get_buddies(self): + buddies = self.account.get_buddies_online() + print buddies + +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() - client.p.run_loop() + ecore.timer_add(20, client.get_buddies) + ecore.main_loop_begin()