Class MatrixRoomIdUtils

java.lang.Object
io.meeds.chat.service.utils.MatrixRoomIdUtils

public final class MatrixRoomIdUtils extends Object
Room identifiers come in two shapes. Up to room version 11 a room id is !<localpart>:<server_name>, and the space rooms this addon created are stored with the :<server_name> part removed. From room version 12 (MSC4291) the room id is the create event's reference hash, !<43 URL-safe base64 characters>, with no server part at all, so it is already complete and is used as is.
  • Method Details

    • isHashRoomId

      public static boolean isHashRoomId(String roomId)
      Parameters:
      roomId - a room id as stored or as received from Synapse
      Returns:
      true when the id is a room version 12 (MSC4291) id, which carries no server part
    • toFullRoomId

      public static String toFullRoomId(String roomId)
      Parameters:
      roomId - a room id as stored: complete (!<localpart>:<server_name> or a room version 12 id), or a legacy id stored without its server part
      Returns:
      the room id to send to Synapse
    • toStoredRoomId

      public static String toStoredRoomId(String fullRoomId)
      Parameters:
      fullRoomId - the room id returned by Synapse
      Returns:
      the id to store: without the :<server_name> part when it ends with this server's name, unchanged otherwise (a room version 12 id has no server part)