Commented out new.function stuff for later when new.function actually works.

This commit is contained in:
Jeremy Fincher 2003-09-29 05:41:03 +00:00
parent d0f9e11a32
commit 14459d05d8
2 changed files with 11 additions and 1 deletions

View File

@ -36,6 +36,7 @@ Allows 'aliases' for other commands.
from baseplugin import *
import re
import new
import sets
import conf
@ -144,6 +145,7 @@ def makeNewAlias(name, alias):
args = args[biggestDollar:]
alias_ = atRe.sub(replace, alias_)
self.Proxy(irc.irc, msg, callbacks.tokenize(alias_))
#f = new.function(f.func_code, f.func_globals, alias)
f.__doc__ ='<an alias, %s>\n\nAlias for %r' % \
(utils.nItems(biggestDollar, 'argument'), alias)
#f = new.function(f.func_code, f.func_globals, name)

View File

@ -83,11 +83,15 @@ def checkCapability(f, capability):
f(self, irc, msg, args)
else:
irc.error(msg, conf.replyNoCapability % capability)
#newf = new.function(newf.func_code, newf.func_globals, f.func_name)
newf.__doc__ = f.__doc__
return newf
def checkChannelCapability(f, capability):
"""Makes sure a user has a certain channel capability before running f."""
"""Makes sure a user has a certain channel capability before running f.
Do note that you need to add a "channel" argument to your argument list.
"""
def newf(self, irc, msg, args, *L):
channel = getChannel(msg, args) # Make a copy, f might getChannel.
chancap = ircdb.makeChannelCapability(channel, capability)
@ -97,6 +101,7 @@ def checkChannelCapability(f, capability):
ff(irc, msg, args, *L)
else:
irc.error(msg, conf.replyNoCapability % chancap)
#newf = new.function(newf.func_code, newf.func_globals, f.func_name)
newf.__doc__ = f.__doc__
return newf
@ -106,6 +111,7 @@ def thread(f):
ff = new.instancemethod(f, self, self.__class__)
t = callbacks.CommandThread(self.callCommand, ff, irc, msg, args, *L)
t.start()
#newf = new.function(newf.func_code, newf.func_globals, f.func_name)
newf.__doc__ = f.__doc__
return newf
@ -123,6 +129,7 @@ def name(f):
L = (name,) + L
ff = new.instancemethod(f, self, self.__class__)
ff(irc, msg, args, *L)
#newf = new.function(newf.func_code, newf.func_globals, f.func_name)
newf.__doc__ = f.__doc__
return newf
@ -133,6 +140,7 @@ def channel(f):
L = (channel,) + L
ff = new.instancemethod(f, self, self.__class__)
ff(irc, msg, args, *L)
#newf = new.function(newf.func_code, newf.func_globals, f.func_name)
newf.__doc__ = f.__doc__
return newf