Skip to content

Commit

Permalink
HTML formatter: handle individual joins and parts (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdstaaij committed Nov 12, 2016
1 parent 844899c commit de5ca3f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions formatters/html.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,25 @@ def format_dialog(dialog, messages)
end
text += ' '
if msg['action']['type'] == 'chat_add_user'
text += "added %s" % CGI::escapeHTML(get_full_name(msg['action']['user']))
if msg['from']['peer_id'] == msg['action']['user']['peer_id'] ||
!msg['from']['peer_id']
text = "%s joined" % CGI::escapeHTML(get_full_name(msg['action']['user']))
else
text += "added %s" % CGI::escapeHTML(get_full_name(msg['action']['user']))
end
elsif msg['action']['type'] == 'chat_rename'
text += "changed group name to «%s»" % CGI::escapeHTML(msg['action']['title'])
elsif msg['action']['type'] == 'chat_change_photo'
text += "updated group photo"
elsif msg['action']['type'] == 'chat_created'
text += "created group «%s»" % CGI::escapeHTML(msg['action']['title'])
elsif msg['action']['type'] == 'chat_del_user'
text += "removed %s" % CGI::escapeHTML(get_full_name(msg['action']['user']))
if msg['from']['peer_id'] == msg['action']['user']['peer_id'] ||
!msg['from']['peer_id']
text = "%s left" % CGI::escapeHTML(get_full_name(msg['action']['user']))
else
text += "removed %s" % CGI::escapeHTML(get_full_name(msg['action']['user']))
end
else
text += CGI::escapeHTML(msg['action'].to_s)
end
Expand Down

0 comments on commit de5ca3f

Please sign in to comment.