diff --git a/lib/models/room-state.js b/lib/models/room-state.js index d5cf12bf8..b4064dac5 100644 --- a/lib/models/room-state.js +++ b/lib/models/room-state.js @@ -224,6 +224,20 @@ RoomState.prototype.getUserIdsWithDisplayName = function(displayName) { return this._displayNameToUserIds[displayName] || []; }; +/** + * Returns true if the given MatrixClient has permission to send a state + * event of type `stateEventType` into this room. + * @param {string} type The type of state events to test + * @param {MatrixClient} The client to test permission for + * @return {boolean} true if the given client should be permitted to send + * the given type of state event into this room, + * according to the room's state. + */ +RoomState.prototype.mayClientSendStateEvent = function(stateEventType, cli) { + if (cli.isGuest()) return false; + return this.maySendStateEvent(stateEventType, cli.credentials.userId); +}; + /** * Returns true if the given user ID has permission to send a state * event of type `stateEventType` into this room.