MultiUserGamePluginAPI

From Pidgin Games

Jump to: navigation, search

Contents

[edit] Multi-User Game Plugin API Reference

This API contains every communication between game plugins and the multi-user game(mug) support plugin. It is realized with the libpurple's IPC which unfortunately is still undocumented.

Green methods will be send from your plugin to the mug support plugin. Orange methods will be emitted by the mug support which means that you have to provide them.

Note: This page describes the current status of the API as of plugin version 0.6.0 and is not final. Any existing calls are not likely to change though.

[edit] Registering

[edit] mug-game-register

void (*mug_game_register)(char *game_id, PurplePlugin *plugin, char *name);

Description
Emitted when your plugin wants to register a game. On Emitting mug support will register all orange signals for the game with your plugin as recipient.
Parameters
game_id The namespace of the game
plugin The purple plugin handle
name The game's human-readable name

[edit] mug-game-unregister

void (*mug_game_unregister)(char *game_id);

Description
Emitted when your plugin wants to unregister a game, e.g. on unloading or if user disabled the game in a multi-user game plugin.
Parameters
game_id The namespace of the game

[edit] Room

[edit] mug-room-create

void (*mug_create_room)(char *room_id, char *status, char *state, char *alias);

Description
Emitted when the user wants to enter a new room. On receiving, your plugin should present the game UI to the user.
Parameters
room_id The unique id of the room
status The current status of the match
state The current state of the match
alias Your user's nick name inside the room

[edit] mug-room-leave

void (*mug_room_leave)(char *room_id);

Description
Emitted when you want to leave the room.
Parameters
room_id The unique id of the room

[edit] Users

[edit] mug-user-status-update

void (*mug_user_status_update)(char *room_id, char *user, char *affiliation, char *role);

Description
Emitted when a user's status changed.
Parameters
room_id The unique id of the room
user The user's current nick inside the room
affiliation The user's current affiliation with the room
role The user's role inside the match

[edit] mug-user-left

void (*mug_user_left)(char *room_id, char *user);

Description
Emitted when a user left the room
Parameters
room_id The unique id of the room
user The user's current nick inside the room

[edit] mug-user-sent-start

void (*mug_user_sent_start)(char *room_id, char *user);

Description
Emitted when a user sent his start message signalling that he's ready to start the match.
Parameters
room_id The unique id of the room
user The user's current nick inside the room

[edit] Match

[edit] mug-match-send-start

void (*mug_match_send_start)(char *room_id);

Description
Emitted when you want to communicate that you are ready to start the match in the room.
Parameters
room_id The unique id of the room


[edit] mug-match-start

void (*mug_start_match)(char *room_id, char *state);

Description
Emitted when the match has been started.
Parameters
room_id The unique id of the room
state The initial state of the match

[edit] mug-match-send-turn

void (*mug_match_send_turn)(char *room_id, char *turn);

Description
Emitted when you want to send a turn to the room.
Parameters
room_id The unique id of the room
turn The turn you make as an XML string (i.e. everything inside the <turn/> tag)

[edit] mug-match-received-turn

void (*mug_match_received_turn)(char *room_id, char *role, char *turn);

Description
Emitted when mug support receives a turn message for an active match associated with your plugin.
Parameters
room_id The unique id of the room
role The role of the user who did the turn or 'none' for updates from the service
turn The turn as an XML string

[edit] mug-match-term

void (*mug_match_term)(char *room_id, char *reason);

Description
Emitted when mug support receives a status change to inactive.
Parameters
room_id The unique id of the room
state The final state of the match

[edit] Options

[edit] mug-options-get

void (*mug_get_options)(char *form, char **options);

Description
Emitted when mug support wants to use the current options.
Parameters
form The form defining all possible options as provided by the game service
options The current options for the form as set by the user or default options as an XML string

[edit] mug-options-set

void (*mug_set_options)(char *form);

Description
Emitted when mug support wants to enable the user to set the options. It is up to the game plugin to save the chosen options.
Parameters
form The form defining all possible options as provided by the game service
Personal tools