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:
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