def handle_delalias(bot, ievent): """ alias-del <word> .. delete alias. """ try: what = ievent.args[0] except IndexError: ievent.missing('<what>') return # del alias and save if not aliasdel(what): ievent.reply('there is no %s alias' % what) return aliases.save() ievent.reply('alias deleted')
txt = ' '.join(ievent.args[1:]) except ValueError: txt = ievent.rest nrtimes = 100000 except IndexError: ievent.missing(' <searchitem> or <nrtimes> <searchitem>') return result = logs.search(ievent.channel, txt, nrtimes) sayresult(bot, ievent, result) cmnds.add('log-search', handle_logsearch, ['USER', 'WEB', 'CLOUD'], speed=3) examples.add( 'log-search', 'log-search [<nrtimes>] <txt> .. search the log \ from the beginning', '1) log-search http 2) log-search 10 http') aliasdel('search') def handle_loglast(bot, ievent): """ log-last [<nr>] [<nick>] [<txt>] .. search log for last lines of <nick> containing <txt> """ if ievent.channel not in logs.loglist: ievent.reply('logging not enabled in %s' % ievent.channel) return result = [] try: nrlines = int(ievent.args[0]) del ievent.args[0] except (IndexError, ValueError): nrlines = 100000 try:
try: nrtimes = int(ievent.args[0]) txt = ' '.join(ievent.args[1:]) except ValueError: txt = ievent.rest nrtimes = 100000 except IndexError: ievent.missing(' <searchitem> or <nrtimes> <searchitem>') return result = logs.search(ievent.channel, txt, nrtimes) sayresult(bot, ievent, result) cmnds.add('log-search', handle_logsearch, ['USER', 'WEB', 'CLOUD'], speed=3) examples.add('log-search', 'log-search [<nrtimes>] <txt> .. search the log \ from the beginning', '1) log-search http 2) log-search 10 http') aliasdel('search') def handle_loglast(bot, ievent): """ log-last [<nr>] [<nick>] [<txt>] .. search log for last lines of <nick> containing <txt> """ if ievent.channel not in logs.loglist: ievent.reply('logging not enabled in %s' % ievent.channel) return result = [] try: nrlines = int(ievent.args[0]) del ievent.args[0] except (IndexError, ValueError): nrlines = 100000 try: nick, txt = ievent.args
try: result = users.adduserpermit(name, (who, what)) except Exception, ex: handle_exception() ievent.reply("ERROR: %s" % str(ex)) return if result: ievent.reply('permit added') else: ievent.reply('add failed') cmnds.add('user-addpermit', handle_addpermit, 'USER') examples.add('user-addpermit', 'user-addpermit <nick> <what> .. permit \ nick access to <what> .. use setperms to add permissions', \ 'user-addpermit dunker todo') aliasdel('allow') tests.add('user-add mtest mekker@test').add('user-addpermit mtest todo', 'permit added').add('user-delpermit mtest todo').add('delete mtest') def handle_permit(bot, ievent): """ user-permit .. get permit list of user giving the command """ if ievent.rest: ievent.reply("use the user-addpermit command to allow somebody \ something .. use getname <nick> to get the username of somebody .. this \ command shows what permits you have") return name = users.getname(ievent.userhost) if not name: ievent.reply("can't find user for %s" % ievent.userhost) return permits = users.getuserpermits(name) if permits:
if errors: errordict = Dol() errorlist = [] for i, j in errors.iteritems(): errordict.add(j, i) for error, sites in errordict.iteritems(): errorlist.append("%s => %s" % (' , '.join(sites), error)) ievent.reply("errors: ", errors, dot=True) cmnds.add('install-plug', handle_installplug, 'OPER', threaded=True) examples.add( 'install-plug', 'install-plug <list of plugins> .. try to \ install plugins checking all known sites', '1) install-plug 8b 2) \ install-plug 8b koffie') aliasdel('install-plug') aliasset( 'install-defaultplugs', 'install-plug alarm idle remind quote karma infoitem log ops rss todo seen url snarf dns popcon udp' ) def handle_installkey(bot, ievent): """ install a remote gpg key into the keyring """ if not bot.ownercheck(ievent): return if len(ievent.args) != 1: return ievent.missing('<key id> or <key file url>') url = ievent.args[0] if url.startswith('http://'): try: