]> gitweb.michael.orlitzky.com - mailshears.git/blobdiff - lib/common/roundcube_plugin.rb
Add some new fixtures in preparation for prune tests.
[mailshears.git] / lib / common / roundcube_plugin.rb
index 1f9805a3e9d079243da75859f6992d7688e6f266..eb450f00059d038776046dc7604417e1de3c367e 100644 (file)
@@ -1,4 +1,5 @@
 require 'common/plugin'
+require 'common/user'
 
 module RoundcubePlugin
   # Code that all Roundcube plugins (Prune, Rm, Mv...) will share.
@@ -16,19 +17,9 @@ module RoundcubePlugin
   end
 
 
-  def describe_domain(domain)
-    # Roundcube doesn't have a concept of domains.
-    return domain
-  end
-
   def describe_user(user)
     user_id = self.get_user_id(user)
-
-    if user_id.nil?
-      return 'User not found'
-    else
-      return "User ID: #{user_id}"
-    end
+    return "User ID: #{user_id}"
   end
 
 
@@ -58,7 +49,7 @@ module RoundcubePlugin
       raise DatabaseError.new(e)
     end
 
-    return usernames
+    return usernames.map{ |u| User.new(u) }
   end
 
   protected;
@@ -77,7 +68,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