X-Git-Url: http://gitweb.michael.orlitzky.com/?p=mailshears.git;a=blobdiff_plain;f=src%2Fpostfixadmin_db.rb;h=5291a53987587b0ee1da11ccee4e33c835191885;hp=e30c89c1bf982431043994602c0a2faa03dcd115;hb=1e4cad3a4f6938ca07bc99078108d466bf146b24;hpb=da71911046617ccffbb899b57162c5e6bdbb37ee diff --git a/src/postfixadmin_db.rb b/src/postfixadmin_db.rb index e30c89c..5291a53 100644 --- a/src/postfixadmin_db.rb +++ b/src/postfixadmin_db.rb @@ -30,16 +30,21 @@ class PostfixadminDb @db_name, @db_user, @db_pass) - - sql_query = 'SELECT address FROM alias;' + + # If address = goto, then the alias basically says, "really + # deliver to that address; it's not an alias." + sql_query = 'SELECT username FROM mailbox;' result = connection.query(sql_query) connection.close() rescue PGError => e # But pretend like we're database-agnostic in case we ever are. raise DatabaseError.new(e) end - - return result + + # The database query returns an array of rows. Since we only asked + # for one column (address), we can flatten the result into an + # array of addresses. + return result.flatten end end