def has_aop_in(bot, id, chan, ret): id_str = "%s!%s@%s" % tuple(id) for op in conf.get(chan.lower(), []): if "!" in op or "@" in op: # Match against a nick!user@host with wildcards. try: op = re.compile(util.wc_to_re(op), flags=re.I) except re.error: continue if op.match(id_str): yield ret(True) return else: # Match against an access name, according to 'identity'. access = yield identity.check_access(bot, id, op) if access: yield ret(True) return yield ret(False)
def check(bot, id, ret): if identify_check(id): yield ret(True); return if os.path.exists(ADMINS_FILE): with open(ADMINS_FILE) as file: admins = re.findall(r'\S+', file.read()) for admin in admins: if any(c in admin for c in '!@*?'): # Verify against a hostmask with wildcards. hostmask = '%s!%s@%s' % id if re.match(util.wc_to_re(admin), hostmask, re.I): yield ret(True); return else: # Verify an access name according to the 'identity' module. access = yield identity.check_access(bot, id, admin) if access: yield ret(True); return yield ret(False)
def h_tell_sent(bot, id, target, sent_msgs, reply_msg=None): father = yield identity.check_access(bot, id, 'tell.father') if father: reply_msg = 'Yes, father' yield sign('tell_fto.TELL_SENT', bot, id, target, sent_msgs, reply_msg)