<span style="font-family:Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif;border-collapse:collapse;line-height:18px">I&#39;m trying to write a dead-simple interface for an IRC client library, like so:</span><div>



<span style="font-family:Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif;border-collapse:collapse;line-height:18px"><span style="font-size:14px"><span style="font-size:small"><br>
</span></span></span></div><div><span style="font-family:Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif;border-collapse:collapse;line-height:18px"><span style="font-size:14px"><span style="font-size:small"><div>



<font face="&#39;courier new&#39;, monospace"><div>    import simpleirc</div><div><br></div><div>    connection = simpleirc.Connect(&#39;<a href="http://irc.freenode.net" target="_blank">irc.freenode.net</a>&#39;, 6667)</div>



<div>    channel = connection.join(&#39;foo&#39;)</div><div><br></div><div>    find_command = re.compile(r&#39;google ([a-z]+)&#39;).findall</div><div><br></div><div>    for msg in channel:</div><div>        for t in find_command(msg):</div>



<div>            channel.say(&quot;<a href="http://google.com/search?q=%s" target="_blank">http://google.com/search?q=%s</a>&quot; % t)</div></font></div></span></span></span></div><div><span style="font-family:Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif;border-collapse:collapse;line-height:18px;font-size:14px"><span style="font-size:small"><br>



</span></span></div><div><span style="font-family:Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif;border-collapse:collapse;line-height:18px"><span style="font-size:14px"><span style="font-size:small">Working from the </span><a href="http://twistedmatrix.com/documents/current/core/howto/clients.html#auto5" target="_blank"><span style="font-size:small">example in the docs</span></a><span style="font-size:small">, I&#39;m running into trouble with the callbacks (the code is a bit lengthy, so I pasted it <a href="https://gist.github.com/e7e13f074a2691de6371" target="_blank">here</a></span><span style="font-size:small">). The problem is that the call to </span><code style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;padding-top:1px;padding-right:5px;padding-bottom:1px;padding-left:5px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;vertical-align:baseline;background-color:rgb(238, 238, 238);font-family:Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif"><span style="font-size:small">channel.__next__</span></code><span style="font-size:small"> needs to be returned when the callback </span><code style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;padding-top:1px;padding-right:5px;padding-bottom:1px;padding-left:5px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;vertical-align:baseline;background-color:rgb(238, 238, 238);font-family:Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif"><span style="font-size:small">&lt;IRCClient instance&gt;.privmsg</span></code><span style="font-size:small"> is called, there doesn&#39;t seem to be a clean option of doing that. I could try to use exceptions or threads, but that seems like the wrong thing here, is there a simpler (blocking?) way of using a twisted reactor that would make this possible?</span></span></span></div>



<div><font face="Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif"><span style="border-collapse:collapse;line-height:18px"><br></span></font></div><div>
<font face="Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif"><span style="border-collapse:collapse;line-height:18px">Cheers,</span></font></div><div>
<font face="Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif"><span style="border-collapse:collapse;line-height:18px">Andrey<br></span></font><br><div class="gmail_quote">
On Wed, Apr 21, 2010 at 10:00 PM, César García <span dir="ltr">&lt;<a href="mailto:celord@gmail.com" target="_blank">celord@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



+1 Yes, it&#39;s great!! <br><br><div class="gmail_quote">2010/4/21 Kevin Horn <span dir="ltr">&lt;<a href="mailto:kevin.horn@gmail.com" target="_blank">kevin.horn@gmail.com</a>&gt;</span><div><br><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">




<div>This blog series is also totally rock-a-licious.<br><br><a href="http://krondo.com/blog/?page_id=1327" target="_blank">http://krondo.com/blog/?page_id=1327</a></div></blockquote></div></div><font color="#888888"><br>



<br clear="all">
<br>-- <br><a href="http://celord.blogspot.com/" target="_blank">http://celord.blogspot.com/</a><br>
</font><br>_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com" target="_blank">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
<br></blockquote></div><br></div>