X-Git-Url: http://gitweb.michael.orlitzky.com/?p=mailshears.git;a=blobdiff_plain;f=lib%2Fcommon%2Fpostfixadmin_db_plugin.rb;fp=lib%2Fcommon%2Fpostfixadmin_db.rb;h=936672e27a331d60f1c05bead0fb14a96efb72e1;hp=0249ea07949b384a5438f34c9c5f7c27e582d7e0;hb=51f027b01e242737956c3ab5aecdd322d6ceeeed;hpb=e3826d8926e11763837a591986d453e9ef5d9dec diff --git a/lib/common/postfixadmin_db.rb b/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 0249ea0..936672e 100644 --- a/lib/common/postfixadmin_db.rb +++ b/lib/common/postfixadmin_db_plugin.rb @@ -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