VirtualMailManager/Account.py
changeset 65 5506433db9a3
parent 55 15c873f94ba6
child 66 995d538a6eb5
--- a/VirtualMailManager/Account.py	Sun Aug 24 22:26:00 2008 +0000
+++ b/VirtualMailManager/Account.py	Mon Aug 25 14:49:43 2008 +0000
@@ -198,7 +198,11 @@
             dbc = self._dbh.cursor()
             dbc.execute("DELETE FROM users WHERE gid=%s AND local_part=%s",
                     self._gid, self._localpart)
-            if dbc.rowcount > 0:
+            u_rc = dbc.rowcount
+            # delete also all aliases where the destination address is the same
+            # as for this account.
+            dbc.execute("DELETE FROM alias WHERE destination = %s", self._addr)
+            if u_rc > 0 or dbc.rowcount > 0:
                 self._dbh.commit()
             dbc.close()
         else: