[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Debian Games Parties!



On Sun, Apr 12, 2009 at 09:09:46PM +0200, Christoph Egger wrote:
> >> On Sun, Apr 12, 2009 at 4:53 PM, Bas Wijnen wrote:
> >>> - It would probably be nice to combine the page with an IRC bot for
> >>>  notifications.  However, I have no experience with IRC bots at all, so
> >>>  that will not work unless someone will implement it.
> >> Definitely, and maybe for claims too.
> > 
> > 	I have no experience there, too, but I'm quite willing&interested in
> > figuring it out ;) if we can make up an way for the CGI and the bot to
> > communicate.
> > 
> 
> 	I'm actually having some code working (the bot is sitting in
> #debian-games-party) listening to my local copy of Bas' cgi script.
> Basically the bot is listening on TCP Port 2222 for simple, newline
> terminated strings and relaying them to IRC.

Sounds good.  Can it do the other way as well, spawning the script with
a line of text (from IRC) on the commandline, for example?  Then it
would be possible to make claims from IRC as well.

> 	Authentication for this bot would be provided by only allowing
> alioth.debian.org to connect to the bot's Port (iptables).

That should work.  Can't you just listen only on that address instead of
using iptables?

> For this to work I made the changes in the diff file to the webscript
> (Filtering only changed data + Putting the data over TCP).

Ah well, whatever works is good enough anyway, I suppose. :-)  But
listening on an address doesn't require root, so it is nicer. ;-)

> 	Actually the bot does hardly care about the way the data is submitted
> so if there's an better Idea than TCP it's no problem to implement.

A unix domain socket is an other way which is automatically protected
because you must be logged in to send data to it.  Same thing with a
named pipe.

> I would run my script for the party on christoph-egger.org.

In that case, either the cgi script must run there as well, or you can't
use unix domain sockets or named pipes. ;-)

> 	I'll do some cleanup of the botscript tomorrow and then place it
> somewhere on alioth for Consumption.

Cool.

> --- orig	2009-04-12 21:00:48.000000000 +0200
> +++ DebianGamesParty.cgi	2009-04-12 20:59:22.000000000 +0200

Diff looks fine, except:

> @@ -71,15 +73,24 @@
>  			state = int (form[i].value)
>  			if state > 2:
>  				raise ValueError, "invalid state"
> -			db[package]["state"] = state
> +			if db[package]["state"] != state:
> +				db[package]["state"] = state
> +				statename = ('screenshot needed', 'screenshot ready', 'screenshot in archive')
> +				ircbot.write('State of %s changed to "%s"\n' % (db[package]["name"], statename[state]))

Statename is used elsewhere as well.  It's better to make it a global to
avoid redundancy (these names will actually be changed, there's a
request already).

Thanks,
Bas

-- 
I encourage people to send encrypted e-mail (see http://www.gnupg.org).
If you have problems reading my e-mail, use a better reader.
Please send the central message of e-mails as plain text
   in the message body, not as HTML and definitely not as MS Word.
Please do not use the MS Word format for attachments either.
For more information, see http://a82-93-13-222.adsl.xs4all.nl/e-mail.html

Attachment: signature.asc
Description: Digital signature


Reply to: