Beispiel #1
0
def configure(advanced):
    # This will be called by supybot to configure this module.  advanced is
    # a bool that specifies whether the user identified himself as an advanced
    # user or not.  You should effect your configuration by manipulating the
    # registry as appropriate.
    from supybot.questions import output, expect, anything, something, yn
    conf.registerPlugin('Judd', True)
    if not utils.findBinaryInPath('zgrep'):
        if not advanced:
            output("""I can't find zgrep in your path.  This is necessary
                      to run the file command.  I'll disable this command
                      now.  When you get zgrep in your path, use the command
                      'enable Judd.file' to re-enable the command.""")
            capabilities = conf.supybot.capabilities()
            capabilities.add('-Judd.file')
            conf.supybot.capabilities.set(capabilities)
        else:
            output("""I can't find zgrep in your path.  If you want to run
                      the file command with any sort of expediency, you'll
                      need it.  You can use a python equivalent, but it's
                      about two orders of magnitude slower.  THIS MEANS IT
                      WILL TAKE AGES TO RUN THIS COMMAND.  Don't do this.""")
            if yn('Do you want to use a Python equivalent of zgrep?'):
                conf.supybot.plugins.Judd.pythonZgrep.setValue(True)
            else:
                output('I\'ll disable file now.')
                capabilities = conf.supybot.capabilities()
                capabilities.add('-Judd.file')
                conf.supybot.capabilities.set(capabilities)
Beispiel #2
0
    def _hailo(self, irc, params, text=None):
        _errorNoHailo = _('Hailo was not found in PATH. You can install it ' +
                          'by running: perl -MCPAN -e \'install Hailo\'')
        if hasPbs:
            try:
                _perl = pbs.perl
                __hailo = _perl.bake('C:\Perl\site\bin\hailo', '-b',
                                     'hailo.sqlite')
                return __hailo(params.split(' '), text)
            except pbs.CommandNotFound:
                irc.error(_errorNoHailo, Raise=True)

        else:
            __hailo = utils.findBinaryInPath('hailo')
            if __hailo:
                _argv = [__hailo, '-b', 'hailo.sqlite']
                for i in params.split(' '):
                    _argv.append(i)
                if text:
                    _argv.append(text)

                return subprocess.Popen(
                    _argv, stdout=subprocess.PIPE).communicate()[0]
            else:
                irc.error(_errorNoHailo, Raise=True)
Beispiel #3
0
    def _hailo(self, irc, params, text=None):
        _errorNoHailo = _('Hailo was not found in PATH. You can install it ' +
                        'by running: perl -MCPAN -e \'install Hailo\'')
        if hasPbs:
            try:
                _perl = pbs.perl
                __hailo = _perl.bake('C:\Perl\site\bin\hailo', '-b', 'hailo.sqlite')
                return __hailo(params.split(' '), text)
            except pbs.CommandNotFound:
                irc.error(_errorNoHailo, Raise=True)

        else:
            __hailo = utils.findBinaryInPath('hailo')
            if __hailo:
                _argv = [__hailo, '-b', 'hailo.sqlite']
                for i in params.split(' '):
                    _argv.append(i)
                if text:
                    _argv.append(text)

                return subprocess.Popen(_argv,
                        stdout=subprocess.PIPE).communicate()[0]
            else:
                irc.error(_errorNoHailo, Raise=True)
Beispiel #4
0
import supybot.conf as conf
import supybot.utils as utils
import supybot.registry as registry

def configure(advanced):
    # This will be called by supybot to configure this module.  advanced is
    # a bool that specifies whether the user identified himself as an advanced
    # user or not.  You should effect your configuration by manipulating the
    # registry as appropriate.
    from supybot.questions import expect, anything, something, yn
    conf.registerPlugin('Twitter', True)

Twitter = conf.registerPlugin('Twitter')

conf.registerGlobalValue(Twitter, 'command',
    registry.String(utils.findBinaryInPath('twitter') or '', """Determines
    what command will be called for the twitter command."""))

conf.registerGlobalValue(Twitter, 'optionsF',
    registry.String(' -t -d', """Determines what
    options will be used for the twitter command friends."""))

conf.registerGlobalValue(Twitter, 'optionsG',
    registry.String('on_pvt_ircd_only -t -d', """Determines what
    options will be used for the twitter command global."""))

