diff --git a/__pycache__/config.cpython-38.pyc b/__pycache__/config.cpython-38.pyc index 1c327bc..dcb98bc 100644 Binary files a/__pycache__/config.cpython-38.pyc and b/__pycache__/config.cpython-38.pyc differ diff --git a/__pycache__/plugin.cpython-38.pyc b/__pycache__/plugin.cpython-38.pyc index 3d3c663..139a39b 100644 Binary files a/__pycache__/plugin.cpython-38.pyc and b/__pycache__/plugin.cpython-38.pyc differ diff --git a/config.py b/config.py index 0d04725..ed3fbc3 100644 --- a/config.py +++ b/config.py @@ -29,6 +29,7 @@ ### from supybot import conf, registry +from supybot.commands import private try: from supybot.i18n import PluginInternationalization _ = PluginInternationalization('Mailcow') @@ -52,5 +53,40 @@ Mailcow = conf.registerPlugin('Mailcow') # conf.registerGlobalValue(Mailcow, 'someConfigVariableName', # registry.Boolean(False, _("""Help for someConfigVariableName."""))) +conf.registerGroup(Mailcow, 'api') + +conf.registerGlobalValue(Mailcow.api, 'key', +registry.String('', +""" +Your Mailcow API Key +""" +, private=True +)) + +conf.registerGlobalValue(Mailcow.api, 'server', +registry.String('', +""" +Your Mailcow server \(https://example.com\) +""" +, private=False +)) + +conf.registerGroup(Mailcow, 'access') + +conf.registerGlobalValue(Mailcow.access, 'read', +registry.CommaSeparatedListOfStrings('', +""" +Nicknames to grant Read-Only access +""" +, private=True +)) + +conf.registerGlobalValue(Mailcow.access, 'write', +registry.CommaSeparatedListOfStrings('', +""" +Nicknames to grant Write access +""" +, private=True +)) # vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/plugin.py b/plugin.py index 9f855c3..0f5dc26 100644 --- a/plugin.py +++ b/plugin.py @@ -33,6 +33,7 @@ import secrets import string from supybot import utils, plugins, ircutils, callbacks, ircdb from supybot.commands import * +from supybot.ircmsgs import nick try: from supybot.i18n import PluginInternationalization _ = PluginInternationalization('Mailcow') @@ -41,149 +42,231 @@ except ImportError: # without the i18n module _ = lambda x: x -server = 'https://zz0.email' api = '/api/v1' get = api + '/get' -api_key = "" - -capability = ircdb.checkCapability(hostmask='cranberry!~u@cranberry.juice', capability='owner', ignoreDefaultAllow=True) - class Mailcow(callbacks.Plugin): """Mailcow API through IRC""" pass - + def maildomain(self, irc, msg, args, variant, id): - """ - i.e. 'get liberta.casa' will print infos about the respective MX zone""" + """