diff --git a/src/models/room.js b/src/models/room.js index 4f7ac3911..7e01eab64 100644 --- a/src/models/room.js +++ b/src/models/room.js @@ -174,6 +174,18 @@ function Room(roomId, opts) { } utils.inherits(Room, EventEmitter); +/** + * Gets the version of the room + * @returns {string} The version of the room, or null if it could not be determined + */ +Room.prototype.getVersion = function() { + const createEvent = this.currentState.getStateEvents("m.room.create", ""); + if (!createEvent) return null; + const ver = createEvent.getContent()['room_version']; + if (ver === undefined) return '1'; + return ver; +}; + /** * Get the list of pending sent events for this room *