def do_incoming_auth(event, message):
    global is_authed, connected_protoctl
    if (message.command == "PROTOCTL"):
        connected_protoctl = message
    elif (message.command == "PASS"):
        if (message.parameters[0] != config.get("Network/Password")):
            log.critical("Password mismatch!  Expected '%s', got '%s'",
                         config.get("Network/Password"), message.parameters[0])
            Network.sendMsg(
                IRCMessage(':', config.get("Server/Name"), "ERROR",
                           "Closing link: password mismatch"))
            #Network.disconnect() #this is done in the main file
            ffservices.shutdown(1)
    elif (message.command == "SERVER"):
        if (is_authed): return
        is_authed = True
        Server.addServer(
            Server.createServerFromMessage(message, connected_protoctl))
        Event.trigger("Network/LinkEstablished")
        Network.isAuthed = True
        #anything that watches for this event should do things like send user info (NICK),
        #channel membership, channel info, modes, etc at this point
        Network.sendMsg(
            IRCMessage(None, None, "netinfo", 0, int(time.time()),
                       ffservices.unrealProtocol, "*", 0, 0, 0,
                       config.get("Network/Name")))
        #TODO: keep track of my max known global users?
        Network.sendMsg(IRCMessage(None, None, "eos"))
        event.stop()
def do_incoming_auth(event, message):
	global is_authed, connected_protoctl
	if(message.command=="PROTOCTL"):
		connected_protoctl=message
	elif(message.command=="PASS"):
		if(message.parameters[0]!=config.get("Network/Password")):
			log.critical("Password mismatch!  Expected '%s', got '%s'", config.get("Network/Password"), message.parameters[0])
			Network.sendMsg(IRCMessage(':', config.get("Server/Name"), "ERROR", "Closing link: password mismatch"))
			#Network.disconnect() #this is done in the main file
			ffservices.shutdown(1)
	elif(message.command=="SERVER"):
		if(is_authed): return
		is_authed=True
		Server.addServer(Server.createServerFromMessage(message, connected_protoctl))
		Event.trigger("Network/LinkEstablished")
		Network.isAuthed=True
		#anything that watches for this event should do things like send user info (NICK),
		#channel membership, channel info, modes, etc at this point
		Network.sendMsg(IRCMessage(None, None, "netinfo", 0, int(time.time()), ffservices.unrealProtocol, "*", 0, 0, 0, config.get("Network/Name")))
		#TODO: keep track of my max known global users?
		Network.sendMsg(IRCMessage(None, None, "eos"))
		event.stop()