Пример #1
0
void Client::parseIncoming(char *buff, int len) {
	char type[128];
	char *next;
	if(!find_param(0, buff, type,sizeof(type))) {
		sendError(sd,true,"There was an error parsing a request.",GP_PARSE,1);
		return;	
	}
//	printf("msg type: %s\n",type);
//	if(userid == 0) {
//		sendError(sd,true,"This request cannot be processed because you are not logged in.",GP_NOT_LOGGED_IN,-1);
//		deleteClient(this);
//		return;
//	}
	if(strcmp(type,"auth") == 0) {
		handleAuth(buff,len);
	} else if(strcmp(type,"ka") == 0) {
		
	}
	if(authenticated == 0 || game == NULL) {
		sendError(sd,true,"Failed to validate",GP_GENERAL,1);
		return;
	}
	if(strcmp(type,"authp") == 0) {
		handleAuthP(buff,len);
	} else if(strcmp(type,"newgame") == 0) {
		gameInProgress = true;
	} else if(strcmp(type,"updgame") == 0) {
		handleUpdateGame(buff,len);
	} else if(strcmp(type,"setpd") == 0) {
		handleSetPD(buff,len);
	} else if(strcmp(type,"getpd") == 0) {
		handleGetPD(buff,len);
	} else {
//		printf("Unknown Command: %s\n",buff);
		return;
	}
}
Пример #2
0
	void Authenticator::Init ()
	{
		XmlSettingsManager::Instance ().RegisterObject ("lastfm.login",
				this, "handleAuth");
		handleAuth ();
	}