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

Re: Debian Games Parties!



Bas Wijnen schrieb:
> 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.

	It's tecnically no problem. The only thing that needs to be done is
composing the correct POST data.

>> 	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?

	I have not thought of it but it appears to be possible

>> 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 have absolutely no problem with running the bot on alioth. But I'm
not sure the alioth Admins let me have some python script running in an
screen session for an day or so (the required python-irclib is just one
file one can copy along so no installing needed).

>> 	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).

	It's actually copied from the other occurence. I wanted to reduce the
changes on the actual code while testing.

Regards

	Christoph

-- 
/"\  ASCII Ribbon : GPG-Key ID: 0x0372275D
\ /    Campaign   :
 X   against HTML : Working for Debian
/ \   in eMails   : http://www.debian.org/

http://www.christoph-egger.org/

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: