print special chars even in /me lines
This commit is contained in:
parent
6f483ca257
commit
15ccd4edcc
|
@ -704,7 +704,7 @@ class tabbed_chat_window:
|
||||||
#we launch the correct application
|
#we launch the correct application
|
||||||
self.plugin.launch_browser_mailer(kind, word)
|
self.plugin.launch_browser_mailer(kind, word)
|
||||||
|
|
||||||
def print_special_text(self, text, jid, contact):
|
def print_special_text(self, text, jid, other_tag):
|
||||||
conversation_textview = self.xmls[jid].get_widget('conversation_textview')
|
conversation_textview = self.xmls[jid].get_widget('conversation_textview')
|
||||||
conversation_buffer = conversation_textview.get_buffer()
|
conversation_buffer = conversation_textview.get_buffer()
|
||||||
|
|
||||||
|
@ -722,7 +722,8 @@ class tabbed_chat_window:
|
||||||
#it's a mail
|
#it's a mail
|
||||||
tag = 'mail'
|
tag = 'mail'
|
||||||
print tag
|
print tag
|
||||||
elif self.plugin.sth_at_sth_dot_sth_re.match(text): # returns match object or None
|
elif self.plugin.sth_at_sth_dot_sth_re.match(text): #returns match object
|
||||||
|
#or None
|
||||||
#it's a mail
|
#it's a mail
|
||||||
tag = 'mail'
|
tag = 'mail'
|
||||||
print tag
|
print tag
|
||||||
|
@ -746,9 +747,9 @@ class tabbed_chat_window:
|
||||||
print tag
|
print tag
|
||||||
|
|
||||||
end_iter = conversation_buffer.get_end_iter()
|
end_iter = conversation_buffer.get_end_iter()
|
||||||
if tag in ['bold', 'italic', 'underline'] and contact == 'status':
|
if tag in ['bold', 'italic', 'underline'] and other_tag:
|
||||||
conversation_buffer.insert_with_tags_by_name(end_iter, text,\
|
conversation_buffer.insert_with_tags_by_name(end_iter, text,\
|
||||||
'status', tag)
|
other_tag, tag)
|
||||||
else:
|
else:
|
||||||
conversation_buffer.insert_with_tags_by_name(end_iter, text, tag)
|
conversation_buffer.insert_with_tags_by_name(end_iter, text, tag)
|
||||||
|
|
||||||
|
@ -760,6 +761,7 @@ class tabbed_chat_window:
|
||||||
user = self.users[jid]
|
user = self.users[jid]
|
||||||
conversation_textview = self.xmls[jid].get_widget('conversation_textview')
|
conversation_textview = self.xmls[jid].get_widget('conversation_textview')
|
||||||
conversation_buffer = conversation_textview.get_buffer()
|
conversation_buffer = conversation_textview.get_buffer()
|
||||||
|
print_all_special = False
|
||||||
if not text:
|
if not text:
|
||||||
text = ''
|
text = ''
|
||||||
end_iter = conversation_buffer.get_end_iter()
|
end_iter = conversation_buffer.get_end_iter()
|
||||||
|
@ -774,6 +776,7 @@ class tabbed_chat_window:
|
||||||
if contact == 'status':
|
if contact == 'status':
|
||||||
tag = 'status'
|
tag = 'status'
|
||||||
ttext = text + '\n'
|
ttext = text + '\n'
|
||||||
|
print_all_special = True
|
||||||
else:
|
else:
|
||||||
if contact:
|
if contact:
|
||||||
tag = 'outgoing'
|
tag = 'outgoing'
|
||||||
|
@ -785,11 +788,12 @@ class tabbed_chat_window:
|
||||||
|
|
||||||
if text.startswith('/me'):
|
if text.startswith('/me'):
|
||||||
ttext = name + text[3:] + '\n'
|
ttext = name + text[3:] + '\n'
|
||||||
|
print_all_special = True
|
||||||
else:
|
else:
|
||||||
ttext = '<' + name + '> '
|
ttext = '<' + name + '> '
|
||||||
otext = text + '\n'
|
otext = text + '\n'
|
||||||
#if it's a status we print special words
|
#if it's a status we print special words
|
||||||
if tag != 'status':
|
if not print_all_special:
|
||||||
conversation_buffer.insert_with_tags_by_name(end_iter, ttext, tag)
|
conversation_buffer.insert_with_tags_by_name(end_iter, ttext, tag)
|
||||||
else:
|
else:
|
||||||
otext = ttext
|
otext = ttext
|
||||||
|
@ -810,17 +814,20 @@ class tabbed_chat_window:
|
||||||
if start != 0:
|
if start != 0:
|
||||||
text_before_special_text = otext[index:start]
|
text_before_special_text = otext[index:start]
|
||||||
end_iter = conversation_buffer.get_end_iter()
|
end_iter = conversation_buffer.get_end_iter()
|
||||||
if tag == 'status':
|
if print_all_special:
|
||||||
conversation_buffer.insert_with_tags_by_name(end_iter, \
|
conversation_buffer.insert_with_tags_by_name(end_iter, \
|
||||||
text_before_special_text, tag)
|
text_before_special_text, tag)
|
||||||
else:
|
else:
|
||||||
conversation_buffer.insert(end_iter, text_before_special_text)
|
conversation_buffer.insert(end_iter, text_before_special_text)
|
||||||
self.print_special_text(special_text, jid, contact)
|
if print_all_special:
|
||||||
|
self.print_special_text(special_text, jid, tag)
|
||||||
|
else:
|
||||||
|
self.print_special_text(special_text, jid, '')
|
||||||
index = end # update index
|
index = end # update index
|
||||||
|
|
||||||
#add the rest in the index and after
|
#add the rest in the index and after
|
||||||
end_iter = conversation_buffer.get_end_iter()
|
end_iter = conversation_buffer.get_end_iter()
|
||||||
if tag == 'status':
|
if print_all_special:
|
||||||
conversation_buffer.insert_with_tags_by_name(end_iter, \
|
conversation_buffer.insert_with_tags_by_name(end_iter, \
|
||||||
otext[index:], tag)
|
otext[index:], tag)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue