]> gitweb.michael.orlitzky.com - mailshears.git/blobdiff - lib/common/postfixadmin_db_plugin.rb
Way too many changes to mention. The 'rm' mode works now.
[mailshears.git] / lib / common / postfixadmin_db_plugin.rb
similarity index 72%
rename from lib/common/postfixadmin_db.rb
rename to lib/common/postfixadmin_db_plugin.rb
index 0249ea07949b384a5438f34c9c5f7c27e582d7e0..936672e27a331d60f1c05bead0fb14a96efb72e1 100644 (file)
@@ -1,22 +1,33 @@
+require 'common/plugin'
 require 'pg'
 
-class PostfixadminDb
-
-  def initialize(db_host,
-                 db_port,
-                 db_opts,
-                 db_tty,
-                 db_name,
-                 db_user,
-                 db_pass)
-
-    @db_host = db_host
-    @db_port = db_port
-    @db_opts = db_opts
-    @db_tty  = db_tty
-    @db_name = db_name
-    @db_user = db_user
-    @db_pass = db_pass
+module PostfixadminDbPlugin
+  # Code that all PostfixadminDb plugins (Prune, Rm, Mv...) will
+  # share.  That is, we implement the Plugin interface.
+  include Plugin
+
+  def initialize()
+
+    cfg = Configuration.new()
+    @db_host = cfg.dbhost
+    @db_port = cfg.dbport
+    @db_opts = cfg.dbopts
+    @db_tty  = cfg.dbtty
+    @db_name = cfg.dbname
+    @db_user = cfg.dbuser
+    @db_pass = cfg.dbpass
+  end
+
+
+  def describe_account(account)
+    # There's no other unique identifier in PostfixAdmin
+    return account
+  end
+
+
+  def describe_domain(domain)
+    # There's no other unique identifier in PostfixAdmin
+    return domain
   end
 
 
@@ -76,4 +87,5 @@ class PostfixadminDb
     return accounts
   end
 
+
 end