matrix2051
matrix2051 copied to clipboard
Rooms joined a while ago are ignored when they don't have a canonical alias
This typically happens for long-lived PMs.
I cannot figure out how to solve this.
This solves the issue, but causes rooms with a canonical alias to be shown as two channels (one named after the room ids and one after the canonical alias):
diff --git a/lib/matrix_client/poller.ex b/lib/matrix_client/poller.ex
index 11137ce..20c3d5b 100644
--- a/lib/matrix_client/poller.ex
+++ b/lib/matrix_client/poller.ex
@@ -357,6 +370,8 @@ defmodule M51.MatrixClient.Poller do
%M51.Matrix.RoomMember{display_name: displayname}
)
+ my_nick = M51.IrcConn.State.nick(irc_state)
if !state_event and !was_already_member do
my_nick = M51.IrcConn.State.nick(irc_state)
@@ -382,6 +397,15 @@ defmodule M51.MatrixClient.Poller do
end
end
+ if state_event and !was_already_member do
+ sender = nil
+ old_canonical_alias = nil
+ # make handle_joined_room() send channel welcome
+ {room_id, {sender, old_canonical_alias}}
+ else
+ nil
+ end
+
"leave" ->
params_tail =
case event do
@@ -409,6 +433,8 @@ defmodule M51.MatrixClient.Poller do
end
end
+ nil
+
"ban" ->
if !state_event do
send.(%M51.Irc.Command{
@@ -419,6 +445,8 @@ defmodule M51.MatrixClient.Poller do
})
end
+ nil
+
"invite" ->
if !state_event do
send.(%M51.Irc.Command{
@@ -429,15 +457,17 @@ defmodule M51.MatrixClient.Poller do
})
end
+ nil
+
_ ->
send.(%M51.Irc.Command{
tags: %{"account" => sender},
command: "NOTICE",
params: [channel, "Unexpected m.room.member event: " <> Kernel.inspect(event)]
})
- end
- nil
+ nil
+ end
end
def handle_event(
Should it work if you count 2 ppl chats as conversations?
2-people chats are just regular rooms, so yes. Typically rooms with no canonical_alias are these 2-people chats, that's why they are so common.