mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +01:00
Changed debug.debugMsg to debug.msg.
This commit is contained in:
parent
e88a5a3ae0
commit
33b4aa052c
@ -140,7 +140,7 @@ class MiscCommands(callbacks.Privmsg):
|
||||
will be logged, so don't abuse this command or you'll have an upset
|
||||
admin to deal with.
|
||||
"""
|
||||
debug.debugMsg(pprint.pformat(irc.state.history), 'normal')
|
||||
debug.msg(pprint.pformat(irc.state.history), 'normal')
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
|
||||
def version(self, irc, msg, args):
|
||||
|
@ -78,7 +78,7 @@ class AsyncoreDriver(asynchat.async_chat, object):
|
||||
if self.reconnect:
|
||||
when = time.time() + 60
|
||||
whenS = time.strftime(conf.timestampFormat, time.localtime(when))
|
||||
debug.debugMsg('Scheduling reconnect at %s' % whenS, 'normal')
|
||||
debug.msg('Scheduling reconnect at %s' % whenS, 'normal')
|
||||
def makeNewDriver():
|
||||
self.irc.reset()
|
||||
driver = self.__class__(self.server, reconnect=self.reconnect)
|
||||
@ -145,7 +145,7 @@ class ReplListener(asyncore.dispatcher, object):
|
||||
|
||||
def handle_accept(self):
|
||||
(sock, addr) = self.accept()
|
||||
debug.debugMsg('Connection made to telnet-REPL: ' + str(addr),'normal')
|
||||
debug.msg('Connection made to telnet-REPL: ' + str(addr),'normal')
|
||||
Repl((sock, addr))
|
||||
|
||||
|
||||
@ -195,7 +195,7 @@ Name: """ % (world.version, sys.version.translate(string.ascii, '\r\n'))
|
||||
self.tries += 1
|
||||
self.prompt = 'Name: '
|
||||
msg = 'Unknown user %s on telnet REPL.' % name
|
||||
debug.debugMsg(msg,'high')
|
||||
debug.msg(msg,'high')
|
||||
self.push(self.prompt)
|
||||
elif self.u is not None and not self.authed:
|
||||
password = self.buffer
|
||||
@ -208,16 +208,16 @@ Name: """ % (world.version, sys.version.translate(string.ascii, '\r\n'))
|
||||
self.push('Only owners can use this feature.\n')
|
||||
self.close()
|
||||
msg = 'Attempted non-owner user %s on telnet REPL' % name
|
||||
debug.debugMsg(msg, 'high')
|
||||
debug.msg(msg, 'high')
|
||||
else:
|
||||
self.push('Incorrect Password.\n')
|
||||
self.prompt = 'Name: '
|
||||
self.u = None
|
||||
msg = 'Invalid password for user %s on telnet REPL.' % name
|
||||
debug.debugMsg(msg, 'high')
|
||||
debug.msg(msg, 'high')
|
||||
self.push(self.prompt)
|
||||
elif self.authed:
|
||||
debug.debugMsg('Telnet REPL: %s' % self.buffer)
|
||||
debug.msg('Telnet REPL: %s' % self.buffer)
|
||||
ret = self.repl.addLine(self.buffer+'\r\n')
|
||||
self.buffer = ''
|
||||
if ret is not repl.NotYet:
|
||||
|
@ -236,15 +236,15 @@ class IrcObjectProxy:
|
||||
if callback is not None:
|
||||
anticap = ircdb.makeAntiCapability(name)
|
||||
if ircdb.checkCapability(self.msg.prefix, anticap):
|
||||
debug.debugMsg('Preventing %s from calling %s' % \
|
||||
(self.msg.nick, name))
|
||||
debug.msg('Preventing %s from calling %s' % \
|
||||
(self.msg.nick, name))
|
||||
return
|
||||
recipient = self.msg.args[0]
|
||||
if ircutils.isChannel(recipient):
|
||||
chancap = ircdb.makeChannelCapability(recipient, anticap)
|
||||
if ircdb.checkCapability(self.msg.prefix, chancap):
|
||||
debug.debugMsg('Preventing %s from calling %s' % \
|
||||
(self.msg.nick, name))
|
||||
debug.msg('Preventing %s from calling %s' % \
|
||||
(self.msg.nick, name))
|
||||
return
|
||||
command = getattr(callback, name)
|
||||
callback.callCommand(command, self, self.msg, self.args)
|
||||
@ -418,7 +418,7 @@ class PrivmsgRegexp(Privmsg):
|
||||
s = '%s.%s has an invalid regexp %s: %s' % \
|
||||
(self.__class__.__name__, name,
|
||||
value.__doc__, debug.exnToString(e))
|
||||
debug.debugMsg(s)
|
||||
debug.msg(s)
|
||||
|
||||
def doPrivmsg(self, irc, msg):
|
||||
for (r, method) in self.res:
|
||||
|
@ -136,7 +136,7 @@ def recoverableException():
|
||||
raise
|
||||
lastTimes.append(time.time())
|
||||
if lastTimes[-1] - lastTimes[0] < 0.20:
|
||||
debugMsg('Too many exceptions too quickly. Bailing out.', 'high')
|
||||
msg('Too many exceptions too quickly. Bailing out.', 'high')
|
||||
exit()
|
||||
else:
|
||||
del lastTimes[0]
|
||||
@ -160,15 +160,15 @@ def unrecoverableException():
|
||||
recoverableException()
|
||||
exit(-1)
|
||||
|
||||
def debugMsg(msg, priority='low'):
|
||||
def msg(s, priority='low'):
|
||||
if priorities[priority] >= priorities[minimumDebugPriority]:
|
||||
if stderr:
|
||||
if colorterm:
|
||||
sys.stderr.write(priorityColors.get(priority))
|
||||
_writeNewline(sys.stderr, msg)
|
||||
_writeNewline(sys.stderr, s)
|
||||
if colorterm:
|
||||
sys.stderr.write(ansi.RESET)
|
||||
_writeNewline(_debugfd, msg)
|
||||
_writeNewline(_debugfd, s)
|
||||
_debugfd.flush()
|
||||
|
||||
def printf(msg):
|
||||
|
@ -426,7 +426,7 @@ def checkCapability(hostmask, capability, users=users, channels=channels):
|
||||
try:
|
||||
(channel, capability) = fromChannelCapability(capability)
|
||||
except ValueError: # unpack list of wrong size
|
||||
debug.debugMsg('Invalid channel capability in checkCapability')
|
||||
debug.msg('Invalid channel capability in checkCapability')
|
||||
return False # stupid, invalid capability.
|
||||
# Now, go fetch the channel and check to see what it thinks about
|
||||
# said capability.
|
||||
@ -457,7 +457,7 @@ def checkCapability(hostmask, capability, users=users, channels=channels):
|
||||
try:
|
||||
(channel, capability) = fromChannelCapability(capability)
|
||||
except ValueError:
|
||||
debug.debugMsg('Invalid channel capability in checkCapability')
|
||||
debug.msg('Invalid channel capability in checkCapability')
|
||||
return False # stupid, invalid capability.
|
||||
c = channels.getChannel(channel)
|
||||
# And return the channel's opinion.
|
||||
|
@ -77,7 +77,7 @@ class IrcCallback(object):
|
||||
debug.recoverableException()
|
||||
s = 'Exception raised by %s.%s' % \
|
||||
(self.__class__.__name__, method.im_func.func_name)
|
||||
debug.debugMsg(s)
|
||||
debug.msg(s)
|
||||
|
||||
def reset(self):
|
||||
pass
|
||||
@ -105,7 +105,7 @@ class IrcMsgQueue(object):
|
||||
def enqueue(self, msg):
|
||||
if msg in self.msgs:
|
||||
if not world.startup:
|
||||
debug.debugMsg('Not adding msg %s to queue' % msg, 'normal')
|
||||
debug.msg('Not adding msg %s to queue' % msg, 'normal')
|
||||
else:
|
||||
self.msgs.add(msg)
|
||||
if msg.command in ('MODE', 'KICK', 'PONG'):
|
||||
@ -326,7 +326,7 @@ class Irc(object):
|
||||
msg = self.fastqueue.dequeue()
|
||||
elif self.queue:
|
||||
if now - self.lastTake <= conf.throttleTime:
|
||||
debug.debugMsg('Irc.takeMsg throttling.', 'verbose')
|
||||
debug.msg('Irc.takeMsg throttling.', 'verbose')
|
||||
else:
|
||||
self.lastTake = now
|
||||
msg = self.queue.dequeue()
|
||||
@ -337,7 +337,7 @@ class Irc(object):
|
||||
self.driver.die()
|
||||
elif now > (self.lastping + conf.pingInterval):
|
||||
if now - self.lastTake <= conf.throttleTime:
|
||||
debug.debugMsg('Irc.takeMsg throttling.', 'verbose')
|
||||
debug.msg('Irc.takeMsg throttling.', 'verbose')
|
||||
else:
|
||||
self.lastping = now
|
||||
msg = ircmsgs.ping(str(int(now)))
|
||||
@ -347,11 +347,11 @@ class Irc(object):
|
||||
msg = callback.outFilter(self, msg)
|
||||
if msg is None:
|
||||
s = 'outFilter %s returned None' % callback.name()
|
||||
debug.debugMsg(s)
|
||||
debug.msg(s)
|
||||
return None
|
||||
self.state.addMsg(self,ircmsgs.IrcMsg(msg=msg, prefix=self.prefix))
|
||||
s = '%s %s' % (time.strftime(conf.timestampFormat), msg)
|
||||
debug.debugMsg(s, 'low')
|
||||
debug.msg(s, 'low')
|
||||
if msg.command == 'NICK':
|
||||
# We don't want a race condition where the server's NICK
|
||||
# back to us is lost and someone else steals our nick and uses
|
||||
@ -365,8 +365,7 @@ class Irc(object):
|
||||
return None
|
||||
|
||||
def feedMsg(self, msg):
|
||||
debug.debugMsg('%s %s' % (time.strftime(conf.timestampFormat), msg),
|
||||
'low')
|
||||
debug.msg('%s %s' % (time.strftime(conf.timestampFormat), msg), 'low')
|
||||
# First, make sure self.nick is always consistent with the server.
|
||||
if msg.command == 'NICK' and msg.nick == self.nick:
|
||||
if ircdb.users.hasUser(self.nick):
|
||||
@ -418,7 +417,7 @@ class Irc(object):
|
||||
m = callback.inFilter(self, msg)
|
||||
if not m:
|
||||
debugmsg = 'inFilter %s returned None' % callback.name()
|
||||
debug.debugMsg(debugmsg)
|
||||
debug.msg(debugmsg)
|
||||
msg = m
|
||||
except:
|
||||
debug.recoverableException()
|
||||
|
@ -80,7 +80,7 @@ class Repl(object):
|
||||
line = line.rstrip()
|
||||
self.lines.append(line)
|
||||
if len(self.lines) > 100:
|
||||
debug.debugMsg('too many lines in Repl.')
|
||||
debug.msg('too many lines in Repl.', 'normal')
|
||||
self.lines = []
|
||||
return None
|
||||
if line == '' or line == '\n' or line == '\r\n':
|
||||
|
@ -83,11 +83,11 @@ def upkeep(): # Function to be run on occasion to do upkeep stuff.
|
||||
if os.name == 'nt':
|
||||
msvcrt.heapmin()
|
||||
if gc.garbage:
|
||||
debug.debugMsg('Uncollectable garbge: %s' % gc.garbage, 'normal')
|
||||
debug.msg('Uncollectable garbge: %s' % gc.garbage, 'normal')
|
||||
if 'noflush' not in tempvars:
|
||||
flush()
|
||||
msg = '%s upkeep ran.' % time.strftime(conf.timestampFormat)
|
||||
debug.debugMsg(msg, 'verbose')
|
||||
debug.msg(msg, 'verbose')
|
||||
|
||||
'''
|
||||
def superReload(oldmodule):
|
||||
|
Loading…
Reference in New Issue
Block a user