Changes the name of a Room.

Namespace: Sfs2X.Requests
Assembly: SmartFox2X (in SmartFox2X.dll) Version: 1.7.3.0 (1.7.3)

Syntax

C#
public class ChangeRoomNameRequest : BaseRequest

Remarks

If the renaming operation is successful, the ROOM_NAME_CHANGE event is dispatched to all the users who subscribed the Group to which the target Room belongs, including the user who renamed it. If the user is not the creator (owner) of the Room, or if the new name doesn't match the related criteria in Zone configuration, the ROOM_NAME_CHANGE_ERROR event is fired. An administrator or moderator can override this constrain (he is not requested to be the Room's owner).
If the Room was configured so that renaming is not allowed (see the RoomSettings.Permissions parameter), the request is ignored and no error is fired.

Examples

The following example renames an existing Room:
 Copy imageCopy
void SomeMethod() {
    sfs.AddEventListener(SFSEvent.ROOM_NAME_CHANGE, OnRoomNameChange);
    sfs.AddEventListener(SFSEvent.ROOM_NAME_CHANGE_ERROR, OnRoomNameChangeError);
    Room theRoom = sfs.GetRoomByName("Gonzo's Room");
    sfs.Send( new ChangeRoomNameRequest(theRoom, "Gonzo The Great's Room") );
}
void OnRoomNameChange(BaseEvent evt) {
    Room theRoom = (Room)evt.Params["room"];
    Console.WriteLine("Room " + (string)evt.Params["oldName"] + " was successfully renamed to " + theRoom.Name);                        // .Net / Unity
    System.Diagnostics.Debug.WriteLine("Room " + (string)evt.Params["oldName"] + " was successfully renamed to " + theRoom.Name);       // Windows Universal
}
void OnRoomNameChangeError(BaseEvent evt) {
    Console.WriteLine("Room name change failed: " + (string)evt.Params["errorMessage"]);                        // .Net / Unity
    System.Diagnostics.Debug.WriteLine("Room name change failed: " + (string)evt.Params["errorMessage"]);       // Windows Universal
}

Inheritance Hierarchy

System..::..Object
  BaseRequest
    Sfs2X.Requests..::..ChangeRoomNameRequest

See Also