rooms: Add more coloring to the membership messages.

This commit is contained in:
poljar (Damir Jelić) 2018-03-06 16:15:27 +01:00
parent 57718f82e9
commit 51eb474477

View file

@ -442,15 +442,23 @@ class RoomMembershipMessage(RoomEvent):
def execute(self, server, room, buff, tags): def execute(self, server, room, buff, tags):
nick, color_name = sender_to_nick_and_color(room, self.sender) nick, color_name = sender_to_nick_and_color(room, self.sender)
event_tags = add_event_tags(self.event_id, nick, None, []) event_tags = add_event_tags(self.event_id, nick, None, [])
# TODO this should be configurable
action_color = "red" if self.prefix == "quit" else "green"
data = ("{prefix}{color}{author}{ncolor} " data = ("{prefix}{color}{author}{ncolor} "
"({user_id}) {message} {room}").format( "{del_color}({host_color}{user_id}{del_color})"
"{action_color} {message} "
"{channel_color}{room}{ncolor}").format(
prefix=W.prefix(self.prefix), prefix=W.prefix(self.prefix),
color=W.color(color_name), color=W.color(color_name),
author=nick, author=nick,
ncolor=W.color("reset"), ncolor=W.color("reset"),
del_color=W.color("chat_delimiters"),
host_color=W.color("chat_host"),
user_id=self.sender, user_id=self.sender,
action_color=W.color(action_color),
message=self.message, message=self.message,
channel_color=W.color("chat_channel"),
room=room.alias) room=room.alias)
date = date_from_age(self.age) date = date_from_age(self.age)
tags_string = ",".join(event_tags) tags_string = ",".join(event_tags)