# RakNet::RoomsPlugin Class Reference
[RoomsPlugin]

Used to create rooms for players where they can matchmake A room is similar to the rooms you see in other lobby systems, where groups of players can join together in order to start a game match Each player can be in at most one room Each player name must be unique Each room has one moderator, which can perform operations on the room such as kicking out members This plugin networks the AllGamesRoomsContainer class, which performs the actual functionality. More...

`#include <RoomsPlugin.h>`

Inheritance diagram for RakNet::RoomsPlugin:

List of all members.

## Public Member Functions
void | SetOrderingChannel (char oc)
| Ordering channel to send messages on.
void | SetSendPriority (PacketPriority pp)
| Send priority to send messages on.
void | SetRoomsCallback (RoomsCallback *_roomsCallback)
| Set the callback to get notification and ExecuteFunc() results.
void | ExecuteFunc (RoomsPluginFunc *func)
| Execute a function, using the system address passed to SetServerAddress();.
void | ExecuteFunc (RoomsPluginFunc *func, SystemAddress remoteAddress)
| Execute a function, with a specific address.
void | SetServerAddress (SystemAddress systemAddress)
bool | LoginRoomsParticipant (RakNet::RakString userName, SystemAddress roomsParticipantAddress, SystemAddress loginServerAddress)
bool | LogoffRoomsParticipant (RakNet::RakString userName, SystemAddress loginServerAddress)
void | ClearRoomMembers ()
| Clear all users.
void | AddLoginServerAddress (SystemAddress systemAddress)
void | RemoveLoginServerAddress (SystemAddress systemAddress)
void | ClearLoginServerAdddresses (void)
| Remove all addresses added with AddLoginServerAddress().
void | SetProfanityFilter (ProfanityFilter *pf)
virtual void | OnDetach (void)
virtual void | OnShutdown (void)
| Called when RakPeer is shutdown.
virtual void | Update (void)
| Update is called every time a packet is checked for .
virtual PluginReceiveResult | OnReceive (Packet *packet)
virtual void | OnClosedConnection (SystemAddress systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason)
## Public Attributes
AllGamesRoomsContainer | roomsContainer

## Detailed Description

Used to create rooms for players where they can matchmake A room is similar to the rooms you see in other lobby systems, where groups of players can join together in order to start a game match Each player can be in at most one room Each player name must be unique Each room has one moderator, which can perform operations on the room such as kicking out members This plugin networks the AllGamesRoomsContainer class, which performs the actual functionality.

To use as a client: 1. Connect to the server and attach the plugin as normal. 2. Call SetServerAddress to tell the system where the server is. 3. Call RoomsPlugin::SetRoomsCallback() with a pointer to a callback structure 4. Fill in the input parameters of the desired structure(s) 5. Call RoomsPlugin::ExecuteFunc with a pointer to the structure. 6. Process the callback, which will contain the original input parameters, plus the new output parameters. All structures contain resultCode, which indicates if the operation was successful (REC_SUCCESS) or not (Anything else)

To use as a server: 1. Start RakNet as usual, accepting connections and attaching the plugin 2. Call RoomsPlugin::SetProfanityFilter() with the ProfanityFilter class, if desired 3. Call RoomsPlugin::AddTitle() for each title (game) you want to support 4. If you want other systems to be able to call RoomsPlugin::LoginRoomsParticipant(), call RoomsPlugin::AddLoginServerAddress() with the addresses of those systems 5. As users go online, call RoomsPlugin::LoginRoomsParticipant(). Login and Logoff is up to you to implement (or rely on other systems, such as Lobby2) 6. As users go offline, call RoomsPlugin::LogoffRoomsParticipant();

See also:
  AllGamesRoomsContainer

## Member Function Documentation

void RoomsPlugin::AddLoginServerAddress | ( | SystemAddress | systemAddress | ) |

Add a SystemAddress to a list that will be checked when LoginRoomsParticipant() and LogoffRoomsParticipant() is called

Parameters:

  `[in]` | systemAddress | The address to add

bool RoomsPlugin::LoginRoomsParticipant | ( | RakNet::RakString | userName,
|  | SystemAddress | roomsParticipantAddress,
|  | SystemAddress | loginServerAddress |
| ) |  |  |

Add a participant to the system Only participants can perform operations

Parameters:

  `[in]` | userName | A unique string identifying the user
  `[in]` | roomsParticipantAddress | The address of the user
  `[in]` | loginServerAddress | The server adding this user. Use UNASSIGNED_SYSTEM_ADDRESS for not applicable. Otherwise, the address must previously have been added using AddLoginServerAddress() or the function will fail.

bool RoomsPlugin::LogoffRoomsParticipant | ( | RakNet::RakString | userName,
|  | SystemAddress | loginServerAddress |
| ) |  |  |

Removes a participant from the system

Parameters:

  `[in]` | userName | A unique string identifying the user
  `[in]` | loginServerAddress | The server removing. Use UNASSIGNED_SYSTEM_ADDRESS for not applicable. Otherwise, the address must previously have been added using AddLoginServerAddress() or the function will fail.

void RoomsPlugin::OnClosedConnection | ( | SystemAddress | systemAddress,
|  | RakNetGUID | rakNetGUID,
|  | PI2_LostConnectionReason | lostConnectionReason |
| ) |  |  | `[virtual]`

Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system

Parameters:

  `[in]` | systemAddress | The system whose connection was closed
  `[in]` | rakNetGuid | The guid of the specified system
  `[in]` | lostConnectionReason | How the connection was closed: manually, connection lost, or notification of disconnection

Reimplemented from PluginInterface2.

void RoomsPlugin::OnDetach | ( | void |  | ) | `[virtual]`

Called when the interface is detached

Parameters:

  `[in]` | peer | the instance of RakPeer that is calling Receive

Reimplemented from PluginInterface2.

PluginReceiveResult RoomsPlugin::OnReceive | ( | Packet * | packet | ) | `[virtual]`

OnReceive is called for every packet.

Parameters:

  `[in]` | packet | the packet that is being returned to the user

Returns:
  True to allow the game and other plugins to get this message, false to absorb it

Reimplemented from PluginInterface2.

void RoomsPlugin::RemoveLoginServerAddress | ( | SystemAddress | systemAddress | ) |

Remove a SystemAddress from a list that will be checked when LoginRoomsParticipant() and LogoffRoomsParticipant() is called

Parameters:

  `[in]` | systemAddress | The address to remove

void RoomsPlugin::SetProfanityFilter | ( | ProfanityFilter * | pf | ) |

Sets the profanity filter for the system to use (optional) If set, room names and player handles will be checked for profanity. Room invitations and other messages are not checked.

Parameters:

  `[in]` | pf | An instance of a profanity filter

void RoomsPlugin::SetServerAddress | ( | SystemAddress | systemAddress | ) |

Sets the remote server address that is running RoomsPlugin. Send calls will go to this function

Parameters:

  `[in]` | systemAddress | The remote system, which should be connected while calling client functions

## Member Data Documentation

AllGamesRoomsContainer RakNet::RoomsPlugin::roomsContainer

Only used on the server. Locally perform any desired functions, such as logging off players Use AllGamesRoomsContainer::AddTitle() to add titles

The documentation for this class was generated from the following files:

- C:/RakNet/DependentExtensions/Lobby2/Rooms/RoomsPlugin.h
- C:/RakNet/DependentExtensions/Lobby2/Rooms/RoomsPlugin.cpp