2 # miniqdb-supybot - A Supybot plugin to access miniqdb's API
3 # Copyright (C) 2008 Ian Weller <ianweller@gmail.com>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License along
16 # with this program; if not, write to the Free Software Foundation, Inc.,
17 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 import supybot
.conf
as conf
21 import supybot
.registry
as registry
23 def configure(advanced
):
24 # This will be called by supybot to configure this module. advanced is
25 # a bool that specifies whether the user identified himself as an advanced
26 # user or not. You should effect your configuration by manipulating the
27 # registry as appropriate.
28 from supybot
.questions
import expect
, anything
, something
, yn
29 output("""Where is your miniqdb instance located? Please don't put a slash
30 at the end of the URL -- for example, http://example.com/miniqdb .""")
31 root
= something('root?')
32 conf
.registerPlugin('Miniqdb', True)
33 conf
.supybot
.plugins
.Miniqdb
.miniqdbRoot
.setValue(root
)
34 output("""This plugin has support to utilize HTTP Basic authentication.
35 HTTP Digest is not supported just yet.""")
36 if yn("Do you use HTTP Basic authentication on your miniqdb?"):
37 conf
.supybot
.plugins
.Miniqdb
.auth
.username
.setValue(something('username?'))
38 conf
.supybot
.plugins
.Miniqdb
.auth
.username
.setValue(something('password?'))
39 output("""Thanks for using miniqdb! http://miniqdb.googlecode.com/""")
42 Miniqdb
= conf
.registerPlugin('Miniqdb')
43 # This is where your configuration variables (if any) should go. For example:
44 # conf.registerGlobalValue(Miniqdb, 'someConfigVariableName',
45 # registry.Boolean(False, """Help for someConfigVariableName."""))
46 conf
.registerChannelValue(Miniqdb
, 'miniqdbRoot', registry
.String('', """The
47 root of the miniqdb directory. For example,
48 http://example.com/miniqdb -- don't put a slash at the end."""))
49 conf
.registerChannelValue(Miniqdb
, 'maxLines', registry
.PositiveInteger(3,
50 """The maximum number of lines that will be printed to a channel. If a
51 quote is longer than this, a link and the number of lines will be printed
52 to the channel. Set to 0 to disable quote printing."""))
53 conf
.registerGroup(Miniqdb
, 'auth')
54 conf
.registerChannelValue(Miniqdb
.auth
, 'username', registry
.String("", """The
55 username for HTTP authentication."""))
56 conf
.registerChannelValue(Miniqdb
.auth
, 'password', registry
.String("", """The
57 password for HTTP authentication."""))
60 # vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: