Progether/IRC-Bot — pull request #36 by burkean (2013-11-20 12:15:19+00:00)
Title: fixing adding to db and weird generation of ids in mail

There was something really weird going on in db.DB.db_add_data. As in, for a single insert, you were inserting multiple times.

I've tested the replacement function locally by mocking the mail input, but I haven't tested the changes in the wider context of the bot.

Plus (and in an ideal world this would be a separate pull request), I removed the funky manual generation of 'id' from addons.mail.send_mail. I didn't spot anywhere in the code to change how that table is created, so I assume you do it manually. Please change it to something like:

CREATE TABLE IF NOT EXISTS mail(id SERIAL PRIMARY KEY, sender TEXT, recipient TEXT, message TEXT);

Then id will be automagically created and will increment when appropriate.