]>
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_user(user
)
27 if self.user_exists(user
)
28 return "Username: #{user}"
30 return 'User not found'
37 # Produce a list of AgenDAV users. This is public because it's
42 # Just assume PostgreSQL for now.
44 connection
= PGconn
.connect(@db_host,
52 sql_query
= '(SELECT username FROM prefs)'
54 sql_query +
= '(SELECT user_from FROM shared);'
56 connection
.query(sql_query
) do |result
|
57 usernames
= result
.field_values('username')
62 # Pretend like we're database-agnostic in case we ever are.
63 raise DatabaseError
.new(e
)