]>
gitweb.michael.orlitzky.com - mailshears.git/blob - lib/mv/plugins/roundcube.rb
3 require 'common/roundcube_plugin'
8 include RoundcubePlugin
13 # It's obviously an error if the source user does not exist. It
14 # would also be an error if the destination domain didn't exist;
15 # however, Roundcube doesn't know about domains, so we let that slide.
16 raise NonexistentUserError
.new(src
.to_s()) if not user_exists(src
)
18 # And it's an error if the destination user exists already.
19 raise UserAlreadyExistsError
.new(dst
.to_s()) if user_exists(dst
)
21 sql_queries
= ['UPDATE users SET username = $1 WHERE username = $2;']
23 connection
= PGconn
.connect(@db_host, @db_port, @db_opts, @db_tty,
24 @db_name, @db_user, @db_pass)
26 sql_queries
.each
do |sql_query
|
27 connection
.query(sql_query
, [dst
.to_s(), src
.to_s()])