[shivan] don't trat emoticons created with parenthesis arround status message. fixes #3368

This commit is contained in:
Yann Leboulanger 2008-02-26 08:31:48 +00:00
parent 62f8937fae
commit cb51401903
4 changed files with 23 additions and 21 deletions

View File

@ -643,9 +643,8 @@ class ChatControlBase(MessageControl):
self.orig_msg = None
def print_conversation_line(self, text, kind, name, tim,
other_tags_for_name = [], other_tags_for_time = [],
other_tags_for_text = [], count_as_new = True,
subject = None, old_kind = None, xhtml = None):
other_tags_for_name=[], other_tags_for_time=[], other_tags_for_text=[],
count_as_new=True, subject=None, old_kind=None, xhtml=None, simple=False):
'''prints 'chat' type messages'''
jid = self.contact.jid
full_jid = self.get_full_jid()
@ -655,7 +654,7 @@ class ChatControlBase(MessageControl):
end = True
textview.print_conversation_line(text, jid, kind, name, tim,
other_tags_for_name, other_tags_for_time, other_tags_for_text,
subject, old_kind, xhtml)
subject, old_kind, xhtml, simple=simple)
if not count_as_new:
return
@ -1518,8 +1517,8 @@ class ChatControl(ChatControlBase):
self._show_lock_image(e2e_is_active, 'E2E', e2e_is_active, self.session and \
self.session.is_loggable())
def print_conversation(self, text, frm = '', tim = None,
encrypted = False, subject = None, xhtml = None):
def print_conversation(self, text, frm='', tim=None, encrypted=False,
subject=None, xhtml=None, simple=False):
'''Print a line in the conversation:
if contact is set to status: it's a status message
if contact is set to another value: it's an outgoing message
@ -1567,7 +1566,8 @@ class ChatControl(ChatControlBase):
if xhtml:
xhtml = '<body xmlns="%s">%s</body>' % (NS_XHTML, xhtml)
ChatControlBase.print_conversation_line(self, text, kind, name, tim,
subject = subject, old_kind = self.old_msg_kind, xhtml = xhtml)
subject=subject, old_kind=self.old_msg_kind, xhtml=xhtml,
simple=simple)
if text.startswith('/me ') or text.startswith('/me\n'):
self.old_msg_kind = None
else:

View File

@ -982,8 +982,8 @@ class ConversationTextview:
buffer.insert_with_tags_by_name(end_iter, '\n', 'eol')
def print_conversation_line(self, text, jid, kind, name, tim,
other_tags_for_name = [], other_tags_for_time = [], other_tags_for_text = [],
subject = None, old_kind = None, xhtml = None):
other_tags_for_name=[], other_tags_for_time=[], other_tags_for_text=[],
subject=None, old_kind=None, xhtml=None, simple=False):
'''prints 'chat' type messages'''
buffer = self.tv.get_buffer()
buffer.begin_user_action()
@ -1004,7 +1004,8 @@ class ConversationTextview:
# else twice (one for end bound, one for start bound)
mark = None
if buffer.get_char_count() > 0:
buffer.insert_with_tags_by_name(end_iter, '\n', 'eol')
if not simple:
buffer.insert_with_tags_by_name(end_iter, '\n', 'eol')
mark = buffer.create_mark(None, end_iter, left_gravity=True)
self.marks_queue.put(mark)
if not mark:
@ -1019,12 +1020,12 @@ class ConversationTextview:
# We don't have tim for outgoing messages...
tim = time.localtime()
current_print_time = gajim.config.get('print_time')
if current_print_time == 'always' and kind != 'info':
if current_print_time == 'always' and kind != 'info' and not simple:
timestamp_str = self.get_time_to_show(tim)
timestamp = time.strftime(timestamp_str, tim)
buffer.insert_with_tags_by_name(end_iter, timestamp,
*other_tags_for_time)
elif current_print_time == 'sometimes' and kind != 'info':
elif current_print_time == 'sometimes' and kind != 'info' and not simple:
every_foo_seconds = 60 * gajim.config.get(
'print_ichat_every_foo_minutes')
seconds_passed = time.mktime(tim) - self.last_time_printout

View File

@ -1198,12 +1198,13 @@ class Interface:
contact.show = show
contact.status = status
uf_show = helpers.get_uf_show(show)
ctrl.print_conversation(_('%s is now %s') % (nick, uf_show),
'status')
if status:
ctrl.print_conversation(_('%s is now %s (%s)') % (nick, uf_show,
status), 'status')
ctrl.print_conversation(' (', 'status', simple=True)
ctrl.print_conversation('%s' % (status), 'status', simple=True)
ctrl.print_conversation(')', 'status', simple=True)
else:
ctrl.print_conversation(_('%s is now %s') % (nick, uf_show),
'status')
ctrl.parent_win.redraw_tab(ctrl)
ctrl.update_ui()
if self.remote_ctrl:

View File

@ -1402,12 +1402,12 @@ class RosterWindow:
win.redraw_tab(ctrl)
uf_show = helpers.get_uf_show(show)
ctrl.print_conversation(_('%s is now %s') % (name, uf_show),
'status')
if status:
ctrl.print_conversation(_('%s is now %s (%s)') % (name, uf_show,
status), 'status')
else: # No status message
ctrl.print_conversation(_('%s is now %s') % (name, uf_show),
'status')
ctrl.print_conversation(' (', 'status', simple=True)
ctrl.print_conversation('%s' % (status), 'status', simple=True)
ctrl.print_conversation(')', 'status', simple=True)
# unset custom status
if gajim.interface.status_sent_to_users.has_key(account) and \