conf.registerGlobalValue(Twitter, 'optionsR',
    registry.String('replies -t -d', """Determines what
    options will be used for the twitter command replies."""))

conf.registerGlobalValue(Twitter, 'rdbActive',
Beispiel #5
0
    from supybot.i18n import PluginInternationalization
    _ = PluginInternationalization('Qalculate')
except:
    # Placeholder that allows to run the plugin on a bot
    # without the i18n module
    _ = lambda x: x


def configure(advanced):
    # This will be called by supybot to configure this module.  advanced is
    # a bool that specifies whether the user identified themself as an advanced
    # user or not.  You should effect your configuration by manipulating the
    # registry as appropriate.
    from supybot.questions import expect, anything, something, yn
    conf.registerPlugin('Qalculate', True)


Qalculate = conf.registerPlugin('Qalculate')
conf.registerGlobalValue(
    Qalculate, 'command',
    registry.String(
        utils.findBinaryInPath('qalc') or '',
        _("""Set the path of the 'qalc' command. On snap installations this is "qalculate.qalc"."""
          )))
conf.registerGlobalValue(
    Qalculate, 'timeout',
    registry.PositiveInteger(
        2000, _("""Set the timeout for the qalc command in milliseconds.""")))

# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
Beispiel #6
0
 def testFindBinaryInPath(self):
     if os.name == 'posix':
         self.assertEqual(None, utils.findBinaryInPath('asdfhjklasdfhjkl'))
         self.failUnless(utils.findBinaryInPath('sh').endswith('/bin/sh'))
Beispiel #7
0
        self.__parent = super(NonOptionString, self)
        self.__parent.__init__(*args, **kwargs)
    def setValue(self, v):
        if v.startswith('-'):
            self.error(v)
        else:
            self.__parent.setValue(v)

class SpaceSeparatedListOfNonOptionStrings(registry.SpaceSeparatedListOfStrings):
    Value = NonOptionString


Unix = conf.registerPlugin('Unix')
conf.registerGroup(Unix, 'fortune')
conf.registerGlobalValue(Unix.fortune, 'command',
    registry.String(utils.findBinaryInPath('fortune') or '', _("""Determines
    what command will be called for the fortune command.""")))
conf.registerChannelValue(Unix.fortune, 'short',
    registry.Boolean(True, _("""Determines whether only short fortunes will be
    used if possible.  This sends the -s option to the fortune program.""")))
conf.registerChannelValue(Unix.fortune, 'equal',
    registry.Boolean(True, _("""Determines whether fortune will give equal
    weight to the different fortune databases.  If false, then larger
    databases will be given more weight.  This sends the -e option to the
    fortune program.""")))
conf.registerChannelValue(Unix.fortune, 'offensive',
    registry.Boolean(False, _("""Determines whether fortune will retrieve
    offensive fortunes along with the normal fortunes.  This sends the -a
    option to the fortune program.""")))
conf.registerChannelValue(Unix.fortune, 'files',
    SpaceSeparatedListOfNonOptionStrings([], _("""Determines what specific file
Beispiel #8
0
    # registry as appropriate.
    from supybot.questions import output, expect, anything, something, yn
    conf.registerPlugin('Unix', True)
    output("""The "progstats" command can reveal potentially sensitive
              information about your machine. Here's an example of its output:

              %s\n""" % progstats())
    if yn('Would you like to disable this command for non-owner users?',
          default=True):
        conf.supybot.commands.disabled().add('Unix.progstats')


Unix = conf.registerPlugin('Unix')
conf.registerGroup(Unix, 'fortune')
conf.registerGlobalValue(Unix.fortune, 'command',
    registry.String(utils.findBinaryInPath('fortune') or '', """Determines what
    command will be called for the fortune command."""))
conf.registerGlobalValue(Unix.fortune, 'short',
    registry.Boolean(True, """Determines whether only short fortunes will be
    used if possible.  This sends the -s option to the fortune program."""))
conf.registerGlobalValue(Unix.fortune, 'equal',
    registry.Boolean(True, """Determines whether fortune will give equal
    weight to the different fortune databases.  If false, then larger
    databases will be given more weight.  This sends the -e option to the
    fortune program."""))
conf.registerGlobalValue(Unix.fortune, 'offensive',
    registry.Boolean(False, """Determines whether fortune will retrieve
    offensive fortunes along with the normal fortunes.  This sends the -o
    option to the fortune program."""))
conf.registerGlobalValue(Unix.fortune, 'files',
    registry.SpaceSeparatedListOfStrings([], """Determines what specific file
Beispiel #9
0
import supybot.registry as registry
try:
    from supybot.i18n import PluginInternationalization
    _ = PluginInternationalization('SysDNS')
except:
    # Placeholder that allows to run the plugin on a bot
    # without the i18n module
    _ = lambda x: x


def configure(advanced):
    # This will be called by supybot to configure this module.  advanced is
    # a bool that specifies whether the user identified himself as an advanced
    # user or not.  You should effect your configuration by manipulating the
    # registry as appropriate.
    from supybot.questions import expect, anything, something, yn
    conf.registerPlugin('SysDNS', True)


SysDNS = conf.registerPlugin('SysDNS')
conf.registerGlobalValue(
    SysDNS, 'command',
    registry.String(
        utils.findBinaryInPath('host') or '',
        _("""Determines
    what command will be called by the dns command. This should usually be 
    the location of the 'host' binary (or similar tool), such as 
    '/usr/bin/host'.""")))

# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
Beispiel #10
0
    # Placeholder that allows to run the plugin on a bot
    # without the i18n module
    _ = lambda x: x


def configure(advanced):
    # This will be called by supybot to configure this module.  advanced is
    # a bool that specifies whether the user identified themself as an advanced
    # user or not.  You should effect your configuration by manipulating the
    # registry as appropriate.
    from supybot.questions import expect, anything, something, yn
    conf.registerPlugin('Googler', True)


Googler = conf.registerPlugin('Googler')
conf.registerGlobalValue(
    Googler, 'command',
    registry.String(
        utils.findBinaryInPath('googler') or '',
        _("""Determines what command will be called for the
                             googler command.""")))
conf.registerGlobalValue(
    Googler, 'arguments',
    registry.SpaceSeparatedListOfStrings(
        '', _('''Command-line arguments to pass to googler''')))
# This is where your configuration variables (if any) should go.  For example:
# conf.registerGlobalValue(Googler, 'someConfigVariableName',
#     registry.Boolean(False, _("""Help for someConfigVariableName.""")))

# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
Beispiel #11
0
    conf.registerPlugin('Unix', True)
    output("""The "progstats" command can reveal potentially sensitive
              information about your machine. Here's an example of its output:

              %s\n""" % progstats())
    if yn('Would you like to disable this command for non-owner users?',
          default=True):
        conf.supybot.commands.disabled().add('Unix.progstats')


Unix = conf.registerPlugin('Unix')
conf.registerGroup(Unix, 'fortune')
conf.registerGlobalValue(
    Unix.fortune, 'command',
    registry.String(
        utils.findBinaryInPath('fortune') or '', """Determines what
    command will be called for the fortune command."""))
conf.registerGlobalValue(
    Unix.fortune, 'short',
    registry.Boolean(
        True, """Determines whether only short fortunes will be
    used if possible.  This sends the -s option to the fortune program."""))
conf.registerGlobalValue(
    Unix.fortune, 'equal',
    registry.Boolean(
        True, """Determines whether fortune will give equal
    weight to the different fortune databases.  If false, then larger
    databases will be given more weight.  This sends the -e option to the
    fortune program."""))
conf.registerGlobalValue(
    Unix.fortune, 'offensive',
Beispiel #12
0
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
###

import supybot.conf as conf
import supybot.utils as utils
import supybot.registry as registry

def configure(advanced):
    from supybot.questions import expect, anything, something, yn
    conf.registerPlugin('Farm', True)

Farm = conf.registerPlugin('Farm')

conf.registerChannelValue(Farm, 'quoteOnJoin',
        registry.Boolean(True, """Determines whether random quotes will be sent to
    the channel when a user joins."""))

conf.registerGroup(Farm, 'figlet')
conf.registerGlobalValue(Farm.figlet, 'command',
    registry.String(utils.findBinaryInPath('figlet') or '', """Determines what
    command will be called for the figlet command."""))

conf.registerGroup(Farm, 'hug')
conf.registerGlobalValue(Farm.hug,
    'highlightQuery', registry.Boolean(True, """Determines whether or not to
    highlight any given query in the output of hug."""))

# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
Beispiel #13
0

def configure(advanced):
    # This will be called by supybot to configure this module.  advanced is
    # a bool that specifies whether the user identified himself as an advanced
    # user or not.  You should effect your configuration by manipulating the
    # registry as appropriate.
    from supybot.questions import expect, anything, something, yn
    conf.registerPlugin('Twitter', True)


Twitter = conf.registerPlugin('Twitter')
conf.registerGlobalValue(
    Twitter, 'command',
    registry.String(
        utils.findBinaryInPath('twitter') or '', """Determines what
    command will be called for the twitter command."""))
conf.registerGlobalValue(
    Twitter, 'optionsF',
    registry.String(
        ' -t -d', """Determines what
    options will be used for the twitter command friends."""))
conf.registerGlobalValue(
    Twitter, 'optionsG',
    registry.String(
        'on_pvt_ircd_only -t -d', """Determines what
    options will be used for the twitter command global."""))
conf.registerGlobalValue(
    Twitter, 'optionsR',
    registry.String(
        'replies -t -d', """Determines what
Beispiel #14
0
    output(
        _("""The "progstats" command can reveal potentially sensitive
              information about your machine. Here's an example of its output:

              %s\n""") % progstats())
    if yn(_('Would you like to disable this command for non-owner users?'),
          default=True):
        conf.supybot.commands.disabled().add('Unix.progstats')


Unix = conf.registerPlugin('Unix')
conf.registerGroup(Unix, 'fortune')
conf.registerGlobalValue(
    Unix.fortune, 'command',
    registry.String(
        utils.findBinaryInPath('fortune') or '',
        _("""Determines
    what command will be called for the fortune command.""")))
conf.registerChannelValue(
    Unix.fortune, 'short',
    registry.Boolean(
        True,
        _("""Determines whether only short fortunes will be
    used if possible.  This sends the -s option to the fortune program.""")))
conf.registerGlobalValue(
    Unix.fortune, 'equal',
    registry.Boolean(
        True,
        _("""Determines whether fortune will give equal
    weight to the different fortune databases.  If false, then larger
    databases will be given more weight.  This sends the -e option to the
Beispiel #15
0
import supybot.conf as conf
import supybot.utils as utils
import supybot.registry as registry
try:
    from supybot.i18n import PluginInternationalization
    _ = PluginInternationalization('SysDNS')
except:
    # Placeholder that allows to run the plugin on a bot
    # without the i18n module
    _ = lambda x:x

def configure(advanced):
    # This will be called by supybot to configure this module.  advanced is
    # a bool that specifies whether the user identified himself as an advanced
    # user or not.  You should effect your configuration by manipulating the
    # registry as appropriate.
    from supybot.questions import expect, anything, something, yn
    conf.registerPlugin('SysDNS', True)


SysDNS = conf.registerPlugin('SysDNS')
conf.registerGlobalValue(SysDNS, 'command',
    registry.String(utils.findBinaryInPath('host') or '', _("""Determines
    what command will be called by the dns command. This should usually be 
    the location of the 'host' binary (or similar tool), such as 
    '/usr/bin/host'.""")))


# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
Beispiel #16
0
 def testFindBinaryInPath(self):
     if os.name == 'posix':
         self.assertEqual(None, utils.findBinaryInPath('asdfhjklasdfhjkl'))
         self.failUnless(utils.findBinaryInPath('sh').endswith('/bin/sh'))
Beispiel #17
0
              %s\n"""
        )
        % progstats()
    )
    if yn(_("Would you like to disable this command for non-owner users?"), default=True):
        conf.supybot.commands.disabled().add("Unix.progstats")


Unix = conf.registerPlugin("Unix")
conf.registerGroup(Unix, "fortune")
conf.registerGlobalValue(
    Unix.fortune,
    "command",
    registry.String(
        utils.findBinaryInPath("fortune") or "",
        _(
            """Determines
    what command will be called for the fortune command."""
        ),
    ),
)
conf.registerChannelValue(
    Unix.fortune,
    "short",
    registry.Boolean(
        True,
        _(
            """Determines whether only short fortunes will be
    used if possible.  This sends the -s option to the fortune program."""
        ),