* 'VirtualMailManager/Alias.py'
authorPascal Volk <neverseen@users.sourceforge.net>
Mon, 03 Mar 2008 23:48:07 +0000
changeset 12 44161dbb1518
parent 11 7a5bd38c5b98
child 13 1d9bf63a86f7
* 'VirtualMailManager/Alias.py' * 'VirtualMailManager/VirtualMailManager.py' * 'vmm' - added support for deleting only the alias with the matching destination address
ChangeLog
VirtualMailManager/Alias.py
VirtualMailManager/VirtualMailManager.py
vmm
--- a/ChangeLog	Sun Mar 02 23:15:13 2008 +0000
+++ b/ChangeLog	Mon Mar 03 23:48:07 2008 +0000
@@ -1,5 +1,12 @@
 === 0.0.0 ===
-2008-03-03	Pascal Volk  <neverseen@users.sourceforge.net>
+2008-03-04  Pascal Volk	 <neverseen@users.sourceforge.net>
+
+	* VirtualMailManager/Alias.py:
+	* VirtualMailManager/VirtualMailManager.py:
+	* vmm: Now it's possible to delete an alias with a specific destination
+
+2008-03-03  Pascal Volk  <neverseen@users.sourceforge.net>
+
 	* pgsql-virtual_mailbox_domains.cf: Added to repository
 	* INSTALL: fixed postfix docu
 
--- a/VirtualMailManager/Alias.py	Sun Mar 02 23:15:13 2008 +0000
+++ b/VirtualMailManager/Alias.py	Mon Mar 03 23:48:07 2008 +0000
@@ -96,8 +96,12 @@
 
     def delete(self):
         dbc = self._dbh.cursor()
-        dbc.execute("DELETE FROM alias WHERE gid=%s AND address=%s",
-                self._gid, self._localpart)
+        if self._dest is None:
+            dbc.execute("DELETE FROM alias WHERE gid=%s AND address=%s",
+                    self._gid, self._localpart)
+        else:
+            dbc.execute("DELETE FROM alias WHERE gid=%s AND address=%s AND \
+ destination=%s", self._gid, self._localpart, self._dest)
         rowcount = dbc.rowcount
         dbc.close()
         if rowcount > 0:
--- a/VirtualMailManager/VirtualMailManager.py	Sun Mar 02 23:15:13 2008 +0000
+++ b/VirtualMailManager/VirtualMailManager.py	Mon Mar 03 23:48:07 2008 +0000
@@ -414,8 +414,8 @@
         alias = self.__getAlias(aliasaddress)
         return alias.getInfo()
 
-    def alias_delete(self, aliasaddress):
-        alias = self.__getAlias(aliasaddress)
+    def alias_delete(self, aliasaddress, targetaddress=None):
+        alias = self.__getAlias(aliasaddress, targetaddress)
         alias.delete()
 
     def user_info(self, emailaddress, diskusage=False):
--- a/vmm	Sun Mar 02 23:15:13 2008 +0000
+++ b/vmm	Mon Mar 03 23:48:07 2008 +0000
@@ -43,7 +43,7 @@
   ud    userdelete      user@domain.tld
   aa    aliasadd        alias@domain.tld user@domain.tld
   ai    aliasinfo       alias@domain.tld
-  ad    aliasdelete     alias@domain.tld
+  ad    aliasdelete     alias@domain.tld user@domain.tld*
   cf    configure                        section*
   h     help
   v     version
@@ -234,8 +234,10 @@
     global argc
     if argc < 3:
         usage(EXIT.MISSING_ARGS, 'Missing alias address')
+    elif argc < 4:
+        vmm.alias_delete(sys.argv[2].lower())
     else:
-        vmm.alias_delete(sys.argv[2].lower())
+        vmm.alias_delete(sys.argv[2].lower(), sys.argv[3].lower())
 
 def showWarnings():
     if vmm.hasWarnings():