X-Git-Url: http://gitweb.michael.orlitzky.com/?p=mailshears.git;a=blobdiff_plain;f=lib%2Fcommon%2Fpostfixadmin_plugin.rb;h=5556d5a7c23a15866a0a7fb17e6cbb77f2a21f1d;hp=4bfda9dcdece7e7216856b17ff96745c031313e7;hb=72696d3f6e95ef773af9727e9c3459b9038b0fc2;hpb=7f8654ed6582062a295e1be75ae70e99de41b323 diff --git a/lib/common/postfixadmin_plugin.rb b/lib/common/postfixadmin_plugin.rb index 4bfda9d..5556d5a 100644 --- a/lib/common/postfixadmin_plugin.rb +++ b/lib/common/postfixadmin_plugin.rb @@ -6,9 +6,7 @@ module PostfixadminPlugin # share. That is, we implement the Plugin interface. include Plugin - def initialize() - - cfg = Configuration.new() + def initialize(cfg) @db_host = cfg.postfixadmin_dbhost @db_port = cfg.postfixadmin_dbport @db_opts = cfg.postfixadmin_dbopts @@ -19,9 +17,9 @@ module PostfixadminPlugin end - def describe_account(account) + def describe_user(user) # There's no other unique identifier in PostfixAdmin - return account + return user end @@ -60,7 +58,7 @@ module PostfixadminPlugin def list_users() - accounts = [] + users = [] # Just assume PostgreSQL for now. begin @@ -76,7 +74,7 @@ module PostfixadminPlugin # deliver to that address; it's not an alias." sql_query = 'SELECT username FROM mailbox;' connection.query(sql_query) do |result| - accounts = result.field_values('username') + users = result.field_values('username') end connection.close() rescue PGError => e @@ -84,7 +82,7 @@ module PostfixadminPlugin raise DatabaseError.new(e) end - return accounts + return users end