Misc fixes
This commit is contained in:
@ -89,8 +89,16 @@ class Bantracker(callbacks.Plugin):
|
||||
self.lastMsgs[irc] = msg
|
||||
|
||||
def db_run(self, query, parms, expect_result = False, expect_id = False):
|
||||
cur = self.db.cursor()
|
||||
cur.execute(query, parms)
|
||||
n_tries = 0
|
||||
try:
|
||||
cur = self.db.cursor()
|
||||
cur.execute(query, parms)
|
||||
except:
|
||||
if n_tries > 5:
|
||||
print "Tried more than 5 times, aborting"
|
||||
raise
|
||||
n_tries += 1
|
||||
time.sleep(1)
|
||||
data = None
|
||||
if expect_result: data = cur.fetchall()
|
||||
if expect_id: data = self.db.insert_id()
|
||||
|
@ -616,7 +616,7 @@ class Launchpad(IBugtracker):
|
||||
class Debbugs(IBugtracker):
|
||||
def __init__(self, *args, **kwargs):
|
||||
IBugtracker.__init__(self, *args, **kwargs)
|
||||
self.soap_proxy = SOAPpy.SOAPProxy("bugs.donarmstrong.com/cgi-bin/soap.cgi", "Debbugs/SOAP/Status")
|
||||
self.soap_proxy = SOAPpy.SOAPProxy("bugs.debian.org/cgi-bin/soap.cgi", "Debbugs/SOAP/Status")
|
||||
self.soap_proxy.soapaction = "Debbugs/SOAP/Status#get_status"
|
||||
|
||||
def get_bug(self, id):
|
||||
|
@ -72,6 +72,7 @@ class Encyclopedia(callbacks.Plugin):
|
||||
self.distros = []
|
||||
self.Apt = packages.Apt(self)
|
||||
self.edits = {}
|
||||
self.alert = False
|
||||
|
||||
def addeditor(self, irc, msg, args, name):
|
||||
if not capab(msg.prefix, 'addeditors'):
|
||||
@ -209,6 +210,8 @@ class Encyclopedia(callbacks.Plugin):
|
||||
return Factoid(f[0],f[1],f[2],f[3],f[4])
|
||||
|
||||
def resolve_alias(self, channel, factoid, loop=0):
|
||||
if factoid and factoid.name == self.registryValue('alert'):
|
||||
self.alert = True
|
||||
if loop >= 10:
|
||||
return Factoid('','<reply> Error: infinite <alias> loop detected','','',0)
|
||||
if factoid and factoid.value.lower().startswith('<alias>'):
|
||||
@ -271,6 +274,7 @@ class Encyclopedia(callbacks.Plugin):
|
||||
text = self.addressed(recipient, text, irc)
|
||||
if not text:
|
||||
return
|
||||
self.log.info("%s said in %s: %s" % (msg.prefix, msg.args[0], msg.args[1]))
|
||||
display_info = False
|
||||
target = msg.args[0]
|
||||
if target[0] != '#':
|
||||
@ -318,8 +322,8 @@ class Encyclopedia(callbacks.Plugin):
|
||||
text, target, retmsg = self.get_target(msg.nick, orig_text, target)
|
||||
if text.startswith('bug ') and text != ('bug 1'):
|
||||
return
|
||||
if text == self.registryValue('alert') and msg.args[0][0] == '#' and not display_info:
|
||||
msg.tag('alert')
|
||||
#if text == self.registryValue('alert') and msg.args[0][0] == '#' and not display_info:
|
||||
# msg.tag('alert')
|
||||
ret = self.factoid_lookup(text, channel, display_info)
|
||||
|
||||
# Fall through to package lookup
|
||||
@ -346,9 +350,12 @@ class Encyclopedia(callbacks.Plugin):
|
||||
queue(irc, target, retmsg + ret)
|
||||
else:
|
||||
queue(irc, target, retmsg + ret[0])
|
||||
if msg.tagged('alert'):
|
||||
queue(irc, self.registryValue('relayChannel'), '%s called the ops in %s' % (msg.nick, msg.args[0]))
|
||||
#if msg.tagged('alert'):
|
||||
if self.alert:
|
||||
if target.startswith('#') and not target.endswith('bots'):
|
||||
queue(irc, self.registryValue('relayChannel'), '%s called the ops in %s (%s)' % (msg.nick, msg.args[0], retmsg[:-2]))
|
||||
#queue(irc, self.registryValue('relayChannel'), retmsg + ret[0])
|
||||
self.alert = False
|
||||
for r in ret[1:]:
|
||||
queue(irc, target, r)
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
DIR=/home/dennis/ubotu/data/apt
|
||||
|
||||
for DIST in "$DIR"/*.list; do
|
||||
test -h $DIST && continue
|
||||
DIST=${DIST:${#DIR}}
|
||||
DIST=${DIST/.list}
|
||||
mkdir -p "$DIR/apt-file/$DIST"
|
||||
|
@ -49,7 +49,7 @@ class FreenodeAuth(callbacks.Plugin):
|
||||
for i in range(16):
|
||||
rp += chars[random.randint(1,len(chars))-1]
|
||||
user.setPassword(rp)
|
||||
irc.queueMsg(ircmsgs.IrcMsg('CAPAB IDENTIFY-MSG'))
|
||||
# irc.queueMsg(ircmsgs.IrcMsg('CAPAB IDENTIFY-MSG'))
|
||||
|
||||
def do290(self, irc, msg):
|
||||
assert 'IDENTIFY-MSG' in msg.args[1]
|
||||
|
@ -71,8 +71,8 @@ class Webcal(callbacks.Plugin):
|
||||
if url not in self.cache:
|
||||
self.update(url)
|
||||
events = self.filter(self.cache[url], c)
|
||||
if events[0].is_on() and self.firstevent[c].summary == events[0].summary:
|
||||
continue
|
||||
#if events[0].is_on() and self.firstevent[c].summary == events[0].summary:
|
||||
# continue
|
||||
newtopic = self.maketopic(c, template=self.registryValue('topic',c))
|
||||
if newtopic.strip() != self.irc.state.getTopic(c).strip():
|
||||
self.irc.queueMsg(ircmsgs.topic(c, newtopic))
|
||||
@ -98,8 +98,8 @@ class Webcal(callbacks.Plugin):
|
||||
if len(events) > 1 and events[1].startDate < now:
|
||||
events = events[1:]
|
||||
ev0 = events[0]
|
||||
if ev0.seconds_to_go < 600:
|
||||
preamble = 'Current meeting: %s' % ev0.summary.replace('Meeting','').strip()
|
||||
if ev0.seconds_to_go() < 600:
|
||||
preamble = 'Current meeting: %s ' % ev0.summary.replace('Meeting','').strip()
|
||||
if num_events == 1:
|
||||
return preamble + (template % '')
|
||||
events = events[1:]
|
||||
@ -168,7 +168,7 @@ class Webcal(callbacks.Plugin):
|
||||
return
|
||||
newtopic = self.maketopic(c,tz=tzs[0])
|
||||
events = self.filter(self.cache[url], msg.args[0])
|
||||
if events[0].is_on():
|
||||
if events[0].is_on(): # FIXME channel filter
|
||||
irc.error('Please don\'t use @schedule during a meeting')
|
||||
irc.reply('Schedule for %s: %s' % (tzs[0], newtopic), private=True)
|
||||
else:
|
||||
@ -198,7 +198,7 @@ class Webcal(callbacks.Plugin):
|
||||
newtopic = 'Current time in %s: %s - %s' % \
|
||||
(tzs[0], datetime.datetime.now(pytz.UTC).astimezone(pytz.timezone(tzs[0])).strftime("%B %d %Y, %H:%M:%S"), newtopic)
|
||||
|
||||
if events[0].is_on():
|
||||
if events[0].is_on(): # Fixme -- channel filter
|
||||
irc.error('Please don\'t use @schedule during a meeting')
|
||||
irc.reply(newtopic, private=True)
|
||||
else:
|
||||
|
Reference in New Issue
Block a user