X-Git-Url: http://gitweb.michael.orlitzky.com/?p=mailshears.git;a=blobdiff_plain;f=lib%2Fcommon%2Froundcube_plugin.rb;h=0f80f72dd5ab33bad582fe15298aa4287f7e4ed7;hp=8e9d62259d78fd9819bc2ef77bc97c3c2b0fa96c;hb=72696d3f6e95ef773af9727e9c3459b9038b0fc2;hpb=7f8654ed6582062a295e1be75ae70e99de41b323 diff --git a/lib/common/roundcube_plugin.rb b/lib/common/roundcube_plugin.rb index 8e9d622..0f80f72 100644 --- a/lib/common/roundcube_plugin.rb +++ b/lib/common/roundcube_plugin.rb @@ -5,8 +5,7 @@ module RoundcubePlugin # That is, we implement the Plugin interface. include Plugin - def initialize() - cfg = Configuration.new() + def initialize(cfg) @db_host = cfg.roundcube_dbhost @db_port = cfg.roundcube_dbport @db_opts = cfg.roundcube_dbopts @@ -22,8 +21,8 @@ module RoundcubePlugin return domain end - def describe_account(account) - user_id = self.get_user_id(account) + def describe_user(user) + user_id = self.get_user_id(user) if user_id.nil? return 'User not found' @@ -35,7 +34,7 @@ module RoundcubePlugin protected; - def get_user_id(account) + def get_user_id(user) user_id = nil begin @@ -49,7 +48,7 @@ module RoundcubePlugin sql_query = "SELECT user_id FROM users WHERE username = $1;" - connection.query(sql_query, [account]) do |result| + connection.query(sql_query, [user]) do |result| if result.num_tuples > 0 user_id = result[0]['user_id'] end