mirror of
https://github.com/ncoevoet/ChanTracker.git
synced 2025-05-05 09:50:53 -05:00
fix pattern not correctly updated
This commit is contained in:
parent
648c416ca6
commit
93d55d9052
11
plugin.py
11
plugin.py
@ -1064,11 +1064,9 @@ class Chan (object):
|
|||||||
c = db.cursor()
|
c = db.cursor()
|
||||||
c.execute("""SELECT id, count FROM patterns WHERE id=? and channel=? LIMIT 1""",(uid,self.name))
|
c.execute("""SELECT id, count FROM patterns WHERE id=? and channel=? LIMIT 1""",(uid,self.name))
|
||||||
items = c.fetchall()
|
items = c.fetchall()
|
||||||
if len(items):
|
(id, count) = items[0]
|
||||||
(id, count) = items[0]
|
c.execute("""UPDATE patterns SET count=? WHERE id=?""", (int(count)+1,int(uid)))
|
||||||
count = count + 1
|
db.commit()
|
||||||
c.execute("""UPDATE patterns SET count=? WHERE id=?""", (int(id),count))
|
|
||||||
db.commit()
|
|
||||||
c.close()
|
c.close()
|
||||||
|
|
||||||
def lspattern (self,prefix,pattern,db):
|
def lspattern (self,prefix,pattern,db):
|
||||||
@ -3137,7 +3135,6 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler):
|
|||||||
if pattern.match(text):
|
if pattern.match(text):
|
||||||
if pattern.limit == 0:
|
if pattern.limit == 0:
|
||||||
isPattern = pattern
|
isPattern = pattern
|
||||||
chan.countpattern(pattern.uid,self.getDb(irc.network))
|
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
prop = 'Pattern%s' % pattern.uid
|
prop = 'Pattern%s' % pattern.uid
|
||||||
@ -3150,13 +3147,13 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler):
|
|||||||
if len(chan.spam[prop][key]) > pattern.limit:
|
if len(chan.spam[prop][key]) > pattern.limit:
|
||||||
chan.spam[prop][key].reset()
|
chan.spam[prop][key].reset()
|
||||||
isPattern = pattern
|
isPattern = pattern
|
||||||
chan.countpattern(pattern.uid,self.getDb(irc.network))
|
|
||||||
break
|
break
|
||||||
if isPattern:
|
if isPattern:
|
||||||
r = self.getIrcdMode(irc,isPattern.mode,best)
|
r = self.getIrcdMode(irc,isPattern.mode,best)
|
||||||
self._act(irc,channel,r[0],r[1],isPattern.duration,'matches #%s' % isPattern.uid)
|
self._act(irc,channel,r[0],r[1],isPattern.duration,'matches #%s' % isPattern.uid)
|
||||||
isBad = self._isBad(irc,channel,best)
|
isBad = self._isBad(irc,channel,best)
|
||||||
self.forceTickle = True
|
self.forceTickle = True
|
||||||
|
chan.countpattern(isPattern.uid,self.getDb(irc.network))
|
||||||
elif not isPattern and isMass:
|
elif not isPattern and isMass:
|
||||||
kind = 'massRepeat'
|
kind = 'massRepeat'
|
||||||
mode = self.registryValue('%sMode' % kind,channel=channel)
|
mode = self.registryValue('%sMode' % kind,channel=channel)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user