From 57a3c35299457852eab12723dff29258731bf82f Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Wed, 22 Feb 2017 12:15:52 +0100 Subject: [PATCH] Context menu on messages to deleted accounts - messages from deleted chans still stay in global inbox - this crated problems with account detection - created NoAccount class for such accounts --- src/bitmessageqt/account.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/bitmessageqt/account.py b/src/bitmessageqt/account.py index 7db5fa5a..611f5039 100644 --- a/src/bitmessageqt/account.py +++ b/src/bitmessageqt/account.py @@ -54,7 +54,8 @@ def accountClass(address): else: subscription = SubscriptionAccount(address) if subscription.type != AccountMixin.SUBSCRIPTION: - return None + # e.g. deleted chan + return NoAccount(address) return subscription try: gateway = BMConfigParser().get(address, "gateway") @@ -87,7 +88,7 @@ class AccountColor(AccountMixin): self.type = AccountMixin.NORMAL else: self.type = type - + class BMAccount(object): def __init__(self, address = None): @@ -136,6 +137,17 @@ class BMAccount(object): self.fromLabel = self.getLabel(fromAddress) self.toLabel = self.getLabel(toAddress) + +class NoAccount(BMAccount): + def __init__(self, address = None): + self.address = address + self.type = AccountMixin.NORMAL + + def getLabel(self, address = None): + if address is None: + address = self.address + return address + class SubscriptionAccount(BMAccount): pass