- ClientEvent event;
- event.type = CE_TEXTURES_UPDATED;
- m_client_event_queue.push_back(event);
- }
- else if(command == TOCLIENT_TOOLDEF)
- {
- infostream<<"Client: WARNING: Ignoring TOCLIENT_TOOLDEF"<<std::endl;
- }
- else if(command == TOCLIENT_NODEDEF)
- {
- infostream<<"Client: Received node definitions: packet size: "
- <<datasize<<std::endl;
-
- // Mesh update thread must be stopped while
- // updating content definitions
- assert(!m_mesh_update_thread.IsRunning());
-
- // Decompress node definitions
- std::string datastring((char*)&data[2], datasize-2);
- std::istringstream is(datastring, std::ios_base::binary);
- std::istringstream tmp_is(deSerializeLongString(is), std::ios::binary);
- std::ostringstream tmp_os;
- decompressZlib(tmp_is, tmp_os);
-
- // Deserialize node definitions
- std::istringstream tmp_is2(tmp_os.str());
- m_nodedef->deSerialize(tmp_is2);
- m_nodedef_received = true;
- }
- else if(command == TOCLIENT_CRAFTITEMDEF)
- {
- infostream<<"Client: WARNING: Ignoring TOCLIENT_CRAFTITEMDEF"<<std::endl;
- }
- else if(command == TOCLIENT_ITEMDEF)
- {
- infostream<<"Client: Received item definitions: packet size: "
- <<datasize<<std::endl;
-
- // Mesh update thread must be stopped while
- // updating content definitions
- assert(!m_mesh_update_thread.IsRunning());
-
- // Decompress item definitions
- std::string datastring((char*)&data[2], datasize-2);
- std::istringstream is(datastring, std::ios_base::binary);
- std::istringstream tmp_is(deSerializeLongString(is), std::ios::binary);
- std::ostringstream tmp_os;
- decompressZlib(tmp_is, tmp_os);
-
- // Deserialize node definitions
- std::istringstream tmp_is2(tmp_os.str());
- m_itemdef->deSerialize(tmp_is2);
- m_itemdef_received = true;
- }
- else if(command == TOCLIENT_PLAY_SOUND)
- {
- std::string datastring((char*)&data[2], datasize-2);
- std::istringstream is(datastring, std::ios_base::binary);
-
- s32 server_id = readS32(is);
- std::string name = deSerializeString(is);
- float gain = readF1000(is);
- int type = readU8(is); // 0=local, 1=positional, 2=object
- v3f pos = readV3F1000(is);
- u16 object_id = readU16(is);
- bool loop = readU8(is);
- // Start playing
- int client_id = -1;
- switch(type){
- case 0: // local
- client_id = m_sound->playSound(name, loop, gain);
- break;
- case 1: // positional
- client_id = m_sound->playSoundAt(name, loop, gain, pos);
- break;
- case 2: { // object
- ClientActiveObject *cao = m_env.getActiveObject(object_id);
- if(cao)
- pos = cao->getPosition();
- client_id = m_sound->playSoundAt(name, loop, gain, pos);
- // TODO: Set up sound to move with object
- break; }
- default:
+ std::string playername_u = lowercase(getPlayerName());
+ m_auth_data = srp_user_new(SRP_SHA256, SRP_NG_2048,
+ getPlayerName().c_str(), playername_u.c_str(),
+ (const unsigned char *) m_password.c_str(),
+ m_password.length(), NULL, NULL);
+ char *bytes_A = 0;
+ size_t len_A = 0;
+ SRP_Result res = srp_user_start_authentication(
+ (struct SRPUser *) m_auth_data, NULL, NULL, 0,
+ (unsigned char **) &bytes_A, &len_A);
+ FATAL_ERROR_IF(res != SRP_OK, "Creating local SRP user failed.");
+
+ NetworkPacket resp_pkt(TOSERVER_SRP_BYTES_A, 0);
+ resp_pkt << std::string(bytes_A, len_A) << based_on;
+ Send(&resp_pkt);