Skip to content
Snippets Groups Projects
Commit 066605c3 authored by Nico's avatar Nico
Browse files

Use callback functions in api registration and login

parent ba2ce5e9
No related branches found
No related tags found
No related merge requests found
...@@ -16,16 +16,18 @@ class Api: ...@@ -16,16 +16,18 @@ class Api:
from os.path import isdir, join from os.path import isdir, join
return isdir(join(home, ".briar", "db")) return isdir(join(home, ".briar", "db"))
def login(self, password): def login(self, password, callback):
p = Popen(['java', '-jar', self.headless_jar, '-v'], p = Popen(['java', '-jar', self.headless_jar, '-v'],
stdin=PIPE, universal_newlines=True) stdin=PIPE, universal_newlines=True)
p.communicate(password + '\n') p.communicate(password + '\n')
callback()
def register(self, credentials): def register(self, credentials, callback):
p = Popen(['java', '-jar', self.headless_jar, '-v'], p = Popen(['java', '-jar', self.headless_jar, '-v'],
stdin=PIPE, universal_newlines=True) stdin=PIPE, universal_newlines=True)
p.communicate(credentials[0] + '\n' + credentials[1] + p.communicate(credentials[0] + '\n' + credentials[1] +
'\n' + credentials[1] + '\n') '\n' + credentials[1] + '\n')
callback()
def stop(self): def stop(self):
pass pass
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment