/me now works in groupchat windows

This commit is contained in:
Yann Leboulanger 2005-03-06 02:19:22 +00:00
parent 9f65782645
commit 94167e45d9
1 changed files with 20 additions and 10 deletions

View File

@ -578,7 +578,7 @@ class tabbed_chat_window:
name = user.name name = user.name
if text.startswith('/me'): if text.startswith('/me'):
ttext = name + ' ' + text[4:] + '\n' ttext = name + text[3:] + '\n'
else: else:
ttext = '<' + name + '> ' ttext = '<' + name + '> '
otext = text + '\n' otext = text + '\n'
@ -885,7 +885,7 @@ class Groupchat_window:
message_textview.grab_focus() message_textview.grab_focus()
''' '''
def print_conversation(self, text, room_jid, contact = None, tim = None): def print_conversation(self, text, room_jid, contact = '', tim = None):
"""Print a line in the conversation : """Print a line in the conversation :
if contact is set : it's a message from someone if contact is set : it's a message from someone
if contact is not set : it's a message from the server""" if contact is not set : it's a message from the server"""
@ -897,19 +897,29 @@ class Groupchat_window:
end_iter = conversation_buffer.get_end_iter() end_iter = conversation_buffer.get_end_iter()
if not tim: if not tim:
tim = time.localtime() tim = time.localtime()
tim_format = time.strftime('[%H:%M:%S]', time) tim_format = time.strftime('[%H:%M:%S]', tim)
conversation_buffer.insert(end_iter, tim_format) # CHECK! in tabbed print_conver you have + ' ' here conversation_buffer.insert(end_iter, tim_format) # CHECK! in tabbed print_conver you have + ' ' here
otext = ''
ttext = ''
if contact: if contact:
if contact == self.nicks[room_jid]: if contact == self.nicks[room_jid]:
conversation_buffer.insert_with_tags_by_name(end_iter, '<' + \ tag = 'outgoing'
contact + '> ', 'outgoing')
else: else:
conversation_buffer.insert_with_tags_by_name(end_iter, '<' + \ tag = 'incoming'
contact + '> ', 'incoming')
conversation_buffer.insert(end_iter, text + '\n') if text.startswith('/me'):
ttext = contact + text[3:] + '\n'
else: else:
conversation_buffer.insert_with_tags_by_name(end_iter, text + '\n', \ ttext = '<' + contact + '> '
'status') otext = text + '\n'
else:
tag = 'status'
ttext = text + '\n'
conversation_buffer.insert_with_tags_by_name(end_iter, ttext, tag)
#TODO: emoticons, url grabber
conversation_buffer.insert(end_iter, otext)
#scroll to the end of the textview #scroll to the end of the textview
conversation_textview.scroll_to_mark(conversation_buffer.get_mark('end'),\ conversation_textview.scroll_to_mark(conversation_buffer.get_mark('end'),\
0.1, 0, 0, 0) 0.1, 0, 0, 0)