documented plugin example

An example plugin was implemented with extensive documentation. Additional mails were added to the notification system, for voting and picking. A few bugs were fixed and the release number of cardstories bumped to 1.0.5 with adaptations to run on Fedora14.

example plugin

The example plugin was implemented to be used as a guide and a reference for plugin implementers. The body of the plugin is fully functional but only enumerate all possible cases. For instance, the accept function is documented to receive an event that occurs when a player picks a card:

    #
    # Received each time a player picks a card. A player
    # may pick a card multiple times and only the latest
    # is taken into account.
    #
    elif details['type'] == 'pick':
        details['player_id'] # numerical player id
        details['card'] # numerical card id

A plugin implementer could copy the example plugin and start from it, adding the desired functions where appropriate. The code of the example function is extensively tested (100% coverage). However it is not recommended to use these tests as a basis for the tests of a new plugins. Using an existing plugin tests is a better choice because it will be less bloated and could only focus on the essential parts.

mails and bugs

  • Fixes #114. Use the subject argument instead of redundant subject.
  • IssueID #47. Only send an email about a card being picked or voted to the game author, the players do not care.
  • IssueID #168. Send a mail to all players when switching to the voting state
  • Fixes #9. The GAME_TIMEOUT variable value from the /etc/default/cardstories file is used to set the –game-timeout option in /etc/init.d/cardstories
  • IssueID #166. Draft implementation covering the notification function
  • bump to 1.0.5
  • When the init event is sent, it must set the modified date to zero otherwise it is trashed. It must use the wait method instead of the poll method because there is no need for timeout
  • jslint fixes in the advertise function
  • compile changelog from git history
  • avoid displaying a blue border on firefox3
  • remove call to console to prevent failure if no console is activated
  • set COVERAGE with coverage or python-coverage depending on its availability
  • update the curl example