VirtualMailManager/Domain.py
changeset 80 5dedc673524e
parent 76 14c0a092d7d2
child 102 485d3f7d6981
--- a/VirtualMailManager/Domain.py	Mon Sep 08 23:47:34 2008 +0000
+++ b/VirtualMailManager/Domain.py	Tue Sep 09 04:29:13 2008 +0000
@@ -211,7 +211,8 @@
     def getInfo(self):
         """Returns a dictionary with information about the domain."""
         sql = """\
-SELECT gid, domainname, transport, domaindir, aliasdomains, accounts, aliases
+SELECT gid, domainname, transport, domaindir, aliasdomains, accounts,
+       aliases, relocated
   FROM vmm_domain_info
  WHERE gid = %i""" % self._id
         dbc = self._dbh.cursor()
@@ -223,7 +224,7 @@
                     ERR.NO_SUCH_DOMAIN)
         else:
             keys = ['gid', 'domainname', 'transport', 'domaindir',
-                    'aliasdomains', 'accounts', 'aliases']
+                    'aliasdomains', 'accounts', 'aliases', 'relocated']
             return dict(zip(keys, info))
 
     def getAccounts(self):
@@ -252,6 +253,19 @@
                 aliases.append('%s@%s' % (alias[0], self._name))
         return aliases
 
+    def getRelocated(self):
+        """Returns a list with all addresses from relocated users."""
+        dbc = self._dbh.cursor()
+        dbc.execute("SELECT address FROM relocated WHERE gid = %s\
+ ORDER BY address", self._id)
+        addresses = dbc.fetchall()
+        dbc.close()
+        relocated = []
+        if len(addresses) > 0:
+            for address in addresses:
+                relocated.append('%s@%s' % (address[0], self._name))
+        return relocated
+
     def getAliaseNames(self):
         """Returns a list with all alias names from the domain."""
         dbc = self._dbh.cursor()