]> gitweb.michael.orlitzky.com - mailshears.git/blobdiff - lib/common/roundcube_plugin.rb
Overhaul everything to get consistent error reports.
[mailshears.git] / lib / common / roundcube_plugin.rb
index 1f9805a3e9d079243da75859f6992d7688e6f266..b1c74a6d7494420ea9908389317c9d03e39d64f9 100644 (file)
@@ -1,4 +1,5 @@
 require 'common/plugin'
+require 'common/user'
 
 module RoundcubePlugin
   # Code that all Roundcube plugins (Prune, Rm, Mv...) will share.
@@ -18,7 +19,7 @@ module RoundcubePlugin
 
   def describe_domain(domain)
     # Roundcube doesn't have a concept of domains.
-    return domain
+    return domain.to_s()
   end
 
   def describe_user(user)
@@ -58,7 +59,7 @@ module RoundcubePlugin
       raise DatabaseError.new(e)
     end
 
-    return usernames
+    return usernames.map{ |u| User.new(u) }
   end
 
   protected;
@@ -77,7 +78,7 @@ module RoundcubePlugin
 
       sql_query = "SELECT user_id FROM users WHERE username = $1;"
 
-      connection.query(sql_query, [user]) do |result|
+      connection.query(sql_query, [user.to_s()]) do |result|
         if result.num_tuples > 0
           user_id = result[0]['user_id']
         end