show gc topic changements with timestamp as old conversations (grey)
This commit is contained in:
parent
57e4c75a83
commit
291666a5e3
|
@ -1404,17 +1404,17 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco)
|
|||
self.dispatch('MSGERROR', (frm, msg.getErrorCode(), error_msg, msgtxt,
|
||||
tim))
|
||||
elif mtype == 'groupchat':
|
||||
has_timestamp = False
|
||||
if msg.timestamp:
|
||||
has_timestamp = True
|
||||
if subject:
|
||||
self.dispatch('GC_SUBJECT', (frm, subject, msgtxt))
|
||||
self.dispatch('GC_SUBJECT', (frm, subject, msgtxt, has_timestamp))
|
||||
else:
|
||||
if not msg.getTag('body'): #no <body>
|
||||
return
|
||||
# Ignore message from room in which we are not
|
||||
if not self.last_history_line.has_key(jid):
|
||||
return
|
||||
has_timestamp = False
|
||||
if msg.timestamp:
|
||||
has_timestamp = True
|
||||
self.dispatch('GC_MSG', (frm, msgtxt, tim, has_timestamp, msghtml))
|
||||
if self.name not in no_log_for and not int(float(time.mktime(tim))) <= \
|
||||
self.last_history_line[jid] and msgtxt:
|
||||
|
|
13
src/gajim.py
13
src/gajim.py
|
@ -914,7 +914,7 @@ class Interface:
|
|||
self.remote_ctrl.raise_signal('GCMessage', (account, array))
|
||||
|
||||
def handle_event_gc_subject(self, account, array):
|
||||
#('GC_SUBJECT', account, (jid, subject, body))
|
||||
#('GC_SUBJECT', account, (jid, subject, body, has_timestamp))
|
||||
jids = array[0].split('/', 1)
|
||||
jid = jids[0]
|
||||
gc_control = self.msg_win_mgr.get_control(jid, account)
|
||||
|
@ -922,14 +922,19 @@ class Interface:
|
|||
return
|
||||
gc_control.set_subject(array[1])
|
||||
# Standard way, the message comes from the occupant who set the subject
|
||||
text = None
|
||||
if len(jids) > 1:
|
||||
gc_control.print_conversation('%s has set the subject to %s' % (
|
||||
jids[1], array[1]))
|
||||
text = '%s has set the subject to %s' % (jids[1], array[1])
|
||||
# Workaround for psi bug http://flyspray.psi-im.org/task/595 , to be
|
||||
# deleted one day. We can receive a subject with a body that contains
|
||||
# "X has set the subject to Y" ...
|
||||
elif array[2]:
|
||||
gc_control.print_conversation(array[2])
|
||||
text = array[2]
|
||||
if text is not None:
|
||||
if array[3]:
|
||||
gc_control.print_old_conversation(text)
|
||||
else:
|
||||
gc_control.print_conversation(text)
|
||||
|
||||
def handle_event_gc_config(self, account, array):
|
||||
#('GC_CONFIG', account, (jid, config)) config is a dict
|
||||
|
|
|
@ -510,13 +510,17 @@ class GroupchatControl(ChatControlBase):
|
|||
gc_count_nicknames_colors = 0
|
||||
gc_custom_colors = {}
|
||||
|
||||
def print_old_conversation(self, text, contact, tim = None, xhtml = None):
|
||||
def print_old_conversation(self, text, contact = '', tim = None,
|
||||
xhtml = None):
|
||||
if isinstance(text, str):
|
||||
text = unicode(text, 'utf-8')
|
||||
if contact == self.nick: # it's us
|
||||
kind = 'outgoing'
|
||||
if contact:
|
||||
if contact == self.nick: # it's us
|
||||
kind = 'outgoing'
|
||||
else:
|
||||
kind = 'incoming'
|
||||
else:
|
||||
kind = 'incoming'
|
||||
kind = 'status'
|
||||
if gajim.config.get('restored_messages_small'):
|
||||
small_attr = ['small']
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue