Jingle bell rock!

This commit is contained in:
Dennis Kaarsemaker 2006-12-07 11:25:01 +01:00
parent dbbe9f77d4
commit 167d4b8005
5 changed files with 37 additions and 22 deletions

View File

@ -59,22 +59,26 @@ if form.has_key('lpuser') and form.has_key('lpmail'):
for i in xrange(8):
password += chars[random.randint(0,len(chars)-1)]
salt += chars[random.randint(0,len(chars)-1)]
os.system('gpg --homedir /tmp --keyserver hkp://subkeys.pgp.net --recv-keys %s' % newperson.key)
(infd, outfd) = os.popen2('gpg --homedir /tmp --encrypt --armor --trust-model always --recipient %s'
try:
os.system('gpg --homedir /tmp --keyserver hkp://subkeys.pgp.net --recv-keys %s 2>/dev/null' % newperson.key)
(infd, outfd) = os.popen2('gpg --homedir /tmp --encrypt --armor --trust-model always --recipient %s 2>/dev/null'
% newperson.key)
infd.write(password)
infd.close()
gpg = outfd.read()
outfd.close()
fd = os.popen('mail -a "From: Ubugtu <ubugtu@ubuntu-nl.org>" -s "Your bantracker account" %s'
% form['lpmail'].value.replace('ubuntu@sourceguru.net','mezzle@gmail.com'), 'w')
fd.write(gpg)
fd.close()
error = "Your password has been sent (encrypted) to your e-mail address"
cur.execute("""INSERT INTO users (username, salt, password) VALUES (%s, %s, %s)""",
(form['lpuser'].value, salt,
sha.new(salt + sha.new(password + salt).hexdigest().lower()).hexdigest().lower()))
con.commit()
infd.write(password)
infd.close()
gpg = outfd.read()
outfd.close()
except:
error = "A gpg error occured. Please check your key on launchpad"
else:
fd = os.popen('mail -a "From: Ubugtu <ubugtu@ubuntu-nl.org>" -s "Your bantracker account" %s'
% form['lpmail'].value.replace('ubuntu@sourceguru.net','mezzle@gmail.com'), 'w')
fd.write(gpg)
fd.close()
error = "Your password has been sent (encrypted) to your e-mail address"
cur.execute("""INSERT INTO users (username, salt, password) VALUES (%s, %s, %s)""",
(form['lpuser'].value, salt,
sha.new(salt + sha.new(password + salt).hexdigest().lower()).hexdigest().lower()))
con.commit()
else:
error = """Username and mailaddress don't match. Username is the $someone
in http://launchpad.net/people/$someone that is your

View File

@ -96,6 +96,7 @@ class Bugtracker(callbacks.PluginRegexp):
pass
schedule.addPeriodicEvent(lambda: self.reportnewbugs(irc), 60, name=self.name())
self.shown = {}
self.nomailtime = 0
def is_ok(self, channel, tracker, bug):
now = time.time()
@ -121,6 +122,15 @@ class Bugtracker(callbacks.PluginRegexp):
if dir not in bugs:
#print "Reloading info from %s" % dir
bugs[dir] = {}
if dir.endswith('bugmail'):
if len(os.listdir(os.path.join(dir,'Maildir','new'))) == 0:
self.nomailtime += 1
if self.nomailtime == 30:
irc.queueMsg(ircmsgs.privmsg(c,'WARNING: No bugmail received in 30 minutes. Please poke Seveas.'))
self.nomailtime = 0
else:
#irc.queueMsg(ircmsgs.privmsg('#ubuntu-bots','Seveas: your lucky number is %d' % self.nomailtime))
self.nomailtime = 0
for file in os.listdir(os.path.join(dir,'Maildir','new')):
#print "Checking %s" % file
fd = open(os.path.join(dir,'Maildir','new',file))

View File

@ -395,10 +395,10 @@ aptcommand = """apt-cache\\
%%s %%s""" % tuple([aptdir]*4)
aptfilecommand = """apt-file -s %s/%%s.list -c %s/apt-file/%%s -l -F search %%s""" % tuple([aptdir]*2)
def findpkg(pkg,checkdists,filelookup=True):
_pkg = ''.join([x for x in pkg.strip().split(None,1)[0] if x.isalnum or x in '.-'])
_pkg = ''.join([x for x in pkg.strip().split(None,1)[0] if x.isalnum or x in '.-_'])
distro = checkdists[0]
if len(pkg.strip().split()) > 1:
distro = ''.join([x for x in pkg.strip().split(None,2)[1] if x.isalnum or x in '.-'])
distro = ''.join([x for x in pkg.strip().split(None,2)[1] if x.isalnum or x in '.-_'])
if distro not in distros:
distro = checkdists[0]
pkg = _pkg
@ -420,10 +420,10 @@ def findpkg(pkg,checkdists,filelookup=True):
return "Found: %s" % ', '.join(pkgs[:5])
def pkginfo(pkg,checkdists):
_pkg = ''.join([x for x in pkg.strip().split(None,1)[0] if x.isalnum() or x in '.-'])
_pkg = ''.join([x for x in pkg.strip().split(None,1)[0] if x.isalnum() or x in '.-_'])
distro = None
if len(pkg.strip().split()) > 1:
distro = ''.join([x for x in pkg.strip().split(None,2)[1] if x.isalnum() or x in '-.'])
distro = ''.join([x for x in pkg.strip().split(None,2)[1] if x.isalnum() or x in '-._'])
if distro:
if distro not in distros:
checkdists = [checkdists[0]]

3
TODO
View File

@ -3,6 +3,3 @@ Bantracker:
Bugtracker:
- Make sure to use reply.whenAddressedBy
Encyclopedia:
- The list of search repos/default repo must be configurable per channel

View File

@ -26,6 +26,10 @@
<p><a href="timezones.html">Timezones</a></p>
<p><a href="https://bots.ubuntulinux.nl/bans.cgi">The bantracker</a></p>
<p><a href="factoids.cgi">Factoid database</a></p>
<h1>Raw data</h1>
<p><a href="ubuntu.db">Ubuntu database</a></p>
<p><a href="gnewsense.db">gNewSense database</a></p>
<p><a href="Lart.flat.db">A collection of larts</a></p>
<p>&copy;2006 Dennis Kaarsemaker</p>
</div>
</body>