irc emulation: /me adds * and then the nick

This commit is contained in:
Nikos Kouremenos 2005-06-17 15:31:21 +00:00
parent cf028229a8
commit c951abccf3
2 changed files with 10 additions and 6 deletions

View File

@ -53,9 +53,9 @@ class Chat:
self.account = account self.account = account
self.change_cursor = None self.change_cursor = None
self.xmls = {} self.xmls = {}
self.tagIn = {} self.tagIn = {} # holds nick that talks to us
self.tagOut = {} self.tagOut = {} # holds our nick
self.tagStatus = {} self.tagStatus = {} # holds status messages
self.nb_unread = {} self.nb_unread = {}
self.last_message_time = {} self.last_message_time = {}
self.last_time_printout = {} self.last_time_printout = {}
@ -734,7 +734,7 @@ class Chat:
if kind == 'status': if kind == 'status':
text_tags.append(kind) text_tags.append(kind)
elif text.startswith('/me ') or text.startswith('/me\n'): elif text.startswith('/me ') or text.startswith('/me\n'):
text = name + text[3:] text = '* ' + name + text[3:]
text_tags.append(kind) text_tags.append(kind)
if kind == 'incoming': if kind == 'incoming':
@ -744,6 +744,8 @@ class Chat:
# not status nor /me # not status nor /me
name_tags = other_tags_for_name[:] #create a new list name_tags = other_tags_for_name[:] #create a new list
name_tags.append(kind) name_tags.append(kind)
if kind == 'incoming':
name_tags.append('incoming_message')
before_str = gajim.config.get('before_nickname') before_str = gajim.config.get('before_nickname')
after_str = gajim.config.get('after_nickname') after_str = gajim.config.get('after_nickname')
format = before_str + name + after_str + ' ' format = before_str + name + after_str + ' '
@ -754,11 +756,13 @@ class Chat:
# add the rest of text located in the index and after # add the rest of text located in the index and after
end_iter = buffer.get_end_iter() end_iter = buffer.get_end_iter()
if kind == 'incoming':
text_tags.append('incoming_message')
self.print_with_tag_list(buffer, text[index:], end_iter, text_tags) self.print_with_tag_list(buffer, text[index:], end_iter, text_tags)
#scroll to the end of the textview #scroll to the end of the textview
end = False end = False
if at_the_end or (kind == 'outgoing'): if at_the_end or kind == 'outgoing':
#we are at the end or we are sending something #we are at the end or we are sending something
end = True end = True
# We scroll to the end after the scrollbar has appeared # We scroll to the end after the scrollbar has appeared

View File

@ -476,7 +476,7 @@ class GroupchatWindow(chat.Chat):
other_tags_for_name = [] other_tags_for_name = []
other_tags_for_text = [] other_tags_for_text = []
if contact: if contact:
if contact == self.nicks[room_jid]: if contact == self.nicks[room_jid]: # it's us
kind = 'outgoing' kind = 'outgoing'
else: else:
kind = 'incoming' kind = 'incoming'