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

« back to all changes in this revision

Viewing changes to gozerbot/commands.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:
20
20
    def __init__(self, func, perm, plugname, speed=5, threaded=True, \
21
21
allowqueue=True, options={}):
22
22
        # function to call
 
23
        self.name = "noname"
23
24
        self.func = func
24
25
        # make sure permission(s) are stored in a list
25
26
        if type(perm) == types.ListType:
97
98
        return 0
98
99
 
99
100
    @locked
100
 
    def add(self, cmnd, func, perm, speed=5, threaded=True, allowqueue=True, options={}):
 
101
    def add(self, cmnd, func, perm, speed=5, threaded=True, allowqueue=True, \
 
102
options={}):
101
103
        """ add a command """
102
104
        # plugin where the command is added
103
105
        plugname = calledfrom(sys._getframe())
105
107
        # add command
106
108
        self[cmnd.lower()] = Command(func, perm, plugname, speed, threaded, \
107
109
allowqueue, options)
 
110
        self[cmnd.lower()].name = cmnd.lower()
108
111
 
109
112
    @locked
110
113
    def apropos(self, what, perms=[]):
155
158
        name = name.lower()
156
159
        if self.has_key(name):
157
160
            return self[name].perms
 
161
        else:
 
162
            return []
158
163
 
159
164
    @locked
160
165
    def setperm(self, name, perm):