From a5e92800477f6195a6b2e8c6e64a56859117d5b8 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 29 Sep 2019 18:12:48 +0200 Subject: Pass a message to add_message instead of messed up kwargs everywhere Changes LOTS of things --- poezio/tabs/conversationtab.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'poezio/tabs/conversationtab.py') diff --git a/poezio/tabs/conversationtab.py b/poezio/tabs/conversationtab.py index 410c5eda..70005f0f 100644 --- a/poezio/tabs/conversationtab.py +++ b/poezio/tabs/conversationtab.py @@ -28,6 +28,7 @@ from poezio.roster import roster from poezio.text_buffer import CorrectionError from poezio.theming import get_theme, dump_tuple from poezio.decorators import command_args_parser +from poezio.ui.types import InfoMessage log = logging.getLogger(__name__) @@ -179,7 +180,7 @@ class ConversationTab(OneToOneTab): (' and their last status was %s' % status) if status else '', ) - self.add_message(msg) + self.add_message(InfoMessage(msg), typ=0) self.core.refresh_window() self.core.xmpp.plugin['xep_0012'].get_last_activity( @@ -200,17 +201,21 @@ class ConversationTab(OneToOneTab): if resource: status = ( 'Status: %s' % resource.status) if resource.status else '' - self._text_buffer.add_message( - "\x19%(info_col)s}Show: %(show)s, %(status)s\x19o" % { - 'show': resource.presence or 'available', - 'status': status, - 'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT) - }) + self.add_message( + InfoMessage( + "Show: %(show)s, %(status)s" % { + 'show': resource.presence or 'available', + 'status': status, + } + ), + typ=0, + ) return True else: - self._text_buffer.add_message( - "\x19%(info_col)s}No information available\x19o" % - {'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT)}) + self.add_message( + InfoMessage("No information available"), + typ=0, + ) return True @command_args_parser.quoted(0, 1) -- cgit v1.2.3