From 066605c33324a5f1352d021cd1b09ce0731b5a11 Mon Sep 17 00:00:00 2001
From: Nico Alt <nicoalt@posteo.org>
Date: Tue, 26 Mar 2019 00:20:08 +0100
Subject: [PATCH] Use callback functions in api registration and login

---
 src/briar/api/api.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/briar/api/api.py b/src/briar/api/api.py
index 21d60c5..97409fa 100644
--- a/src/briar/api/api.py
+++ b/src/briar/api/api.py
@@ -16,16 +16,18 @@ class Api:
         from os.path import isdir, join
         return isdir(join(home, ".briar", "db"))
 
-    def login(self, password):
+    def login(self, password, callback):
         p = Popen(['java', '-jar', self.headless_jar, '-v'],
                   stdin=PIPE, universal_newlines=True)
         p.communicate(password + '\n')
+        callback()
 
-    def register(self, credentials):
+    def register(self, credentials, callback):
         p = Popen(['java', '-jar', self.headless_jar, '-v'],
                   stdin=PIPE, universal_newlines=True)
         p.communicate(credentials[0] + '\n' + credentials[1] +
                       '\n' + credentials[1] + '\n')
+        callback()
 
     def stop(self):
         pass
-- 
GitLab