Package sfs2x.client.requests
Class ChangeRoomNameRequest
- java.lang.Object
-
- sfs2x.client.requests.BaseRequest
-
- sfs2x.client.requests.ChangeRoomNameRequest
-
- All Implemented Interfaces:
sfs2x.client.requests.IRequest
public class ChangeRoomNameRequest extends BaseRequest
Changes the name of a Room.If the renaming operation is successful, the roomNameChange 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 the roomNameChangeError event if fired. An administrator or moderator can override the first 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.
Example
The following example renames an existing Room:private void someMethod() { sfs.addEventListener(SFSEvent.ROOM_NAME_CHANGE, new IEventListener() { public void dispatch(BaseEvent evt) throws SFSException { System.out.println("Room " + evt.getArguments().get("oldName") + " was successfully renamed to " + ((Room)evt.getArguments().get("room")).getName()); } }); sfs.addEventListener(SFSEvent.ROOM_NAME_CHANGE_ERROR, new IEventListener() { public void dispatch(BaseEvent evt) throws SFSException { System.out.println("Room name change failed: " + evt.getArguments().get("errorMessage")); } }); Room theRoom = sfs.getRoomByName("Gonzo's Room"); // Rename the Room to a new name sfs.send(new ChangeRoomNameRequest(theRoom, "Gonzo The Great's Room")); }
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
KEY_NAME
* API internal usage only *static java.lang.String
KEY_ROOM
* API internal usage only *-
Fields inherited from class sfs2x.client.requests.BaseRequest
AddBuddy, AdminMessage, AutoJoin, BanUser, BlockBuddy, CallExtension, ChangeRoomCapacity, ChangeRoomName, ChangeRoomPassword, ClusterInviteUsers, ClusterJoinOrCreate, CreateRoom, CreateSFSGame, FindRooms, FindUsers, GameServerConnectionRequired, GenericMessage, GetRoomList, GoOnline, Handshake, InitBuddyList, InvitationReply, InviteUser, JoinRoom, JoinRoomInvite, KEY_ERROR_CODE, KEY_ERROR_PARAMS, KickUser, LeaveRoom, Login, Logout, ManualDisconnection, ModeratorMessage, ObjectMessage, PingPong, PlayerToSpectator, PrivateMessage, PublicMessage, QuickJoinGame, QuickJoinOrCreateRoom, RemoveBuddy, SetBuddyVariables, SetRoomVariables, SetUserPosition, SetUserVariables, SpectatorToPlayer, SubscribeRoomGroup, UnsubscribeRoomGroup
-
-
Constructor Summary
Constructors Constructor Description ChangeRoomNameRequest(Room room, java.lang.String newName)
Creates a new ChangeRoomNameRequest instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
execute(ISmartFox sfs)
* API internal usage only *void
validate(ISmartFox sfs)
* API internal usage only *-
Methods inherited from class sfs2x.client.requests.BaseRequest
getId, getMessage, getTargetController, isEncrypted, setEncrypted, setId, setTargetController
-
-
-
-
Field Detail
-
KEY_ROOM
public static final java.lang.String KEY_ROOM
* API internal usage only *- See Also:
- Constant Field Values
-
KEY_NAME
public static java.lang.String KEY_NAME
* API internal usage only *
-
-
Constructor Detail
-
ChangeRoomNameRequest
public ChangeRoomNameRequest(Room room, java.lang.String newName)
Creates a new ChangeRoomNameRequest instance. The instance must be passed to the SmartFox.send() method for the request to be performed.- Parameters:
room
- The Room object corresponding to the Room whose name should be changed.newName
- The new name to be assigned to the Room.- See Also:
SmartFox.send(sfs2x.client.requests.IRequest)
-
-