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:
parent
654e39077d
commit
02bb64feab
3 changed files with 31 additions and 17 deletions
|
@ -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"
|
||||||
|
|
|
@ -918,13 +918,18 @@ 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 '
|
||||||
prefix=W.prefix("network"),
|
'"{topic}"').format(
|
||||||
color=W.color("chat_buffer"),
|
prefix=W.prefix("network"),
|
||||||
ncolor=W.color("reset"),
|
color=W.color("chat_buffer"),
|
||||||
room=room.alias,
|
ncolor=W.color("reset"),
|
||||||
topic=room.topic)
|
room=room.named_room_name(),
|
||||||
|
topic=room.topic)
|
||||||
|
else:
|
||||||
|
message = ('{prefix}Topic is "{topic}"').format(
|
||||||
|
prefix=W.prefix("network"),
|
||||||
|
topic=room.topic)
|
||||||
|
|
||||||
date = int(time.time())
|
date = int(time.time())
|
||||||
topic_date = room.topic_date.strftime("%a, %d %b %Y "
|
topic_date = room.topic_date.strftime("%a, %d %b %Y "
|
||||||
|
|
|
@ -706,15 +706,22 @@ 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
|
||||||
message = ("{prefix}{nick} has changed "
|
if room.is_named():
|
||||||
"the topic for {chan_color}{room}{ncolor} "
|
message = ("{prefix}{nick} has changed "
|
||||||
"to \"{topic}\"").format(
|
"the topic for {chan_color}{room}{ncolor} "
|
||||||
prefix=W.prefix("network"),
|
"to \"{topic}\"").format(
|
||||||
nick=author,
|
prefix=W.prefix("network"),
|
||||||
chan_color=W.color("chat_channel"),
|
nick=author,
|
||||||
ncolor=W.color("reset"),
|
chan_color=W.color("chat_channel"),
|
||||||
room=room.display_name(server.user_id),
|
ncolor=W.color("reset"),
|
||||||
topic=topic)
|
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)
|
||||||
|
|
||||||
tags = ["matrix_topic", "log3", "matrix_id_{}".format(self.event_id)]
|
tags = ["matrix_topic", "log3", "matrix_id_{}".format(self.event_id)]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue