From 69f5087c718cc534a969fcba0fcb35812c88ad8b Mon Sep 17 00:00:00 2001
From: drebs <drebs@leap.se>
Date: Mon, 14 Jul 2014 20:01:01 -0300
Subject: Add encrypted field to sync db (#5895).

---
 client/src/leap/soledad/client/crypto.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

(limited to 'client/src')

diff --git a/client/src/leap/soledad/client/crypto.py b/client/src/leap/soledad/client/crypto.py
index 7133f804..89220860 100644
--- a/client/src/leap/soledad/client/crypto.py
+++ b/client/src/leap/soledad/client/crypto.py
@@ -691,7 +691,7 @@ class SyncDecrypterPool(SyncEncryptDecryptPool):
     """
     # TODO implement throttling to reduce cpu usage??
     TABLE_NAME = "docs_received"
-    FIELD_NAMES = "doc_id, rev, content, gen, trans_id"
+    FIELD_NAMES = "doc_id, rev, content, gen, trans_id, encrypted"
 
     write_encrypted_lock = threading.Lock()
 
@@ -733,13 +733,15 @@ class SyncDecrypterPool(SyncEncryptDecryptPool):
         :type trans_id: str
         """
         docstr = json.dumps(content)
-        sql_ins = "INSERT INTO '%s' VALUES (?, ?, ?, ?, ?)" % (
+        sql_ins = "INSERT INTO '%s' VALUES (?, ?, ?, ?, ?, ?)" % (
             self.TABLE_NAME,)
 
         con = self._sync_db
         with self._sync_db_write_lock:
             with con:
-                con.execute(sql_ins, (doc_id, doc_rev, docstr, gen, trans_id))
+                con.execute(
+                    sql_ins,
+                    (doc_id, doc_rev, docstr, gen, trans_id, 1))
 
     def insert_marker_for_received_doc(self, doc_id, doc_rev, gen):
         """
@@ -757,12 +759,12 @@ class SyncDecrypterPool(SyncEncryptDecryptPool):
         :param gen: the Document Generation
         :type gen: int
         """
-        sql_ins = "INSERT INTO '%s' VALUES (?, ?, ?, ?, ?)" % (
+        sql_ins = "INSERT INTO '%s' VALUES (?, ?, ?, ?, ?, ?)" % (
             self.TABLE_NAME,)
         con = self._sync_db
         with self._sync_db_write_lock:
             with con:
-                con.execute(sql_ins, (doc_id, doc_rev, '', gen, ''))
+                con.execute(sql_ins, (doc_id, doc_rev, '', gen, '', 0))
 
     def insert_received_doc(self, doc_id, doc_rev, content, gen, trans_id):
         """
-- 
cgit v1.2.3