Replaced README procmail rule with one I've actually tested :p
authorW. Trevor King <wking@drexel.edu>
Fri, 26 Mar 2010 09:23:03 +0000 (05:23 -0400)
committerW. Trevor King <wking@drexel.edu>
Fri, 26 Mar 2010 09:50:46 +0000 (05:50 -0400)
Also updated the README example code for new email setup.

README

diff --git a/README b/README
index 324f9ff3f8b373aea5ea70b588abef489a492514..6a9b7cf3d6e4d2a9eb0b769cd5c025f4b0357e22 100644 (file)
--- 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()