Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rooms joined a while ago are ignored when they don't have a canonical alias #29

Open
progval opened this issue Jul 23, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@progval
Copy link
Owner

progval commented Jul 23, 2022

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(
@progval progval added the bug Something isn't working label Jul 23, 2022
@Thaodan
Copy link
Contributor

Thaodan commented Oct 1, 2022

Should it work if you count 2 ppl chats as conversations?

@progval
Copy link
Owner Author

progval commented Oct 1, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants