X-Git-Url: http://gitweb.michael.orlitzky.com/?p=mailshears.git;a=blobdiff_plain;f=lib%2Fcommon%2Froundcube_plugin.rb;h=eb450f00059d038776046dc7604417e1de3c367e;hp=1f9805a3e9d079243da75859f6992d7688e6f266;hb=650e23790019880da91c7c7248a214a13763fd3e;hpb=bf7d0402eda27d9487ca9402156818545fdda286 diff --git a/lib/common/roundcube_plugin.rb b/lib/common/roundcube_plugin.rb index 1f9805a..eb450f0 100644 --- a/lib/common/roundcube_plugin.rb +++ b/lib/common/roundcube_plugin.rb @@ -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