~ubuntu-branches/ubuntu/precise/gozerbot/precise

« back to all changes in this revision

Viewing changes to gozerplugs/plugs/reload.py

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Malcolm
  • Date: 2008-06-02 19:26:39 UTC
  • mfrom: (1.1.3 upstream) (3.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080602192639-3rn65nx4q1sgd6sy
Tags: 0.8.1-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
#
3
3
#
4
4
 
5
 
""" reload/unload commands """
6
 
 
7
5
__copyright__ = 'this file is in the public domain'
8
6
 
9
7
from gozerbot.config import config
31
29
            ievent.reply('config reloaded')
32
30
            return
33
31
        # first check myplugs then dbplugs and finally plugs dir
34
 
        got = 0
 
32
        got = []
35
33
        base = 'myplugs' + os.sep + plug
36
34
        if os.path.isfile(base + '.py') or os.path.isdir(base):
37
 
            if plugins.reload('myplugs', plug):
38
 
                got = 1
 
35
            got = plugins.reload('myplugs', plug)
39
36
        else:
40
37
            if config['dbenable']:
41
38
                dbplugs = my_import('gozerplugs.dbplugs.__init__')
46
43
            if plug in plugs.__all__:
47
44
                got = plugins.reload('gozerplugs.plugs', plug)
48
45
        if got:
49
 
            ievent.reply('%s reloaded' % plug)
 
46
            ievent.reply('reloaded %s' % ' .. '.join(got))
50
47
        else:
51
48
            ievent.reply("error reloading %s plugin" % plug)
52
49
 
71
68
        ievent.reply("%s unload failed" % what)
72
69
 
73
70
cmnds.add('unload', handle_unload, 'OPER')
74
 
examples.add('unload', 'unload <plugin>', 'unload test')
 
71
examples.add('unload', 'unload <plugin>', 'unload relay')