This file is indexed.

/usr/lib/python2.7/dist-packages/gplugs/away.py is in gozerbot 0.99.1-5.

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
# plugs/away.py
#
# 

""" keep away messages """

__copyright__ = 'this file is in the public domain'

from gozerbot.generic import rlog
from gozerbot.commands import cmnds
from gozerbot.examples import examples
from gozerbot.callbacks import callbacks
from gozerbot.users import users
from gozerbot.plugins import plugins
from gozerbot.datadir import datadir
from gozerbot.persist.persist import PlugPersist
from gozerbot.plughelp import plughelp
from gozerbot.tests import tests
import time, os

plughelp.add('away', "keep notice of who's away")

lasttime = []

# use datadir/away as pickle file
awaydict = PlugPersist('away.data')

# see if data attribute is set otherwise init it
if not awaydict.data:
    awaydict.data = {}
if not awaydict.data.has_key('enable'):
    awaydict.data['enable'] = 0
    awaydict.save()

def init():
    """ init plugin """
    if not awaydict.data['enable']:
        rlog(0, 'away', 'away is disabled')
        return 1
    else:
        rlog(0, 'away', 'away is enabled')
    callbacks.add('PRIVMSG', doaway, awaytest)
    callbacks.add('PRIVMSG', doback, backtest)
    return 1

def awaytest(bot, ievent):
    """ test if away callback should be called """
    if (len(ievent.txt) > 1 and ievent.txt[-1] == '\001' and \
ievent.txt[-2] == '&' ) or ievent.txt.strip() == '&':
        return 1
        
def doaway(bot, ievent):
    """ away callback """
    if not users.allowed(ievent.userhost, 'USER'):
        return
    # use username of user giving the command
    name = users.getname(ievent.userhost)
    if not name:
        return
    if awaydict.data.has_key((name, bot.name, ievent.channel)):
        return
    ievent.reply("ltrs %s" % ievent.nick)
    # add away data to entry indexed by username, botname and channel
    awaydict.data[(name, bot.name, ievent.channel)] = time.time()
    awaydict.save()

def backtest(bot, ievent):
    """ test if we should say hello """
    if 'back' == ievent.txt.strip() or 're' == ievent.txt.strip():
        return 1
    
def doback(bot, ievent):
    """ say hello """
    if not users.allowed(ievent.userhost, 'USER'):
        return
    # reset away entry 
    name = users.getname(ievent.userhost)
    if not name:
        return
    if not awaydict.data.has_key((name, bot.name, ievent.channel)):
        return
    ievent.reply("welcome back %s" % ievent.nick)
    try:
        del awaydict.data[(name, bot.name, ievent.channel)]
        awaydict.save()
    except KeyError:
        pass

def handle_awayenable(bot, ievent):
    """ away-enable .. enable away """
    awaydict.data['enable'] = 1
    awaydict.save()
    plugins.reload('gplugs', 'away')
    ievent.reply('away enabled')

cmnds.add('away-enable', handle_awayenable, 'OPER', threaded=True)
examples.add('away-enable' , 'enable the away plugin', 'away-enable')

def handle_awaydisable(bot, ievent):
    """ away-disable .. disable away """
    awaydict.data['enable'] = 0
    awaydict.save()
    plugins.reload('gplugs', 'away')
    ievent.reply('away disabled')

cmnds.add('away-disable', handle_awaydisable, 'OPER')
examples.add('away-disable', 'disable the away plugin', 'away-disable')
tests.add('away-enable --chan #dunkbots', 'enabled').fakein(':dunker!mekker@127.0.0.1 PRIVMSG #dunkbots :&').fakein(':dunker!mekker@127.0.0.1 PRIVMSG #dunkbots :re').add('away-disable --chan #dunkbots', 'disabled')