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
This commit is contained in:
Peter Šurda 2017-02-22 12:15:52 +01:00
parent 72ed3e340f
commit 57a3c35299
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -54,7 +54,8 @@ def accountClass(address):
else: else:
subscription = SubscriptionAccount(address) subscription = SubscriptionAccount(address)
if subscription.type != AccountMixin.SUBSCRIPTION: if subscription.type != AccountMixin.SUBSCRIPTION:
return None # e.g. deleted chan
return NoAccount(address)
return subscription return subscription
try: try:
gateway = BMConfigParser().get(address, "gateway") gateway = BMConfigParser().get(address, "gateway")
@ -87,7 +88,7 @@ class AccountColor(AccountMixin):
self.type = AccountMixin.NORMAL self.type = AccountMixin.NORMAL
else: else:
self.type = type self.type = type
class BMAccount(object): class BMAccount(object):
def __init__(self, address = None): def __init__(self, address = None):
@ -136,6 +137,17 @@ class BMAccount(object):
self.fromLabel = self.getLabel(fromAddress) self.fromLabel = self.getLabel(fromAddress)
self.toLabel = self.getLabel(toAddress) 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): class SubscriptionAccount(BMAccount):
pass pass