mirror of https://github.com/Mikaela/Limnoria.git
Commented out new.function stuff for later when new.function actually works.
This commit is contained in:
parent
d0f9e11a32
commit
14459d05d8
|
@ -36,6 +36,7 @@ Allows 'aliases' for other commands.
|
||||||
from baseplugin import *
|
from baseplugin import *
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
import new
|
||||||
import sets
|
import sets
|
||||||
|
|
||||||
import conf
|
import conf
|
||||||
|
@ -144,6 +145,7 @@ def makeNewAlias(name, alias):
|
||||||
args = args[biggestDollar:]
|
args = args[biggestDollar:]
|
||||||
alias_ = atRe.sub(replace, alias_)
|
alias_ = atRe.sub(replace, alias_)
|
||||||
self.Proxy(irc.irc, msg, callbacks.tokenize(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' % \
|
f.__doc__ ='<an alias, %s>\n\nAlias for %r' % \
|
||||||
(utils.nItems(biggestDollar, 'argument'), alias)
|
(utils.nItems(biggestDollar, 'argument'), alias)
|
||||||
#f = new.function(f.func_code, f.func_globals, name)
|
#f = new.function(f.func_code, f.func_globals, name)
|
||||||
|
|
|
@ -83,11 +83,15 @@ def checkCapability(f, capability):
|
||||||
f(self, irc, msg, args)
|
f(self, irc, msg, args)
|
||||||
else:
|
else:
|
||||||
irc.error(msg, conf.replyNoCapability % capability)
|
irc.error(msg, conf.replyNoCapability % capability)
|
||||||
|
#newf = new.function(newf.func_code, newf.func_globals, f.func_name)
|
||||||
newf.__doc__ = f.__doc__
|
newf.__doc__ = f.__doc__
|
||||||
return newf
|
return newf
|
||||||
|
|
||||||
def checkChannelCapability(f, capability):
|
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):
|
def newf(self, irc, msg, args, *L):
|
||||||
channel = getChannel(msg, args) # Make a copy, f might getChannel.
|
channel = getChannel(msg, args) # Make a copy, f might getChannel.
|
||||||
chancap = ircdb.makeChannelCapability(channel, capability)
|
chancap = ircdb.makeChannelCapability(channel, capability)
|
||||||
|
@ -97,6 +101,7 @@ def checkChannelCapability(f, capability):
|
||||||
ff(irc, msg, args, *L)
|
ff(irc, msg, args, *L)
|
||||||
else:
|
else:
|
||||||
irc.error(msg, conf.replyNoCapability % chancap)
|
irc.error(msg, conf.replyNoCapability % chancap)
|
||||||
|
#newf = new.function(newf.func_code, newf.func_globals, f.func_name)
|
||||||
newf.__doc__ = f.__doc__
|
newf.__doc__ = f.__doc__
|
||||||
return newf
|
return newf
|
||||||
|
|
||||||
|
@ -106,6 +111,7 @@ def thread(f):
|
||||||
ff = new.instancemethod(f, self, self.__class__)
|
ff = new.instancemethod(f, self, self.__class__)
|
||||||
t = callbacks.CommandThread(self.callCommand, ff, irc, msg, args, *L)
|
t = callbacks.CommandThread(self.callCommand, ff, irc, msg, args, *L)
|
||||||
t.start()
|
t.start()
|
||||||
|
#newf = new.function(newf.func_code, newf.func_globals, f.func_name)
|
||||||
newf.__doc__ = f.__doc__
|
newf.__doc__ = f.__doc__
|
||||||
return newf
|
return newf
|
||||||
|
|
||||||
|
@ -123,6 +129,7 @@ def name(f):
|
||||||
L = (name,) + L
|
L = (name,) + L
|
||||||
ff = new.instancemethod(f, self, self.__class__)
|
ff = new.instancemethod(f, self, self.__class__)
|
||||||
ff(irc, msg, args, *L)
|
ff(irc, msg, args, *L)
|
||||||
|
#newf = new.function(newf.func_code, newf.func_globals, f.func_name)
|
||||||
newf.__doc__ = f.__doc__
|
newf.__doc__ = f.__doc__
|
||||||
return newf
|
return newf
|
||||||
|
|
||||||
|
@ -133,6 +140,7 @@ def channel(f):
|
||||||
L = (channel,) + L
|
L = (channel,) + L
|
||||||
ff = new.instancemethod(f, self, self.__class__)
|
ff = new.instancemethod(f, self, self.__class__)
|
||||||
ff(irc, msg, args, *L)
|
ff(irc, msg, args, *L)
|
||||||
|
#newf = new.function(newf.func_code, newf.func_globals, f.func_name)
|
||||||
newf.__doc__ = f.__doc__
|
newf.__doc__ = f.__doc__
|
||||||
return newf
|
return newf
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue