ggz.client.core
Interface ServerListener

All Superinterfaces:
java.util.EventListener
All Known Implementing Classes:
ClientApplet, PrivateChatDialog.ChatDialogManager, ServerAdapter

public interface ServerListener
extends java.util.EventListener

A GGZServerEvent is an event triggered by a communication from the server. Each time an event occurs, the associated event handler will be called, and will be passed the event data (a void*). Most events are generated as a result of ggzcore_server_read_data.

See Also:
ggzcore_server_add_event_hook

Method Summary
 void server_channel_connected()
          Status event: a requested direct game connection has been established.
 void server_channel_fail(java.lang.String error)
          Error: Failure during setup of direct connection to game server.
 void server_channel_ready()
          Game channel is ready for read/write operations.
 void server_chat_fail(ErrorEventData data)
          Error: A chat message could not be sent.
 void server_connect_fail(java.lang.String error)
          Error: we have failed to connect to the server.
 void server_connected()
          We have just made a connection to the server.
 void server_enter_fail(ErrorEventData data)
          Error: we have tried to enter a room and failed.
 void server_enter_ok()
          We have successfully entered a room.
 void server_list_rooms()
          The room list arrived.
 void server_list_types()
          The list of game types is available.
 void server_logged_out()
          Logged out of the server.
 void server_login_fail(ErrorEventData data)
          Error: login failure.
 void server_login_ok()
          We have successfully logged in.
 void server_motd_loaded(MotdEventData data)
          The MOTD has been read from the server and can be displayed.
 void server_negotiate_fail(java.lang.String error)
          Error: negotiation failure.
 void server_negotiated()
          We have negotiated a connection to the server.
 void server_net_error(java.lang.String error)
          Error: a network (transmission) error occurred.
 void server_players_changed()
          The number of players on the server has changed.
 void server_protocol_error(java.lang.String error)
          Error: a communication protocol error occured.
 void server_rooms_changed()
          A room has either been added, deleted or set to "closed".
 void server_state_changed()
          The internal state of ggzcore has changed.
 

Method Detail

server_connected

void server_connected()
We have just made a connection to the server. After this point the server's socket should be accessible and should be monitored for data. It happens in direct response to ggzcore_server_connect. Note that most events after this will only happen by calling ggzcore_server_read_data on the server's FD!

Parameters:
data - NULL
See Also:
ggzcore_server_connect

server_connect_fail

void server_connect_fail(java.lang.String error)
Error: we have failed to connect to the server. This is generated in place of GGZ_CONNECTED if the connection could not be made. The server object is otherwise unaffected.

Parameters:
data - An error string (created by strerror)
See Also:
ggzcore_server_connect

server_negotiated

void server_negotiated()
We have negotiated a connection to the server. This will happen automatically once a connection has been established, if the server socket is monitored.

Parameters:
data - NULL
See Also:
ggzcore_server_read_data

server_negotiate_fail

void server_negotiate_fail(java.lang.String error)
Error: negotiation failure. Could be the wrong version. This will happen in place of a GGZ_NEGOTIATED if the server could not be negotiated with.

Parameters:
data - A useless error string.
See Also:
ggzcore_server_read_data

server_login_ok

void server_login_ok()
We have successfully logged in. We can now start doing stuff. This will not happen until the client sends their login information.

Parameters:
data - NULL
See Also:
ggzcore_server_login, ggzcore_server_read_data

server_login_fail

void server_login_fail(ErrorEventData data)
Error: login failure. This will happen in place of GGZ_LOGGED_IN if the login failed. The server object will be otherwise unaffected.

Parameters:
data - A pointer to a GGZErrorEventData.
See Also:
GGZErrorEventData, ggzcore_server_read_data

server_motd_loaded

void server_motd_loaded(MotdEventData data)
The MOTD has been read from the server and can be displayed. The server will send us the MOTD automatically after login; it can also be requested by ggzcore_server_motd. It is up to the client whether or not to display it. See the online documentation (somewhere?) about the MOTD markup format.

