Create valid account buffers even when session cannot login to the network (works for ignored sessions)

This commit is contained in:
Manuel Cortez 2022-11-16 11:01:52 -06:00
parent 7c80c9d842
commit fefd88b71c
No known key found for this signature in database
GPG Key ID: 9E0735CA15EFE790
5 changed files with 11 additions and 11 deletions

View File

@ -275,12 +275,7 @@ class Controller(object):
self.streams_checker_function.start()
def create_ignored_session_buffer(self, session):
self.accounts.append(session.settings["twitter"]["user_name"])
account = buffers.base.AccountBuffer(self.view.nb, session.settings["twitter"]["user_name"], session.settings["twitter"]["user_name"], session.session_id)
account.logged = False
account.setup_account()
self.buffers.append(account)
self.view.add_buffer(account.buffer , name=session.settings["twitter"]["user_name"])
pub.sendMessage("core.create_account", name=session.get_name(), session_id=session.session_id)
def login_account(self, session_id):
for i in sessions.sessions:
@ -291,9 +286,11 @@ class Controller(object):
handler.create_buffers(session=session, controller=self, createAccounts=False)
self.start_buffers(session)
def create_account_buffer(self, name, session_id):
def create_account_buffer(self, name, session_id, logged=False):
self.accounts.append(name)
account = buffers.base.AccountBuffer(self.view.nb, name, name, session_id)
if logged == False:
account.logged = logged
account.setup_account()
self.buffers.append(account)
self.view.add_buffer(account.buffer , name=name)

View File

@ -15,7 +15,7 @@ class Handler(object):
session.get_user_info()
name = session.get_name()
if createAccounts == True:
pub.sendMessage("core.create_account", name=name, session_id=session.session_id)
pub.sendMessage("core.create_account", name=name, session_id=session.session_id, logged=True)
root_position =controller.view.search(name, name)
for i in session.settings['general']['buffer_order']:
if i == 'home':

View File

@ -21,7 +21,7 @@ class Handler(object):
session.get_user_info()
name = session.get_name()
if createAccounts == True:
pub.sendMessage("core.create_account", name=name, session_id=session.session_id)
pub.sendMessage("core.create_account", name=name, session_id=session.session_id, logged=True)
root_position =controller.view.search(name, name)
for i in session.settings['general']['buffer_order']:
if i == 'home':

View File

@ -175,5 +175,5 @@ class Session(base.baseSession):
def get_name(self):
instance = self.settings["mastodon"]["instance"]
instance = instance.replace("https://", "")
user = self.db["user_name"]
user = self.settings["mastodon"]["user_name"]
return "Mastodon: {}@{}".format(user, instance)

View File

@ -674,4 +674,7 @@ class Session(base.baseSession):
pub.sendMessage("sent-dm", data=item, session_name=self.get_name())
def get_name(self):
if self.logged:
return "Twitter: {}".format(self.db["user_name"])
else:
return "Twitter: {}".format(self.settings["twitter"]["user_name"])