This file is indexed.

/usr/share/pyshared/gplugs/umode.py is in gozerbot 0.99.1-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# plugs/umode.py
# 
#

__author__ = "Wijnand 'tehmaze' Modderman - http://tehmaze.com"
__license__ = 'BSD'
__gendoclast__ = ['usermode-del', ]

from gozerbot.utils.generic import convertpickle
from gozerbot.callbacks import callbacks
from gozerbot.commands import cmnds
from gozerbot.datadir import datadir
from gozerbot.persist.pdol import Pdol
from gozerbot.plughelp import plughelp
from gozerbot.examples import examples
from gozerbot.tests import tests

import os
import types

plughelp.add('umode', 'on-connect bot usermode')

## UPGRADE PART

def upgrade():
    convertpickle(datadir + os.sep + 'umode', datadir + os.sep + 'plugs' + os.sep + 'umode' + \
os.sep + 'umode')

## END UPGRADE PART

class UModes(Pdol):

    """ umodes object """

    def __init__(self):
        Pdol.__init__(self, datadir + os.sep + 'plugs' + os.sep + 'umode' + \
os.sep + 'umode')

    def addmode(self, bot, modes):
        """ add a mode to the bot """
        if type(modes) == types.StringType:
            modes = list(modes)
        if not self.get(bot.name):
            self.new(bot.name)
        for mode in modes:
            if not mode in self.data[bot.name]:
                self.add(bot.name, mode)
        self.save()

    def delmode(self, bot, modes):
        """ delete mode from the bot """
        if type(modes) == types.StringType:
            modes = list(modes)
        if not self.get(bot.name):
            return
        for mode in modes:
            if mode in self.data[bot.name]:
                self.data[bot.name].remove(mode)
        self.save()

    def getmode(self, bot):
        """ get mode of the bot """
        return self.get(bot.name) or []

    def domode(self, bot):
        """ set bot mode on server """
        modes = self.getmode(bot)
        if modes:
            bot.sendraw('MODE %s +%s' % (bot.nick, ''.join(modes)))

    def handle_001(self, bot, ievent):
        """ call on connect to server """
        self.domode(bot)

umodes = UModes()
if not umodes.data:
    umodes = UModes()

def handle_usermodeadd(bot, ievent):
    """ add mode to bot """
    if not ievent.args:
        ievent.missing('<mode(s)>')
        return
    umodes.addmode(bot, ' '.join(ievent.args).replace(' ', ''))
    umodes.domode(bot)
    ievent.reply('ok')

cmnds.add('usermode-add', handle_usermodeadd, 'OPER', threaded=True)
examples.add('usermode-add', 'add a usermode', 'usermode-add I')
tests.add('usermode-add I')

def handle_usermodedel(bot, ievent):
    """ delete mode from bot """
    if not ievent.args:
        ievent.missing('<mode(s)>')
        return
    modes = list(' '.join(ievent.args).replace(' ', ''))
    umodes.delmode(bot, modes)
    bot.sendraw('MODE %s -%s' % (bot.nick, ''.join(modes)))
    ievent.reply('ok')

cmnds.add('usermode-del', handle_usermodedel, 'OPER', threaded=True)
examples.add('usermode-del', 'remove a usermode', 'usermode-del I')
tests.add('usermode-del I')

def handle_usermodelist(bot, ievent):
    """ list modes of bot """
    modes = umodes.getmode(bot)
    if not modes:
        ievent.reply('no modes set')
    else:
        modes.sort()
        ievent.reply('mode +%s' % ''.join(modes))

cmnds.add('usermode-list', handle_usermodelist, 'OPER')
examples.add('usermode-list', 'show user modes', 'usermode-list')
tests.add('usermode-list')

# callbacks
callbacks.add('001', umodes.handle_001)