Parameters:
data - Pointer to a GGZMotdEventData including the full MOTD text.
See Also:
ggzcore_server_motd, ggzcore_server_read_data!

server_list_rooms

void server_list_rooms()
The room list arrived. This will only happen after the list is requested by ggzcore_server_list_rooms(). The list may be accessed through ggzcore_server_get_num_rooms() and ggzcore_server_get_nth_room(). Until this event arrives these functions will be useless!

Parameters:
data - NULL
See Also:
ggzcore_server_read_data

server_list_types

void server_list_types()
The list of game types is available. This will only happen after the list is requested by ggzcore_server_list_types(). The list may be accessed through ggzcore_server_get_num_gametypes() and ggzcore_server_get_nth_gametype(). Until this event arrives these functions will be useless!

Parameters:
data - NULL
See Also:
ggzcore_server_read_data

server_players_changed

void server_players_changed()
The number of players on the server has changed. This event is issued rather frequently every time players enter or leave.

Parameters:
data - NULL
See Also:
ggzcore_server_get_num_players, ggzcore_server_read_data

server_rooms_changed

void server_rooms_changed()
A room has either been added, deleted or set to "closed".


server_enter_ok

void server_enter_ok()
We have successfully entered a room. This will be issued to tell us a room join has succeeded, after it has been requested.

Parameters:
data - NULL
See Also:
ggzcore_server_join_room, ggzcore_server_read_data

server_enter_fail

void server_enter_fail(ErrorEventData data)
Error: we have tried to enter a room and failed. This will be issued to tell us a room join has failed.

Parameters:
data - A pointer to a GGZErrorEventData.
See Also:
GGZErrorEventData, ggzcore_server_join_room, ggzcore_server_read_data

server_logged_out

void server_logged_out()
Logged out of the server. This will happen when the server completes the communication; usually after ggzcore_net_send_logout is called.

Parameters:
data - NULL
See Also:
ggzcore_server_read_data

server_net_error

void server_net_error(java.lang.String error)
Error: a network (transmission) error occurred. The server will automatically disconnect.

Parameters:
data - A generally unhelpful error string.
See Also:
ggzcore_server_read_data

server_protocol_error

void server_protocol_error(java.lang.String error)
Error: a communication protocol error occured. This can happen in a variety of situations when the server sends us something we can't handle. The server will be automatically disconnected.

Parameters:
data - A technical error string.
See Also:
ggzcore_server_read_data

server_chat_fail

void server_chat_fail(ErrorEventData data)
Error: A chat message could not be sent. This will happen when we try to send a chat and the server rejects it.

Parameters:
data - A pointer to a GGZErrorEventData.
See Also:
GGZErrorEventData, ggzcore_server_read_data

server_state_changed

void server_state_changed()
The internal state of ggzcore has changed. This may happen at any time.

Parameters:
data - NULL
See Also:
GGZStateID, ggzcore_server_get_state

server_channel_connected

void server_channel_connected()
Status event: a requested direct game connection has been established. To start a game (table), a channel must be created. This event will alert that the channel has been established. The channel's FD should then be monitored for input, which should then be passed back to the server object for handling.

Parameters:
data - NULL
See Also:
ggzcore_server_get_channel, ggzcore_server_read_data

server_channel_ready

void server_channel_ready()
Game channel is ready for read/write operations. After the channel has been connected, if we continue to monitor the socket eventually it will be negotiated and ready to use. At this point it is ready for the game client to use.

Parameters:
data - NULL
See Also:
ggzcore_server_read_data

server_channel_fail

void server_channel_fail(java.lang.String error)
Error: Failure during setup of direct connection to game server. If the channel could not be prepared, this event will happen instead of GGZ_CHANNEL_READY or GGZ_CHANNEL_CONNECTED event. At this point the channel is no longer useful (I think).

Parameters:
data - An unhelpful error string
See Also:
ggzcore_server_read_data