Home Previous Up Next Index

Murmur::Server

Overview

[ "amd" ] interface Server

Per-server interface. This includes all methods for configuring and altering the state of a single virtual server. You can retrieve a pointer to this interface from one of the methods in Meta.

Operation Index

isRunning
Shows if the server currently running (accepting players).
start
Start server.
stop
Stop server.
delete
Delete server and all it's configuration.
id
Fetch the server id.
addCallback
Add a callback.
removeCallback
Remove a callback.
setAuthenticator
Set external authenticator.
getConf
Retrieve configuration item.
getAllConf
Retrieve all configuration items.
setConf
Set a configuration item.
setSuperuserPassword
Set superuser password.
getLog
Fetch log entries.
getPlayers
Fetch all players.
getChannels
Fetch all channels.
getTree
Fetch all channels and connected players as a tree.
getBans
Fetch all current IP bans on the server.
setBans
Set all current IP bans on the server.
kickPlayer
Kick a player.
getState
Get state of a single connected player.
setState
Set player state.
sendMessage
Send text message to a single player.
hasPermission
Check if player is permitted to perform action.
addContextCallback
Add a context callback.
removeContextCallback
Remove a callback.
getChannelState
Get state of single channel.
setChannelState
Set state of a single channel.
removeChannel
Remove a channel and all its subchannels.
addChannel
Add a new channel.
sendMessageChannel
Send text message to channel or a tree of channels.
getACL
Retrieve ACLs and Groups on a channel.
setACL
Set ACLs and Groups on a channel.
getPlayerNames
Map a list of Player::playerid or RegisteredPlayer::playerid to a matching name.
getPlayerIds
Map a list of player names to a matching RegisteredPlayer::playerid.
registerPlayer
Register a new player.
unregisterPlayer
Remove a player registration.
updateregistration
Update the registration for a player.
getRegistration
Fetch registration for a single player.
getRegisteredPlayers
Fetch a group of registered players.
verifyPassword
Verify the password of a player.
getTexture
Fetch user texture.
setTexture
Set user texture.

Operations

bool isRunning()

Shows if the server currently running (accepting players).

Return Value

Run-state of server.

void start() throws ServerBootedException, ServerFailureException

Start server.

void stop() throws ServerBootedException

Stop server.

void delete() throws ServerBootedException

Delete server and all it's configuration.

int id()

Fetch the server id.

Return Value

Unique server id.

void addCallback(ServerCallback* cb) throws ServerBootedException, InvalidCallbackException

Add a callback. The callback will receive notifications about changes to players and channels.

Parameters

cb
Callback interface which will receive notifications.

See Also

removeCallback

void removeCallback(ServerCallback* cb) throws ServerBootedException, InvalidCallbackException

Remove a callback.

Parameters

cb
Callback interface to be removed.

See Also

addCallback

void setAuthenticator(ServerAuthenticator* auth) throws ServerBootedException, InvalidCallbackException

Set external authenticator. If set, all authentications from clients are forwarded to this proxy.

Parameters

auth
Authenticator object to perform subsequent authentications.

string getConf(string key)

Retrieve configuration item.

Parameters

key
Configuration key.

Return Value

Configuration value. If this is empty, see Meta::getDefaultConf

ConfigMap getAllConf()

Retrieve all configuration items.

Return Value

All configured values. If a value isn't set here, the value from Meta::getDefaultConf is used.

void setConf(string key, string value)

Set a configuration item.

Parameters

key
Configuration key.
value
Configuration value.

void setSuperuserPassword(string pw)

Set superuser password. This is just a convenience for using updateregistration on player id 0.

Parameters

pw
Password.

LogList getLog(int first, int last)

Fetch log entries.

Parameters

first
Lowest numbered entry to fetch. 0 is the most recent item.
last
Last entry to fetch.

Return Value

List of log entries.

PlayerMap getPlayers() throws ServerBootedException

Fetch all players. This returns all currently connected players on the server.

Return Value

List of connected players.

See Also

getState

ChannelMap getChannels() throws ServerBootedException

Fetch all channels. This returns all defined channels on the server. The root channel is always channel 0.

Return Value

List of defined channels.

See Also

getChannelState

Tree getTree() throws ServerBootedException

Fetch all channels and connected players as a tree. This retrieves an easy-to-use representation of the server as a tree. This is primarily used for viewing the state of the server on a webpage.

Return Value

Recursive tree of all channels and connected players.

BanList getBans() throws ServerBootedException

Fetch all current IP bans on the server.

Return Value

List of bans.

void setBans(BanList bans) throws ServerBootedException

Set all current IP bans on the server. This will replace any bans already present, so if you want to add a ban, be sure to call getBans and then append to the returned list before calling this method.

Parameters

bans
List of bans.

void kickPlayer(int session, string reason) throws ServerBootedException, InvalidSessionException

Kick a player. The player is not banned, and is free to rejoin the server.

Parameters

session
Connection ID of player. See Player::session.
reason
Text message to show when player is kicked.

Player getState(int session) throws ServerBootedException, InvalidSessionException

Get state of a single connected player.

Parameters

session
Connection ID of player. See Player::session.

Return Value

State of connected player.

See Also

setState
getPlayers

void setState(Player state) throws ServerBootedException, InvalidSessionException, InvalidChannelException

Set player state. You can use this to move, mute and deafen players.

Parameters

state
Player state to set.

See Also

getState

void sendMessage(int session, string text) throws ServerBootedException, InvalidSessionException

Send text message to a single player.

Parameters

session
Connection ID of player. See Player::session.
text
Message to send.

See Also

sendMessageChannel

bool hasPermission(int session, int channelid, int perm) throws ServerBootedException, InvalidSessionException, InvalidChannelException

