コード例 #1
0
ファイル: channel.py プロジェクト: Pythonz/PIRB
def channel_msg_auth(nick,host,arg):
	if len(arg) == 0:
		irc_send(nick, "no channel specified")
	elif arg.startswith("#"):
		whois(nick)
		chan = arg.split()[0]
		put("NOTICE %s :[%s] Trying to auth ..." % (nick,chan))
		auth = getauth(nick)
		hostmask = nick+"!"+host
		put("NOTICE %s :[%s] Getting flag for %s (%s)..." % (nick,chan,auth,hostmask))
		flag = getflag(chan,auth)
		hostflag = gethostflag(chan,hostmask)
		put("NOTICE %s :[%s] Flag: %s, Hostflag: %s" % (nick,chan,flag,hostflag))

		if flag == "n" or flag == "o" or hostflag == "o":
			putf("MODE %s +o %s" % (chan,nick))
		elif flag == "v" or hostflag == "v":
			putf("MODE %s +v %s" % (chan,nick))
	else:
		irc_send(nick, "invalid channel")
コード例 #2
0
def channel_msg_auth(nick, host, arg):
    if len(arg) == 0:
        irc_send(nick, "no channel specified")
    elif arg.startswith("#"):
        whois(nick)
        chan = arg.split()[0]
        put("NOTICE %s :[%s] Trying to auth ..." % (nick, chan))
        auth = getauth(nick)
        hostmask = nick + "!" + host
        put("NOTICE %s :[%s] Getting flag for %s (%s)..." %
            (nick, chan, auth, hostmask))
        flag = getflag(chan, auth)
        hostflag = gethostflag(chan, hostmask)
        put("NOTICE %s :[%s] Flag: %s, Hostflag: %s" %
            (nick, chan, flag, hostflag))

        if flag == "n" or flag == "o" or hostflag == "o":
            putf("MODE %s +o %s" % (chan, nick))
        elif flag == "v" or hostflag == "v":
            putf("MODE %s +v %s" % (chan, nick))
    else:
        irc_send(nick, "invalid channel")
コード例 #3
0
def exempt(nick, host, chan, arg):
    auth = getauth(nick)
    flag = getflag(chan, auth)
    hostmask = nick + "!" + host
    hostflag = gethostflag(chan, hostmask)

    if flag == "n" or flag == "o" or hostflag == "o":
        if len(arg.split()) > 0:
            target = arg.split()[0][1:]
            scut = arg.split()[0][0]

            if wmatch(target, "*!*@*"):
                if scut == "+":
                    entry = False

                    for data in _chandb.execute(
                            "select exempt from exempts where channel='%s' and exempt='%s'"
                            % (chan, target)):
                        entry = True

                    if entry is False:
                        _chandb.execute(
                            "insert into exempts values ('%s','%s')" %
                            (chan, target))
                        put("NOTICE %s :[%s] %s has been added to the exemptlist"
                            % (nick, chan, target))
                        whochan(chan)
                    else:
                        put("NOTICE %s :[%s] %s is already on the exemptlist" %
                            (nick, chan, target))
                elif scut == "-":
                    entry = False

                    for data in _chandb.execute(
                            "select exempt from exempts where channel='%s' and exempt='%s'"
                            % (chan, target)):
                        entry = True

                    if entry is True:
                        _chandb.execute(
                            "delete from exempts where channel='%s' and exempt='%s'"
                            % (chan, target))
                        put("NOTICE %s :[%s] %s has been removed from the exemptlist"
                            % (nick, chan, target))
                        put("MODE %s -b %s" % (chan, target))
                    else:
                        put("NOTICE %s :[%s] %s is not on the exemptlist" %
                            (nick, chan, target))
                else:
                    irc_send(nick, "$exempt +/-*!*example@*.example.com")
            else:
                irc_send(nick, "$exempt +/-*!*example@*.example.com")
        else:
            for data in _chandb.execute(
                    "select exempt from exempts where channel='%s'" % chan):
                irc_send(nick, "[%s] %s" % (chan, str(data[0])))
コード例 #4
0
ファイル: channel.py プロジェクト: Pythonz/PIRB
def exempt(nick,host,chan,arg):
	auth = getauth(nick)
	flag = getflag(chan,auth)
	hostmask = nick+"!"+host
	hostflag = gethostflag(chan,hostmask)

	if flag == "n" or flag == "o" or hostflag == "o":
		if len(arg.split()) > 0:
			target = arg.split()[0][1:]
			scut = arg.split()[0][0]

			if wmatch(target, "*!*@*"):
				if scut == "+":
					entry = False

					for data in _chandb.execute("select exempt from exempts where channel='%s' and exempt='%s'" % (chan,target)):
						entry = True

					if entry is False:
						_chandb.execute("insert into exempts values ('%s','%s')" % (chan,target))
						put("NOTICE %s :[%s] %s has been added to the exemptlist" % (nick,chan,target))
						whochan(chan)
					else:
						put("NOTICE %s :[%s] %s is already on the exemptlist" % (nick,chan,target))
				elif scut == "-":
					entry = False

					for data in _chandb.execute("select exempt from exempts where channel='%s' and exempt='%s'" % (chan,target)):
						entry = True

					if entry is True:
						_chandb.execute("delete from exempts where channel='%s' and exempt='%s'" % (chan,target))
						put("NOTICE %s :[%s] %s has been removed from the exemptlist" % (nick,chan,target))
						put("MODE %s -b %s" % (chan,target))
					else:
						put("NOTICE %s :[%s] %s is not on the exemptlist" % (nick,chan,target))
				else:
					irc_send(nick,"$exempt +/-*!*example@*.example.com")
			else:
				irc_send(nick,"$exempt +/-*!*example@*.example.com")
		else:
			for data in _chandb.execute("select exempt from exempts where channel='%s'" % chan):
				irc_send(nick,"[%s] %s" % (chan,str(data[0])))