NAME

VUser::SquirrelMail::Prefs::SQL - Extension for managing SquirrelMail preferences in a SQL database.

DESCRIPTION

It is assumed that this module will be used primarily when using a database to store SquirrelMail settings. File based configuration is not supported at this time but will probably be added at some point in the future.

CONFIGURATION

[vuser]
extensions = SquirrelMail::Prefs::SQL

[Extension SquirrelMail::Prefs::SQL]
# Can be mysql, pgsql, none
db type = mysql

# Host where the DB is
db host = localhost

# The name of the squirrelmail database
db name = squirrelmail

# You may specify the DSN directly instead of having S::P::SQL guess it.
# 'dns' overrides the 'db type', 'db host' and 'db name' settings above
# dsn = dbi:mysql:localhost

# Username and password for the database.
# Note: This user required select, insert, update and delete perms on the
# SquirrelMail userprefs table.
db user = squirrelmail
db password = secret

## SQL Queries
# Here you define the queries used to add, modify and delete users and
# attributes. There are a few predefined macros that you can use in your
# SQL. The values will be quoted and escaped before being inserted into
# the SQL.
#  %u => username
#  %o => option
#  %v => value
#  %-option => This will be replaced by the value of --option passed in
#              when vuser is run.

# Add a preference
addpref_query = Insert into userprefs set user = %u, prefkey = %o, prefval = %v

# Delete a preference
delpref_query = Delete from userprefs where user = %u, prefkey = %o

# Modify a preference
modpref_query = Update userprefs set prefkey = %v where user = %u, prefkey = %o

# Delete all preferences for a user
delallpref_query = Delete from userprefs where user = %u

# Show queries. These must return these columns in order
#  user name, preference name, preference value
#
# Get a single option for a user
showuseropt_query = Select user,prefkey,prefval from userprefs where user = %u and prefkey = $o

# Get a single option for all users
showopt_query = Select user,prefkey,prefval from userprefs where prefkey = %o

# Get all options for a user
showuser_query = Select user,prefkey,prefval from userprefs where user = %u

# Get all options for all users
showall_query = Select user,prefkey,prefval from userprefs;

AUTHOR

Randy Smith <perlstalker@vuser.org>

LICENSE

This file is part of VUser-SquirrelMail.

VUser-SquirrelMail is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

VUser-SquirrelMail is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with VUser-SquirrelMail; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA