Commit cf7b9f26 authored by Philipp Hörist's avatar Philipp Hörist

Dont style delayed messages differently

The timestamp should be enough indication of how recent the message is
parent b1decf2b
......@@ -1308,20 +1308,21 @@ class ChatControl(ChatControlBase):
tim = float(row.time)
if app.config.get('restored_messages_small'):
small_attr = ['small']
else:
small_attr = []
xhtml = None
if msg.startswith('<body '):
xhtml = msg
if row.subject:
msg = _('Subject: %(subject)s\n%(message)s') % \
{'subject': row.subject, 'message': msg}
ChatControlBase.add_message(self, msg, kind, name,
tim, small_attr, small_attr + ['restored_message'],
small_attr + ['restored_message'], False,
old_kind=local_old_kind, xhtml=xhtml, additional_data=additional_data)
ChatControlBase.add_message(self,
msg,
kind,
name,
tim,
restored=True,
old_kind=local_old_kind,
xhtml=xhtml,
additional_data=additional_data)
if row.message.startswith('/me ') or row.message.startswith('/me\n'):
local_old_kind = None
else:
......
......@@ -932,7 +932,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
def add_message(self, text, kind, name, tim,
other_tags_for_name=None, other_tags_for_time=None, other_tags_for_text=None,
count_as_new=True, subject=None, old_kind=None, xhtml=None,
restored=False, subject=None, old_kind=None, xhtml=None,
xep0184_id=None, graphics=True, displaymarking=None, msg_log_id=None,
msg_stanza_id=None, correct_id=None, additional_data=None,
encrypted=None):
......@@ -966,8 +966,9 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
if xep0184_id is not None:
textview.add_xep0184_mark(xep0184_id)
if not count_as_new:
if restored:
return
if kind == 'incoming':
if not self.type_id == message_control.TYPE_GC or \
app.config.notify_for_muc(jid) or \
......
......@@ -236,7 +236,6 @@ class Config:
'print_status_muc_default': [opt_bool, False, _('Default Setting: Show a status message for all status (away, dnd, etc.) changes of users in a group chat')],
'log_contact_status_changes': [opt_bool, False],
'log_xhtml_messages': [opt_bool, False, _('Log XHTML messages instead of plain text messages.')],
'restored_messages_small': [opt_bool, True, _('If true, restored messages will use a smaller font than the default one.')],
'hide_avatar_of_transport': [opt_bool, False, _('Don\'t show avatar for the transport itself.')],
'roster_window_skip_taskbar': [opt_bool, False, _('Don\'t show roster in the system taskbar.')],
'use_urgency_hint': [opt_bool, True, _('If true, make the window flash (the default behaviour in most Window Managers) when holding pending events.')],
......
......@@ -285,10 +285,6 @@ class ConversationTextview(GObject.GObject):
#Pango.SCALE_SMALL
tag.set_property('scale', 0.8333333333333)
tag = buffer_.create_tag('restored_message')
color = app.css_config.get_value('.gajim-restored-message', StyleAttr.COLOR)
tag.set_property('foreground', color)
self.tv.create_tags()
tag = buffer_.create_tag('bold')
......
.gajim-incoming-nickname { color: rgb(164, 0, 0) }.gajim-outgoing-nickname { color: rgb(52, 101, 164) }.gajim-outgoing-message-text { color: rgb(85, 87, 83) }.gajim-status-message { color: rgb(78, 154, 6) }.gajim-url { color: rgb(32, 74, 135) }.gajim-highlight-message { color: rgb(255, 128, 128) }.gajim-restored-message { color: rgb(85, 87, 83) }.gajim-roster-disconnected { background: rgb(171 ,97 ,97) }.gajim-roster-connected { background: rgb(173, 195, 198) }.gajim-state-composing { color: rgb(0, 139, 0) }.gajim-state-inactive { color: rgb(158, 158, 158) }.gajim-state-gone { color: rgb(128, 128, 128) }.gajim-state-paused { color: rgb(0, 0, 205) }.gajim-message-placeholder { color: rgb(195, 195, 192) }
\ No newline at end of file
.gajim-incoming-nickname { color: rgb(164, 0, 0) }.gajim-outgoing-nickname { color: rgb(52, 101, 164) }.gajim-outgoing-message-text { color: rgb(85, 87, 83) }.gajim-status-message { color: rgb(78, 154, 6) }.gajim-url { color: rgb(32, 74, 135) }.gajim-highlight-message { color: rgb(255, 128, 128) }.gajim-roster-disconnected { background: rgb(171 ,97 ,97) }.gajim-roster-connected { background: rgb(173, 195, 198) }.gajim-state-composing { color: rgb(0, 139, 0) }.gajim-state-inactive { color: rgb(158, 158, 158) }.gajim-state-gone { color: rgb(128, 128, 128) }.gajim-state-paused { color: rgb(0, 0, 205) }.gajim-message-placeholder { color: rgb(195, 195, 192) }
\ No newline at end of file
......
......@@ -1217,24 +1217,14 @@ class GroupchatControl(ChatControlBase):
xhtml=obj.xhtml_msgtxt, displaymarking=obj.displaymarking,
additional_data=obj.additional_data)
else:
# message from someone
if obj.delayed:
# don't print xhtml if it's an old message.
# Like that xhtml messages are grayed too.
self.add_delayed_message(
obj.msgtxt, contact=obj.nick,
tim=obj.timestamp, xhtml=None, encrypted=obj.encrypted,
displaymarking=obj.displaymarking, msg_stanza_id=obj.id_,
additional_data=obj.additional_data)
else:
if obj.nick == self.nick:
self.last_sent_txt = obj.msgtxt
self.add_message(
obj.msgtxt, contact=obj.nick,
tim=obj.timestamp, xhtml=obj.xhtml_msgtxt,
displaymarking=obj.displaymarking, encrypted=obj.encrypted,
correct_id=obj.correct_id, msg_stanza_id=obj.id_,
additional_data=obj.additional_data)
if obj.nick == self.nick:
self.last_sent_txt = obj.msgtxt
self.add_message(
obj.msgtxt, contact=obj.nick,
tim=obj.timestamp, xhtml=obj.xhtml_msgtxt,
displaymarking=obj.displaymarking, encrypted=obj.encrypted,
correct_id=obj.correct_id, msg_stanza_id=obj.id_,
additional_data=obj.additional_data)
obj.needs_highlight = self.needs_visual_notification(obj.msgtxt)
def on_private_message(self, nick, sent, msg, tim, xhtml, session, msg_log_id=None,
......@@ -1287,30 +1277,6 @@ class GroupchatControl(ChatControlBase):
return None
return self.model.get_iter(path)
def add_delayed_message(self, text, contact='', tim=None, xhtml=None,
displaymarking=None, msg_stanza_id=None, encrypted=None, additional_data=None):
if additional_data is None:
additional_data = AdditionalDataDict()
if contact:
if contact == self.nick: # it's us
kind = 'outgoing'
else:
kind = 'incoming'
else:
kind = 'status'
if app.config.get('restored_messages_small'):
small_attr = ['small']
else:
small_attr = []
ChatControlBase.add_message(self, text, kind, contact, tim,
small_attr, small_attr + ['restored_message'],
small_attr + ['restored_message'], count_as_new=False, xhtml=xhtml,
displaymarking=displaymarking, msg_stanza_id=msg_stanza_id,
encrypted=encrypted, additional_data=additional_data)
def add_message(self, text, contact='', tim=None, xhtml=None,
graphics=True, displaymarking=None, correct_id=None, msg_stanza_id=None,
encrypted=None, additional_data=None):
......
......@@ -153,10 +153,6 @@ CSS_STYLE_OPTIONS = [
'.gajim-msg-correcting text',
StyleAttr.BACKGROUND),
StyleOption(_('Restored Message Color'),
'.gajim-restored-message',
StyleAttr.COLOR),
StyleOption(_('Contact Disconnected Background'),
'.gajim-roster-disconnected',
StyleAttr.BACKGROUND),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment