X-Git-Url: http://gitweb.michael.orlitzky.com/?p=mailshears.git;a=blobdiff_plain;f=lib%2Frm%2Fplugins%2Froundcube.rb;h=c25874ef856beda9deda824d0d5d31a77d5fb4a3;hp=23782d20a575471820aa279f7ce47b346e68f2e2;hb=20b843bddcd73833d41f98ff79d92ef59bb4d81e;hpb=72696d3f6e95ef773af9727e9c3459b9038b0fc2 diff --git a/lib/rm/plugins/roundcube.rb b/lib/rm/plugins/roundcube.rb index 23782d2..c25874e 100644 --- a/lib/rm/plugins/roundcube.rb +++ b/lib/rm/plugins/roundcube.rb @@ -11,7 +11,7 @@ class RoundcubeRm def delete_user(user) # Delete the given username and any records in other tables # belonging to it. - raise NonexistentUserError.new(user) if not user_exists(user) + raise NonexistentUserError.new(user.to_s()) if not user_exists(user) user_id = self.get_user_id(user) @@ -26,26 +26,14 @@ class RoundcubeRm # This query is of course necessary with any DBMS: sql_queries = ['DELETE FROM users WHERE user_id = $1::int;'] - begin - connection = PGconn.connect(@db_host, - @db_port, - @db_opts, - @db_tty, - @db_name, - @db_user, - @db_pass) + connection = PGconn.connect(@db_host, @db_port, @db_opts, @db_tty, + @db_name, @db_user, @db_pass) - sql_queries.each do |sql_query| - connection.query(sql_query, [user_id]) - end - - connection.close() - - rescue PGError => e - # Pretend like we're database-agnostic in case we ever are. - raise DatabaseError.new(e) + sql_queries.each do |sql_query| + connection.query(sql_query, [user_id]) end + connection.close() end end