void MasterPintoManualServerQuerier::onPintoData(const String& data) {
    Sirikata::Protocol::MasterPinto::PintoResponse resp;
    bool parsed = parsePBJMessage(&resp, data);
    if (!parsed) {
        MP_LOG(error, "Couldn't parse response from server.");
        return;
    }

    if (resp.has_prox_results()) {
        Sirikata::Protocol::Prox::ProximityResults msg = resp.prox_results();

        // The manual master pinto sends proximity updates directly, we can just
        // pass them along
        for(int32 idx = 0; idx < msg.update_size(); idx++) {
            Sirikata::Protocol::Prox::ProximityUpdate prox_update = msg.update(idx);
            notify(&PintoServerQuerierListener::onPintoServerResult, prox_update);
        }
    }

    if (resp.has_loc_updates()) {
        Sirikata::Protocol::Loc::BulkLocationUpdate bu = resp.loc_updates();
        for(int32 li = 0; li < bu.update_size(); li++) {
            NopTimeSynced nop_ts;
	  LocProtocolLocUpdate tmp(bu.update(li), nop_ts);//llvm-based compilers want a temporary variable with a name to avoid copy constructor call
            // notify wants to only pass through values and tries to copy the
            // LocProtocolLocUpdate by default -- we need to jump through hoops and
            // specify the exact template types explicitly to make this work
            notify<void(PintoServerQuerierListener::*)(const Sirikata::LocUpdate&), const LocProtocolLocUpdate&>(&PintoServerQuerierListener::onPintoServerLocUpdate, tmp);
        }
    }
}
void StandardLocationService::receiveMessage(Message* msg) {
    assert(msg->dest_port() == SERVER_PORT_LOCATION);
    Sirikata::Protocol::Loc::BulkLocationUpdate contents;
    bool parsed = parsePBJMessage(&contents, msg->payload());

    if (parsed) {
        for(int32 idx = 0; idx < contents.update_size(); idx++) {
            Sirikata::Protocol::Loc::LocationUpdate update = contents.update(idx);

            // Its possible we'll get an out of date update. We only use this update
            // if (a) we have this object marked as a replica object and (b) we don't
            // have this object marked as a local object
            if (type(update.object()) != Replica)
                continue;

            LocationMap::iterator loc_it = mLocations.find( update.object() );
            // We can safely make this assertion right now because space server
            // to space server loc and prox are on the same reliable channel. If
            // this goes away then a) we can't make this assertion and b) we
            // need an OrphanLocUpdateManager to save updates where this
            // condition is false so they can be applied once the prox update
            // arrives.
            assert(loc_it != mLocations.end());

            if (update.has_location()) {
                TimedMotionVector3f newloc(
                    update.location().t(),
                    MotionVector3f( update.location().position(), update.location().velocity() )
                );
                loc_it->second.location = newloc;
                notifyReplicaLocationUpdated( update.object(), newloc );

                CONTEXT_SPACETRACE(serverLoc, msg->source_server(), mContext->id(), update.object(), newloc );
            }

            if (update.has_orientation()) {
                TimedMotionQuaternion neworient(
                    update.orientation().t(),
                    MotionQuaternion( update.orientation().position(), update.orientation().velocity() )
                );
                loc_it->second.orientation = neworient;
                notifyReplicaOrientationUpdated( update.object(), neworient );
            }

            if (update.has_bounds()) {
                BoundingSphere3f newbounds = update.bounds();
                loc_it->second.bounds = newbounds;
                notifyReplicaBoundsUpdated( update.object(), newbounds );
            }

            if (update.has_mesh()) {
                String newmesh = update.mesh();
                loc_it->second.mesh = newmesh;
                notifyReplicaMeshUpdated( update.object(), newmesh );
            }

            if (update.has_physics()) {
                String newphy = update.physics();
                loc_it->second.physics = newphy;
                notifyReplicaPhysicsUpdated( update.object(), newphy );
            }
        }
    }

    delete msg;
}