Check if player is permitted to perform action.

Parameters

session
Connection ID of player. See Player::session.
channelid
ID of Channel. See Channel::id.
perm
Permission bits to check.

Return Value

true if any of the permissions in perm were set for the user.

void addContextCallback(int session, string action, string text, ServerContextCallback* cb, int ctx) throws ServerBootedException, InvalidCallbackException

Add a context callback. This is done per player, and will add a context menu action for the player.

Parameters

session
Session of user which should receive context entry.
action
Action string, a unique name to associate with the action.
text
Name of action shown to user.
cb
Callback interface which will receive notifications.
ctx
Context this should be used in. Needs to be one or a combination of ContextServer, ContextChannel and ContextPlayer.

See Also

removeContextCallback

void removeContextCallback(ServerContextCallback* cb) throws ServerBootedException, InvalidCallbackException

Remove a callback.

Parameters

cb
Callback interface to be removed. This callback will be removed from all from all players.

See Also

addContextCallback

Channel getChannelState(int channelid) throws ServerBootedException, InvalidChannelException

Get state of single channel.

Parameters

channelid
ID of Channel. See Channel::id.

Return Value

State of channel.

See Also

setChannelState
getChannels

void setChannelState(Channel state) throws ServerBootedException, InvalidChannelException

Set state of a single channel. You can use this to move or relink channels.

Parameters

state
Channel state to set.

See Also

getChannelState

void removeChannel(int channelid) throws ServerBootedException, InvalidChannelException

Remove a channel and all its subchannels.

Parameters

channelid
ID of Channel. See Channel::id.

int addChannel(string name, int parent) throws ServerBootedException, InvalidChannelException

Add a new channel.

Parameters

name
Name of new channel.
parent
Channel ID of parent channel. See Channel::id.

Return Value

ID of newly created channel.

void sendMessageChannel(int channelid, bool tree, string text) throws ServerBootedException, InvalidChannelException

Send text message to channel or a tree of channels.

Parameters

channelid
Channel ID of channel to send to. See Channel::id.
tree
If true, the message will be sent to the channel and all its subchannels.
text
Message to send.

See Also

sendMessage

void getACL(int channelid, out ACLList acls, out GroupList groups, out bool inherit) throws ServerBootedException, InvalidChannelException

Retrieve ACLs and Groups on a channel.

Parameters

channelid
Channel ID of channel to fetch from. See Channel::id.
acls
List of ACLs on the channel. This will include inherited ACLs.
groups
List of groups on the channel. This will include inherited groups.
inherit
Does this channel inherit ACLs from the parent channel?

void setACL(int channelid, ACLList acls, GroupList groups, bool inherit) throws ServerBootedException, InvalidChannelException

Set ACLs and Groups on a channel. Note that this will replace all existing ACLs and groups on the channel.

Parameters

channelid
Channel ID of channel to fetch from. See Channel::id.
acls
List of ACLs on the channel.
groups
List of groups on the channel.
inherit
Should this channel inherit ACLs from the parent channel?

NameMap getPlayerNames(IdList ids) throws ServerBootedException

Map a list of Player::playerid or RegisteredPlayer::playerid to a matching name.

Parameters

List
of ids.

Return Value

Matching list of names, with an empty string representing invalid or unknown ids.

IdMap getPlayerIds(NameList names) throws ServerBootedException

Map a list of player names to a matching RegisteredPlayer::playerid. @reuturn List of matching ids, with -1 representing invalid or unknown player names.

Parameters

List
of names.

int registerPlayer(string name) throws ServerBootedException, InvalidPlayerException

Register a new player.

Parameters

name
Name of player to register.

Return Value

The ID of the player. See RegisteredPlayer::playerid.

void unregisterPlayer(int playerid) throws ServerBootedException, InvalidPlayerException

Remove a player registration.

Parameters

playerid
ID of registered player. See RegisteredPlayer::playerid.

void updateregistration(RegisteredPlayer registration) throws ServerBootedException, InvalidPlayerException

Update the registration for a player. You can use this to set the email or password of a player, and can also use it to change the player's name.

Parameters

registration
Updated registration record.

RegisteredPlayer getRegistration(int playerid) throws ServerBootedException, InvalidPlayerException

Fetch registration for a single player.

Parameters

playerid
ID of registered player. See RegisteredPlayer::playerid.

Return Value

Registration record.

RegisteredPlayerList getRegisteredPlayers(string filter) throws ServerBootedException

Fetch a group of registered players.

Parameters

filter
Substring of player name. If blank, will retrieve all registered players.

Return Value

List of registration records.

int verifyPassword(string name, string pw) throws ServerBootedException

Verify the password of a player. You can use this to verify a player's credentials.

Parameters

name
Player name. See RegisteredPlayer::name.
pw
Player password.

Return Value

Player ID of registered player (See RegisteredPlayer::playerid), -1 for failed authentication or -2 for unknown usernames.

Texture getTexture(int playerid) throws ServerBootedException, InvalidPlayerException

Fetch user texture. Textures are stored as zlib compress()ed 600x60 32-bit RGBA data.

Parameters

playerid
ID of registered player. See RegisteredPlayer::playerid.

Return Value

Custom texture associated with player or an empty texture.

void setTexture(int playerid, Texture tex) throws ServerBootedException, InvalidPlayerException, InvalidTextureException

Set user texture. The texture is a 600x60 32-bit RGBA raw texture, optionally zlib compress()ed.

Parameters

playerid
ID of registered player. See RegisteredPlayer::playerid.
tex
Texture to set for the player, or an empty texture to remove the existing texture.

Home Previous Up Next Index