Author: asterix
Date: 2008-02-26 09:31:48 +0100 (Tue, 26 Feb 2008)
New Revision: 9338
Modified:
trunk/src/chat_control.py
trunk/src/conversation_textview.py
trunk/src/gajim.py
trunk/src/roster_window.py
Log:
[shivan] don't trat emoticons created with parenthesis arround status message. fixes #3368
Modified: trunk/src/chat_control.py
===================================================================
--- trunk/src/chat_control.py 2008-02-25 20:41:41 UTC (rev 9337)
+++ trunk/src/chat_control.py 2008-02-26 08:31:48 UTC (rev 9338)
@@ -643,9 +643,8 @@
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 @@
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 @@
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 @@
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:
Modified: trunk/src/conversation_textview.py
===================================================================
--- trunk/src/conversation_textview.py 2008-02-25 20:41:41 UTC (rev 9337)
+++ trunk/src/conversation_textview.py 2008-02-26 08:31:48 UTC (rev 9338)
@@ -982,8 +982,8 @@
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 @@
# 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 @@
# 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
Modified: trunk/src/gajim.py
===================================================================
--- trunk/src/gajim.py 2008-02-25 20:41:41 UTC (rev 9337)
+++ trunk/src/gajim.py 2008-02-26 08:31:48 UTC (rev 9338)
@@ -1198,12 +1198,13 @@
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:
Modified: trunk/src/roster_window.py
===================================================================
--- trunk/src/roster_window.py 2008-02-25 20:41:41 UTC (rev 9337)
+++ trunk/src/roster_window.py 2008-02-26 08:31:48 UTC (rev 9338)
@@ -1402,12 +1402,12 @@
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 \