def status_changed_cb(state, reason):
    global registered

    if state == CONNECTION_STATUS_CONNECTED:
        print 'registered'
        registered = True
        conn[CONN_INTERFACE].Disconnect()
    elif state == CONNECTION_STATUS_DISCONNECTED:
        if not registered:
            print 'failed (reason %d)' % reason

        loop.quit()


if __name__ == '__main__':
    manager, protocol, account = read_account(sys.argv[1])
    account['register'] = True
    conn = connect(manager, protocol, account)
    conn[CONN_INTERFACE].connect_to_signal('StatusChanged', status_changed_cb)

    print 'connecting'
    conn[CONN_INTERFACE].Connect()
    loop = gobject.MainLoop()
    loop.run()

    try:
        conn[CONN_INTERFACE].Disconnect()
    except:
        pass
예제 #2
0
def status_changed_cb(state, reason):
    global registered

    if state == CONNECTION_STATUS_CONNECTED:
        print('registered')
        registered = True
        conn[CONN_INTERFACE].Disconnect()
    elif state == CONNECTION_STATUS_DISCONNECTED:
        if not registered:
            print('failed (reason %d)' % reason)

        loop.quit()

if __name__ == '__main__':
    manager, protocol, account = read_account(sys.argv[1])
    account['register'] = True
    conn = connect(manager, protocol, account)
    conn[CONN_INTERFACE].connect_to_signal('StatusChanged', status_changed_cb)

    print('connecting')
    conn[CONN_INTERFACE].Connect()
    loop = gobject.MainLoop()
    loop.run()

    try:
        conn[CONN_INTERFACE].Disconnect()
    except:
        pass

예제 #3
0
 else:
    # set up storage
    need_storage_setup = True
    
    
 config['volume_pubkey_pem'] = existing_volume_pubkey_pem
 
 # set up local storage
 if need_storage_setup:
    rc = storage.setup_local_storage( account.LOCAL_STORAGE_ROOT, [] )
    if not rc:
       do_logout( config )
       raise Exception("Failed to set up local storage")
 
 # get account info
 account_info = account.read_account( password, email )
 if account_info is None:
    do_logout( config )
    raise Exception("Failed to read account information.")
 
 gateway_name = account_info.gateway_name
 gateway_port = account_info.gateway_port
 gateway_privkey_pem = account_info.gateway_privkey_pem
 volume_pubkey_pem = account_info.volume_pubkey_pem
 
 # load the Volume
 volume = Volume( gateway_name=gateway_name,
                  gateway_port=gateway_port,
                  ms_url=parsed_email.MS,
                  my_key_str=gateway_privkey_pem,
                  volume_key_pem=volume_pubkey_pem,   # FIXME: volume_pubkey_pem consistent naming