]>
gitweb.michael.orlitzky.com - mailshears.git/blob - lib/common/agendav_plugin.rb
1 require 'common/plugin'
4 # Code that all Agendav plugins (Prune, Rm, Mv...) will
5 # share. That is, we implement the Plugin interface.
10 @db_host = cfg
.agendav_dbhost
11 @db_port = cfg
.agendav_dbport
12 @db_opts = cfg
.agendav_dbopts
13 @db_tty = cfg
.agendav_dbtty
14 @db_name = cfg
.agendav_dbname
15 @db_user = cfg
.agendav_dbuser
16 @db_pass = cfg
.agendav_dbpass
20 def describe_domain(domain
)
21 # AgenDAV doesn't have a concept of domains.
26 def describe_account(account
)
27 if self.user_exists(account
)
28 return "Username: #{account}"
30 return 'User not found'
41 # Just assume PostgreSQL for now.
43 connection
= PGconn
.connect(@db_host,
51 sql_query
= '(SELECT username FROM prefs)'
53 sql_query +
= '(SELECT user_from FROM shared);'
55 connection
.query(sql_query
) do |result
|
56 usernames
= result
.field_values('username')
61 # Pretend like we're database-agnostic in case we ever are.
62 raise DatabaseError
.new(e
)