modified a bit stored messages and reply for 'info', 'detail', 'affect' commands

This commit is contained in:
Nicolas Coevoet 2013-12-03 20:19:56 +01:00
parent 6b148879f7
commit 4bb6e83f5f

View File

@ -410,14 +410,24 @@ class Ircd (object):
results.append('"%s" by %s' % (comment,oper)) results.append('"%s" by %s' % (comment,oper))
c.execute("""SELECT full,log FROM nicks WHERE ban_id=?""",(uid,)) c.execute("""SELECT full,log FROM nicks WHERE ban_id=?""",(uid,))
L = c.fetchall() L = c.fetchall()
if len(L): if len(L) == 1:
for affected in L: for affected in L:
(full,log) = affected (full,log) = affected
message = full message = ""
for line in log.split('\n'): for line in log.split('\n'):
message = '%s' % line message = '%s' % line
break break
results.append(message) results.append(message)
elif len(L) > 1:
results.append('affects %s users' % len(L))
#if len(L):
#for affected in L:
#(full,log) = affected
#message = full
#for line in log.split('\n'):
#message = '[%s]' % line
#break
#results.append(message)
c.close() c.close()
return results return results
@ -472,18 +482,18 @@ class Ircd (object):
c.close() c.close()
return [] return []
results = [] results = []
c.execute("""SELECT oper, comment, at FROM comments WHERE ban_id=? ORDER BY at DESC""",(uid,)) #c.execute("""SELECT oper, comment, at FROM comments WHERE ban_id=? ORDER BY at DESC""",(uid,))
L = c.fetchall() #L = c.fetchall()
if len(L): #if len(L):
for com in L: #for com in L:
(oper,comment,at) = com #(oper,comment,at) = com
results.append('"%s" by %s on %s' % (comment,oper,floatToGMT(at))) #results.append('"%s" by %s on %s' % (comment,oper,floatToGMT(at)))
c.execute("""SELECT full,log FROM nicks WHERE ban_id=?""",(uid,)) c.execute("""SELECT full,log FROM nicks WHERE ban_id=?""",(uid,))
L = c.fetchall() L = c.fetchall()
if len(L): if len(L):
for item in L: for item in L:
(full,log) = item (full,log) = item
results.append('for %s' % full) results.append('For [%s]' % full)
for line in log.split('\n'): for line in log.split('\n'):
results.append(line) results.append(line)
else: else:
@ -592,7 +602,7 @@ class Ircd (object):
(full,log) = item (full,log) = item
message = full message = full
for line in log.split('\n'): for line in log.split('\n'):
message = '%s' % line message = '[%s]' % line
break break
results.append(message) results.append(message)
else: else:
@ -861,7 +871,7 @@ class Chan (object):
# insert logs # insert logs
index = 0 index = 0
logs = [] logs = []
logs.append('%s matched by %s' % (n,m)) logs.append('%s' % n)
for line in n.logs: for line in n.logs:
(ts,target,message) = n.logs[index] (ts,target,message) = n.logs[index]
index += 1 index += 1
@ -1091,11 +1101,13 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler):
i = self.getIrc(irc) i = self.getIrc(irc)
results = i.info(irc,id,msg.prefix,self.getDb(irc.network)) results = i.info(irc,id,msg.prefix,self.getDb(irc.network))
if len(results): if len(results):
irc.replies(results,None,None,False,None,True) for message in results:
irc.queueMsg(ircmsgs.privmsg(msg.nick,message))
#irc.replies(results,None,None,False,None,True)
else: else:
irc.reply('item not found or not enough rights to see information') irc.reply('item not found or not enough rights to see information')
self._tickle(irc) self._tickle(irc)
info = wrap(info,['private','user','int']) info = wrap(info,['user','int'])
def detail (self,irc,msg,args,user,uid): def detail (self,irc,msg,args,user,uid):
"""<id> """<id>