Skip to content
Snippets Groups Projects
Commit 0b7a7408 authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

add the date in time when msg if from another day

parent 99636d5c
No related branches found
No related tags found
No related merge requests found
......@@ -544,7 +544,24 @@ def print_conversation_line(self, text, jid, kind, name, tim,
tim = time.localtime()
before_str = gajim.config.get('before_time')
after_str = gajim.config.get('after_time')
format = before_str + '%H:%M:%S' + after_str
msg_day = time.strftime('%d', tim)
day = time.strftime('%d')
diff_day = 0
while day != msg_day:
diff_day += 1
before_tim = time.localtime(time.time()-24*3600*diff_day)
day = time.strftime('%d', before_tim)
if diff_day == 0:
day_str = ''
elif diff_day == 1:
day_str = _('Yesterday')
else:
#the number is >= 2
day_str = _('%i days ago') % diff_day
format = before_str
if day_str:
format += day_str + ' '
format += '%H:%M:%S' + after_str
tim_format = time.strftime(format, tim)
buffer.insert_with_tags_by_name(end_iter, tim_format + ' ',
*other_tags_for_time)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment