Remove usage of old MatrixRoom.alias attribute in remaining places.

* Use calculated display name in the bar item.
* Don't mention the room name in topic messages for groups.
This commit is contained in:
Denis Kasak 2018-03-12 11:58:46 +01:00
parent 654e39077d
commit 02bb64feab
3 changed files with 31 additions and 17 deletions

View file

@ -49,7 +49,9 @@ def matrix_bar_item_name(data, item, window, buffer, extra_info):
room = server.rooms[room_id] room = server.rooms[room_id]
return "{color}{name}".format(color=W.color(color), name=room.alias) return "{color}{name}".format(
color=W.color(color),
name=room.display_name())
elif buffer == server.server_buffer: elif buffer == server.server_buffer:
color = ("status_name_ssl" color = ("status_name_ssl"

View file

@ -918,12 +918,17 @@ def matrix_command_topic_cb(data, buffer, command):
if not room.topic: if not room.topic:
return W.WEECHAT_RC_OK return W.WEECHAT_RC_OK
message = ("{prefix}Topic for {color}{room}{ncolor} is " if room.is_named():
"\"{topic}\"").format( message = ('{prefix}Topic for {color}{room}{ncolor} is '
'"{topic}"').format(
prefix=W.prefix("network"), prefix=W.prefix("network"),
color=W.color("chat_buffer"), color=W.color("chat_buffer"),
ncolor=W.color("reset"), ncolor=W.color("reset"),
room=room.alias, room=room.named_room_name(),
topic=room.topic)
else:
message = ('{prefix}Topic is "{topic}"').format(
prefix=W.prefix("network"),
topic=room.topic) topic=room.topic)
date = int(time.time()) date = int(time.time())

View file

@ -706,6 +706,7 @@ class RoomTopicEvent(RoomEvent):
nick_color=W.color(color_name), user=nick, ncolor=W.color("reset")) nick_color=W.color(color_name), user=nick, ncolor=W.color("reset"))
# TODO print old topic if configured so # TODO print old topic if configured so
if room.is_named():
message = ("{prefix}{nick} has changed " message = ("{prefix}{nick} has changed "
"the topic for {chan_color}{room}{ncolor} " "the topic for {chan_color}{room}{ncolor} "
"to \"{topic}\"").format( "to \"{topic}\"").format(
@ -713,7 +714,13 @@ class RoomTopicEvent(RoomEvent):
nick=author, nick=author,
chan_color=W.color("chat_channel"), chan_color=W.color("chat_channel"),
ncolor=W.color("reset"), ncolor=W.color("reset"),
room=room.display_name(server.user_id), room=room.named_room_name(),
topic=topic)
else:
message = ('{prefix}{nick} has changed the topic to '
'"{topic}"').format(
prefix=W.prefix("network"),
nick=author,
topic=topic) topic=topic)
tags = ["matrix_topic", "log3", "matrix_id_{}".format(self.event_id)] tags = ["matrix_topic", "log3", "matrix_id_{}".format(self.event_id)]