From 446dcc49a0de9b70665f73f1ac8cba364e523aea Mon Sep 17 00:00:00 2001 From: Vincent Hanquez <tab@snarc.org> Date: Wed, 29 Sep 2004 14:01:24 +0000 Subject: [PATCH] implement /me functionality and cleanup :p --- plugins/gtkgui/gtkgui.py | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/plugins/gtkgui/gtkgui.py b/plugins/gtkgui/gtkgui.py index 50aa05c756..2d2c0c887d 100644 --- a/plugins/gtkgui/gtkgui.py +++ b/plugins/gtkgui/gtkgui.py @@ -194,18 +194,31 @@ class message_Window: if not tim: tim = time.localtime() tims = time.strftime("[%H:%M:%S]", tim) - buffer.insert(end_iter, tims) - if contact: - if contact == 'status': - buffer.insert_with_tags_by_name(end_iter, txt+'\n', \ - 'status') - else: - buffer.insert_with_tags_by_name(end_iter, '<'+self.plugin.nicks[self.account]+'> ', 'outgoing') - buffer.insert(end_iter, txt+'\n') + buffer.insert(end_iter, tims + ' ') + + otxt = '' + ttxt = '' + if contact and contact == 'status': + tag = 'status' + ttxt = txt + '\n' else: - buffer.insert_with_tags_by_name(end_iter, '<' + \ - self.user.name + '> ', 'incoming') - buffer.insert(end_iter, txt+'\n') + if contact: + tag = 'outgoing' + name = self.plugin.nicks[self.account] + else: + tag = 'incoming' + name = self.user.name + + if string.find(txt, '/me ') == 0: + ttxt = name + ' ' + txt[4:] + '\n' + else: + ttxt = '<' + name + '> ' + otxt = txt + '\n' + + buffer.insert_with_tags_by_name(end_iter, ttxt, tag) + if len(otxt) > 0: + buffer.insert(end_iter, otxt) + #scroll to the end of the textview conversation.scroll_to_mark(buffer.get_mark('end'), 0.1, 0, 0, 0) -- GitLab