From: W. Trevor King Date: Fri, 26 Mar 2010 09:23:03 +0000 (-0400) Subject: Replaced README procmail rule with one I've actually tested :p X-Git-Tag: 0.1~24 X-Git-Url: http://git.tremily.us/?p=pyrisk.git;a=commitdiff_plain;h=1fe4caeb70907604ddff7070a4f6a033e7b57e64 Replaced README procmail rule with one I've actually tested :p Also updated the README example code for new email setup. --- diff --git a/README b/README index 324f9ff..6a9b7cf 100644 --- a/README +++ b/README @@ -37,17 +37,30 @@ appropriate messages into a named pipe. With procmail, that will look something like:: :0 - * ^Subject: *(Re:)* [PyRisk* - | >> /path/to/named/pipe - -Then just add your EmailPlayers to your game and go:: - - import pyrisk.base as b; - import pyrisk.player.email as e; + * ^Subject:.*\[PyRisk.* + { + :0 wc + /path/to/named/pipe + + :0 + | /bin/echo -e '\000' >> /path/to/named/pipe + } + +The echo command appends a NULL byte to the FIFO, which (I think), helps +the read() in _get_msg break at the appropriate point. + +Once you have the procmail rule setup, just add your EmailPlayers to +your game and go:: + + from pyrisk.base import generate_earth, Player, Engine + from pyrisk.player.email import IncomingEmailDispatcher, \ + OutgoingEmailDispatcher, EmailPlayer world = generate_earth() - players = [EmailPlayer('Alice', 'alice@example.com', 'server@example.com'), - EmailPlayer('Bob', 'bob@big.edu', 'server@example.com'), + ied = IncomingEmailDispatcher(fifo_path='/tmp/pyrisk.in') + oed = OutgoingEmailDispatcher(return_address='server@example.com') + players = [EmailPlayer('Alice', 'alice@big.edu', ied, oed), + EmailPlayer('Bob', 'bob@fish.net', ied, oed), Player('Charlie')] e = Engine(world, players) e.run() - + ied.close()