From 269b83b0bc47f2e8a9dba71f207ac82cd6fc4524 Mon Sep 17 00:00:00 2001
From: inso <insomniak.fr@gmaiL.com>
Date: Sat, 30 Jul 2016 11:12:54 +0200
Subject: [PATCH] Add revokation warning + Fix missing await

---
 src/sakia/gui/community_view.py | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/sakia/gui/community_view.py b/src/sakia/gui/community_view.py
index ff92acfd..57fbc2c2 100644
--- a/src/sakia/gui/community_view.py
+++ b/src/sakia/gui/community_view.py
@@ -216,9 +216,20 @@ The publication of this document will remove your identity from the network.</p>
             sig_validity = parameters['sigValidity']
             warning_expiration_time = int(sig_validity / 3)
             will_expire_soon = (expiration_time < warning_expiration_time)
-
-            logging.debug("Try")
-            if will_expire_soon:
+            revokation_deadline = expiration_time + 2*sig_validity
+            revokation_soon = (time.time() > revokation_deadline)
+            if revokation_soon:
+                days = int((revokation_deadline - time.time()) / 3600 / 24)
+                if 'warning_revokation' not in self.status_info:
+                    self.status_info.append('warning_revokation')
+
+                if self.app.preferences['notifications'] and \
+                        self.account.notifications['warning_revokation'][1]+24*3600 < time.time():
+                    toast.display(self.tr("Identity revokation"),
+                              self.tr("<b>Warning : Your identity will be implicitely revoked\
+                               if you dont renew before {0} days</b>").format(days))
+                    self.account.notifications['warning_revokation'][1] = time.time()
+            elif will_expire_soon:
                 days = int(expiration_time / 3600 / 24)
                 if days > 0:
                     if 'membership_expire_soon' not in self.status_info:
@@ -328,7 +339,7 @@ The publication of this document will remove your identity from the network.</p>
                         self.button_membership.setText(self.tr("Send membership demand"))
                         self.button_membership.setEnabled(True)
                         self.action_publish_uid.setEnabled(False)
-                        if self.community.get_block(0) is not None:
+                        if await self.community.get_block(0) is not None:
                             self.button_certification.setEnabled(False)
                 else:
                     logging.debug("UID not published")
-- 
GitLab