12 self.
maildb.execute(
"CREATE TABLE IF NOT EXISTS mail ('recipient' TEXT, 'sender' TEXT, 'date' DATE, 'type' INT, 'message' TEXT);")
17 def __exit__(self, exc_type, exc_value, traceback):
20 def send(self, type, toname, fromname, message):
22 self.
maildb.execute(
"INSERT INTO mail VALUES (?, ?, datetime('now'), ?, ?);", (toname, fromname, type, message))
26 c.execute(
"SELECT type, sender, message FROM mail WHERE recipient=?;", (toname,))
28 for el
in c.fetchall():
30 c.execute(
"DELETE FROM mail WHERE recipient=?;", (toname,))
35 c.execute(
"SELECT COUNT(*) FROM mail WHERE recipient=?;", (toname,))
36 return c.fetchone()[0]