void ImportTracker::get_update(S32 newid, BOOL justCreated, BOOL createSelected) { switch (state) { //lgg crap case WAND: if(justCreated && createSelected) { numberExpected--; if(numberExpected<=0) state=IDLE; LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ObjectImage); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, (U32)newid); msg->addStringFast(_PREHASH_MediaURL, NULL); LLPrimitive obj; obj.setNumTEs(U8(10)); S32 shinnyLevel = 0; if(gSavedSettings.getString("EmeraldBuildPrefs_Shiny")== "None") shinnyLevel = 0; if(gSavedSettings.getString("EmeraldBuildPrefs_Shiny")== "Low") shinnyLevel = 1; if(gSavedSettings.getString("EmeraldBuildPrefs_Shiny")== "Medium") shinnyLevel = 2; if(gSavedSettings.getString("EmeraldBuildPrefs_Shiny")== "High") shinnyLevel = 3; for (int i = 0; i < 10; i++) { LLTextureEntry tex = LLTextureEntry(LLUUID(gSavedSettings.getString("EmeraldBuildPrefs_Texture"))); tex.setColor(gSavedSettings.getColor4("EmeraldBuildPrefs_Color")); tex.setAlpha(1.0 - ((gSavedSettings.getF32("EmeraldBuildPrefs_Alpha")) / 100.0)); tex.setGlow(gSavedSettings.getF32("EmeraldBuildPrefs_Glow")); if(gSavedSettings.getBOOL("EmeraldBuildPrefs_FullBright")) { tex.setFullbright(TEM_FULLBRIGHT_MASK); } tex.setShiny((U8) shinnyLevel & TEM_SHINY_MASK); obj.setTE(U8(i), tex); } obj.packTEMessage(gMessageSystem); msg->sendReliable(gAgent.getRegion()->getHost()); msg->newMessage("ObjectFlagUpdate"); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->addU32Fast(_PREHASH_ObjectLocalID, (U32)newid ); msg->addBOOLFast(_PREHASH_UsePhysics, gSavedSettings.getBOOL("EmeraldBuildPrefs_Physical")); msg->addBOOL("IsTemporary", gSavedSettings.getBOOL("EmeraldBuildPrefs_Temporary")); msg->addBOOL("IsPhantom", gSavedSettings.getBOOL("EmeraldBuildPrefs_Phantom") ); msg->addBOOL("CastsShadows", true ); msg->sendReliable(gAgent.getRegion()->getHost()); if(gSavedSettings.getBOOL("EmeraldBuildPrefs_EmbedItem")) { LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem((LLUUID)gSavedSettings.getString("EmeraldBuildPrefs_Item")); LLViewerObject* objectp = find((U32)newid); if(objectp) if(item) { if(item->getType()==LLAssetType::AT_LSL_TEXT) { LLToolDragAndDrop::dropScript(objectp, item, TRUE, LLToolDragAndDrop::SOURCE_AGENT, gAgent.getID()); }else { LLToolDragAndDrop::dropInventory(objectp,item,LLToolDragAndDrop::SOURCE_AGENT,gAgent.getID()); } } } msg->newMessageFast(_PREHASH_ObjectPermissions); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_HeaderData); msg->addBOOLFast(_PREHASH_Override, FALSE); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, (U32)newid); msg->addU8Fast(_PREHASH_Field, PERM_NEXT_OWNER); msg->addBOOLFast(_PREHASH_Set, PERM_ITEM_UNRESTRICTED); U32 flags = 0; if ( gSavedSettings.getBOOL("NextOwnerCopy") ) { flags |= PERM_COPY; } if ( gSavedSettings.getBOOL("NextOwnerModify") ) { flags |= PERM_MODIFY; } if ( gSavedSettings.getBOOL("NextOwnerTransfer") ) { flags |= PERM_TRANSFER; } msg->addU32Fast(_PREHASH_Mask, flags); msg->sendReliable(gAgent.getRegion()->getHost()); //llinfos << "LGG SENDING CUBE TEXTURE.." << llendl; } break; case BUILDING: if (justCreated && (int)localids.size() < linkset.size()) { localids.push_back(newid); localids.sort(); localids.unique(); linkset[localids.size() -1]["LocalID"] = newid; LLSD prim = linkset[localids.size() -1]; //MAKERIGHT if (!(prim).has("Updated")) { ++updated; send_shape(prim); send_image(prim); send_extras(prim); send_namedesc(prim); send_vectors(prim,updated); send_properties(prim, updated); send_inventory(prim); (prim)["Updated"] = true; } if ((int)localids.size() < linkset.size()) { plywood_above_head(); return; } else { if (updated >= linkset.size()) { updated=0; llinfos << "FINISHED BUILDING, LINKING.." << llendl; state = LINKING; link(); } } } break; case LINKING: link(); break; } }
void LLFloaterReporter::getObjectInfo(const LLUUID& object_id) { // TODO -- // 1 need to send to correct simulator if object is not // in same simulator as agent // 2 display info in widget window that gives feedback that // we have recorded the object info // 3 can pick avatar ==> might want to indicate when a picked // object is an avatar, attachment, or other category mObjectID = object_id; if (LLUUID::null != mObjectID) { // get object info for the user's benefit LLViewerObject* objectp = NULL; objectp = gObjectList.findObject( mObjectID ); if (objectp) { if ( objectp->isAttachment() ) { objectp = (LLViewerObject*)objectp->getRoot(); mObjectID = objectp->getID(); } // correct the region and position information LLViewerRegion *regionp = objectp->getRegion(); if (regionp) { childSetText("sim_field", regionp->getName()); LLVector3d global_pos; global_pos.setVec(objectp->getPositionRegion()); setPosBox(global_pos); } if (objectp->isAvatar()) { // we have the information we need std::string object_owner; LLNameValue* firstname = objectp->getNVPair("FirstName"); LLNameValue* lastname = objectp->getNVPair("LastName"); if (firstname && lastname) { object_owner.append(firstname->getString()); object_owner.append(1, ' '); object_owner.append(lastname->getString()); } else { object_owner.append("Unknown"); } setFromAvatar(mObjectID, object_owner); } else { // we have to query the simulator for information // about this object LLMessageSystem* msg = gMessageSystem; U32 request_flags = COMPLAINT_REPORT_REQUEST; msg->newMessageFast(_PREHASH_RequestObjectPropertiesFamily); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_RequestFlags, request_flags ); msg->addUUIDFast(_PREHASH_ObjectID, mObjectID); LLViewerRegion* regionp = objectp->getRegion(); msg->sendReliable( regionp->getHost() ); } } } }
void LLToolGrab::startGrab() { // Compute grab_offset in the OBJECT's root's coordinate frame // (sometimes root == object) LLViewerObject* objectp = mGrabPick.getObject(); if (!objectp) { return; } LLViewerObject *root = (LLViewerObject *)objectp->getRoot(); // drag from center LLVector3d grab_start_global = root->getPositionGlobal(); // Where the grab starts, relative to the center of the root object of the set. // JC - This code looks wonky, but I believe it does the right thing. // Otherwise, when you grab a linked object set, it "pops" on the start // of the drag. LLVector3d grab_offsetd = root->getPositionGlobal() - objectp->getPositionGlobal(); LLVector3 grab_offset; grab_offset.setVec(grab_offsetd); LLQuaternion rotation = root->getRotation(); rotation.conjQuat(); grab_offset = grab_offset * rotation; // This planar drag starts at the grab point mDragStartPointGlobal = grab_start_global; mDragStartFromCamera = grab_start_global - gAgent.getCameraPositionGlobal(); LLMessageSystem *msg = gMessageSystem; msg->newMessageFast(_PREHASH_ObjectGrab); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_LocalID, objectp->mLocalID); msg->addVector3Fast(_PREHASH_GrabOffset, grab_offset ); msg->nextBlock("SurfaceInfo"); msg->addVector3("UVCoord", LLVector3(mGrabPick.mUVCoords)); msg->addVector3("STCoord", LLVector3(mGrabPick.mSTCoords)); msg->addS32Fast(_PREHASH_FaceIndex, mGrabPick.mObjectFace); msg->addVector3("Position", mGrabPick.mIntersection); msg->addVector3("Normal", mGrabPick.mNormal); msg->addVector3("Binormal", mGrabPick.mBinormal); msg->sendMessage( objectp->getRegion()->getHost()); mGrabOffsetFromCenterInitial = grab_offset; mGrabHiddenOffsetFromCamera = mDragStartFromCamera; mGrabTimer.reset(); mLastUVCoords = mGrabPick.mUVCoords; mLastSTCoords = mGrabPick.mSTCoords; mLastFace = mGrabPick.mObjectFace; mLastIntersection = mGrabPick.mIntersection; mLastNormal = mGrabPick.mNormal; mLastBinormal = mGrabPick.mBinormal; mLastGrabPos = LLVector3(-1.f, -1.f, -1.f); }
void LLToolGrab::handleHoverNonPhysical(S32 x, S32 y, MASK mask) { LLViewerObject* objectp = mGrabPick.getObject(); if (!objectp || !hasMouseCapture() ) return; if (objectp->isDead()) { // Bail out of drag because object has been killed setMouseCapture(FALSE); return; } LLPickInfo pick = mGrabPick; pick.mMousePt = LLCoordGL(x, y); pick.getSurfaceInfo(); // compute elapsed time F32 dt = mGrabTimer.getElapsedTimeAndResetF32(); U32 dt_milliseconds = (U32) (1000.f * dt); // i'm not a big fan of the following code - it's been culled from the physical grab case. // ideally these two would be nicely integrated - but the code in that method is a serious // mess of spaghetti. so here we go: LLVector3 grab_pos_region(0,0,0); const BOOL SUPPORT_LLDETECTED_GRAB = TRUE; if (SUPPORT_LLDETECTED_GRAB) { //-------------------------------------------------- // Toggle vertical dragging //-------------------------------------------------- if (mVerticalDragging && !(mask == MASK_VERTICAL) && !gGrabBtnVertical) { mVerticalDragging = FALSE; } else if (!mVerticalDragging && (mask == MASK_VERTICAL) ) { mVerticalDragging = TRUE; } S32 dx = x - mLastMouseX; S32 dy = y - mLastMouseY; if (dx != 0 || dy != 0) { mAccumDeltaX += dx; mAccumDeltaY += dy; S32 dist_sq = mAccumDeltaX * mAccumDeltaX + mAccumDeltaY * mAccumDeltaY; if (dist_sq > SLOP_DIST_SQ) { mOutsideSlop = TRUE; } // mouse has moved mHasMoved = TRUE; //------------------------------------------------------ // Handle grabbing //------------------------------------------------------ LLVector3d x_part; x_part.setVec(LLViewerCamera::getInstance()->getLeftAxis()); x_part.mdV[VZ] = 0.0; x_part.normVec(); LLVector3d y_part; if( mVerticalDragging ) { y_part.setVec(LLViewerCamera::getInstance()->getUpAxis()); // y_part.setVec(0.f, 0.f, 1.f); } else { // drag toward camera y_part = x_part % LLVector3d::z_axis; y_part.mdV[VZ] = 0.0; y_part.normVec(); } mGrabHiddenOffsetFromCamera = mGrabHiddenOffsetFromCamera + (x_part * (-dx * GRAB_SENSITIVITY_X)) + (y_part * ( dy * GRAB_SENSITIVITY_Y)); } // need to return offset from mGrabStartPoint LLVector3d grab_point_global = gAgent.getCameraPositionGlobal() + mGrabHiddenOffsetFromCamera; grab_pos_region = objectp->getRegion()->getPosRegionFromGlobal( grab_point_global ); } // only send message if something has changed since last message BOOL changed_since_last_update = FALSE; // test if touch data needs to be updated if ((pick.mObjectFace != mLastFace) || (pick.mUVCoords != mLastUVCoords) || (pick.mSTCoords != mLastSTCoords) || (pick.mIntersection != mLastIntersection) || (pick.mNormal != mLastNormal) || (pick.mBinormal != mLastBinormal) || (grab_pos_region != mLastGrabPos)) { changed_since_last_update = TRUE; } if (changed_since_last_update) { LLMessageSystem *msg = gMessageSystem; msg->newMessageFast(_PREHASH_ObjectGrabUpdate); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ObjectData); msg->addUUIDFast(_PREHASH_ObjectID, objectp->getID() ); msg->addVector3Fast(_PREHASH_GrabOffsetInitial, mGrabOffsetFromCenterInitial ); msg->addVector3Fast(_PREHASH_GrabPosition, grab_pos_region ); msg->addU32Fast(_PREHASH_TimeSinceLast, dt_milliseconds ); msg->nextBlock("SurfaceInfo"); msg->addVector3("UVCoord", LLVector3(pick.mUVCoords)); msg->addVector3("STCoord", LLVector3(pick.mSTCoords)); msg->addS32Fast(_PREHASH_FaceIndex, pick.mObjectFace); msg->addVector3("Position", pick.mIntersection); msg->addVector3("Normal", pick.mNormal); msg->addVector3("Binormal", pick.mBinormal); msg->sendMessage( objectp->getRegion()->getHost() ); mLastUVCoords = pick.mUVCoords; mLastSTCoords = pick.mSTCoords; mLastFace = pick.mObjectFace; mLastIntersection = pick.mIntersection; mLastNormal= pick.mNormal; mLastBinormal= pick.mBinormal; mLastGrabPos = grab_pos_region; } // update point-at / look-at if (pick.mObjectFace != -1) // if the intersection was on the surface of the obejct { LLVector3 local_edit_point = pick.mIntersection; local_edit_point -= objectp->getPositionAgent(); local_edit_point = local_edit_point * ~objectp->getRenderRotation(); gAgent.setPointAt(POINTAT_TARGET_GRAB, objectp, local_edit_point ); gAgent.setLookAt(LOOKAT_TARGET_SELECT, objectp, local_edit_point ); } gViewerWindow->setCursor(UI_CURSOR_HAND); }
void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result) // StoreAssetData callback (fixed) { LLResourceData* data = (LLResourceData*)user_data; //LLAssetType::EType pref_loc = data->mPreferredLocation; BOOL is_balance_sufficient = TRUE; if(result >= 0) { LLAssetType::EType dest_loc = (data->mPreferredLocation == LLAssetType::AT_NONE) ? data->mAssetInfo.mType : data->mPreferredLocation; if (LLAssetType::AT_SOUND == data->mAssetInfo.mType || LLAssetType::AT_TEXTURE == data->mAssetInfo.mType || LLAssetType::AT_ANIMATION == data->mAssetInfo.mType) { // Charge the user for the upload. LLViewerRegion* region = gAgent.getRegion(); S32 upload_cost = gGlobalEconomy->getPriceUpload(); if(!(can_afford_transaction(upload_cost))) { LLFloaterBuyCurrency::buyCurrency( llformat("Uploading %s costs", data->mAssetInfo.getName().c_str()), upload_cost); is_balance_sufficient = FALSE; } else if(region) { // Charge user for upload gStatusBar->debitBalance(upload_cost); LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_MoneyTransferRequest); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_MoneyData); msg->addUUIDFast(_PREHASH_SourceID, gAgent.getID()); msg->addUUIDFast(_PREHASH_DestID, LLUUID::null); msg->addU8("Flags", 0); msg->addS32Fast(_PREHASH_Amount, upload_cost); msg->addU8Fast(_PREHASH_AggregatePermNextOwner, (U8)LLAggregatePermissions::AP_EMPTY); msg->addU8Fast(_PREHASH_AggregatePermInventory, (U8)LLAggregatePermissions::AP_EMPTY); msg->addS32Fast(_PREHASH_TransactionType, TRANS_UPLOAD_CHARGE); msg->addStringFast(_PREHASH_Description, NULL); msg->sendReliable(region->getHost()); } } if(is_balance_sufficient) { // Actually add the upload to inventory llinfos << "Adding " << uuid << " to inventory." << llendl; LLUUID folder_id(gInventory.findCategoryUUIDForType(dest_loc)); if(folder_id.notNull()) { U32 next_owner_perm = data->mNextOwnerPerm; if(PERM_NONE == next_owner_perm) { next_owner_perm = PERM_MOVE | PERM_TRANSFER; } create_inventory_item(gAgent.getID(), gAgent.getSessionID(), folder_id, data->mAssetInfo.mTransactionID, data->mAssetInfo.getName(), data->mAssetInfo.getDescription(), data->mAssetInfo.mType, data->mInventoryType, NOT_WEARABLE, next_owner_perm, LLPointer<LLInventoryCallback>(NULL)); } else { llwarns << "Can't find a folder to put it in" << llendl; } } } else // if(result >= 0) { LLStringBase<char>::format_map_t args; args["[FILE]"] = LLInventoryType::lookupHumanReadable(data->mInventoryType); args["[REASON]"] = LLString(LLAssetStorage::getErrorString(result)); gViewerWindow->alertXml("CannotUploadReason", args); } LLUploadDialog::modalUploadFinished(); delete data; // *NOTE: This is a pretty big hack. What this does is check the // file picker if there are any more pending uploads. If so, // upload that file. const char* next_file = LLFilePicker::instance().getNextFile(); if(is_balance_sufficient && next_file) { const char* name = LLFilePicker::instance().getDirname(); LLString asset_name = name; LLString::replaceNonstandardASCII( asset_name, '?' ); LLString::replaceChar(asset_name, '|', '?'); LLString::stripNonprintable(asset_name); LLString::trim(asset_name); char* asset_name_str = (char*)asset_name.c_str(); char* end_p = strrchr(asset_name_str, '.'); // strip extension if exists if( !end_p ) { end_p = asset_name_str + strlen( asset_name_str ); /* Flawfinder: ignore */ } S32 len = llmin( (S32) (DB_INV_ITEM_NAME_STR_LEN), (S32) (end_p - asset_name_str) ); asset_name = asset_name.substr( 0, len ); upload_new_resource(next_file, asset_name, asset_name, // file 0, LLAssetType::AT_NONE, LLInventoryType::IT_NONE); } }
void upload_done_callback( const LLUUID& uuid, void* user_data, S32 result, LLExtStat ext_status) // StoreAssetData callback (fixed) { LLResourceData* data = (LLResourceData*)user_data; S32 expected_upload_cost = data ? data->mExpectedUploadCost : 0; //LLAssetType::EType pref_loc = data->mPreferredLocation; BOOL is_balance_sufficient = TRUE; if(data) { if (result >= 0) { LLFolderType::EType dest_loc = (data->mPreferredLocation == LLFolderType::FT_NONE) ? LLFolderType::assetTypeToFolderType(data->mAssetInfo.mType) : data->mPreferredLocation; if (LLAssetType::AT_SOUND == data->mAssetInfo.mType || LLAssetType::AT_TEXTURE == data->mAssetInfo.mType || LLAssetType::AT_ANIMATION == data->mAssetInfo.mType) { // Charge the user for the upload. LLViewerRegion* region = gAgent.getRegion(); if(!(can_afford_transaction(expected_upload_cost))) { LLStringUtil::format_map_t args; args["NAME"] = data->mAssetInfo.getName(); args["AMOUNT"] = llformat("%d", expected_upload_cost); LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("UploadingCosts", args), expected_upload_cost ); is_balance_sufficient = FALSE; } else if(region) { // Charge user for upload gStatusBar->debitBalance(expected_upload_cost); LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_MoneyTransferRequest); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_MoneyData); msg->addUUIDFast(_PREHASH_SourceID, gAgent.getID()); msg->addUUIDFast(_PREHASH_DestID, LLUUID::null); msg->addU8("Flags", 0); // we tell the sim how much we were expecting to pay so it // can respond to any discrepancy msg->addS32Fast(_PREHASH_Amount, expected_upload_cost); msg->addU8Fast(_PREHASH_AggregatePermNextOwner, (U8)LLAggregatePermissions::AP_EMPTY); msg->addU8Fast(_PREHASH_AggregatePermInventory, (U8)LLAggregatePermissions::AP_EMPTY); msg->addS32Fast(_PREHASH_TransactionType, TRANS_UPLOAD_CHARGE); msg->addStringFast(_PREHASH_Description, NULL); msg->sendReliable(region->getHost()); } } if(is_balance_sufficient) { // Actually add the upload to inventory LL_INFOS() << "Adding " << uuid << " to inventory." << LL_ENDL; const LLUUID folder_id = gInventory.findCategoryUUIDForType(dest_loc); if(folder_id.notNull()) { U32 next_owner_perms = data->mNextOwnerPerm; if(PERM_NONE == next_owner_perms) { next_owner_perms = PERM_MOVE | PERM_TRANSFER; } create_inventory_item(gAgent.getID(), gAgent.getSessionID(), folder_id, data->mAssetInfo.mTransactionID, data->mAssetInfo.getName(), data->mAssetInfo.getDescription(), data->mAssetInfo.mType, data->mInventoryType, NOT_WEARABLE, next_owner_perms, LLPointer<LLInventoryCallback>(NULL)); } else { LL_WARNS() << "Can't find a folder to put it in" << LL_ENDL; } } } else // if(result >= 0) { LLSD args; args["FILE"] = LLInventoryType::lookupHumanReadable(data->mInventoryType); args["REASON"] = std::string(LLAssetStorage::getErrorString(result)); LLNotificationsUtil::add("CannotUploadReason", args); } delete data; data = NULL; } LLUploadDialog::modalUploadFinished(); // *NOTE: This is a pretty big hack. What this does is check the // file picker if there are any more pending uploads. If so, // upload that file. const std::string& next_file = LLFilePicker::instance().getNextFile(); if(is_balance_sufficient && !next_file.empty()) { std::string asset_name = gDirUtilp->getBaseFileName(next_file, true); LLStringUtil::replaceNonstandardASCII( asset_name, '?' ); LLStringUtil::replaceChar(asset_name, '|', '?'); LLStringUtil::stripNonprintable(asset_name); LLStringUtil::trim(asset_name); std::string display_name = LLStringUtil::null; LLAssetStorage::LLStoreAssetCallback callback = NULL; void *userdata = NULL; upload_new_resource( next_file, asset_name, asset_name, // file 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, LLFloaterPerms::getNextOwnerPerms("Uploads"), LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"), display_name, callback, expected_upload_cost, // assuming next in a group of uploads is of roughly the same type, i.e. same upload cost userdata); } }
void LLFloaterPay::give(S32 amount) { if(mCallback) { // if the amount is 0, that menas that we should use the // text field. if(amount == 0) { amount = atoi(childGetText("amount").c_str()); } sLastAmount = amount; // Try to pay an object. if (mTargetIsObject) { LLViewerObject* dest_object = gObjectList.findObject(mTargetUUID); if(dest_object) { LLViewerRegion* region = dest_object->getRegion(); if (region) { // Find the name of the root object LLSelectNode* node = mObjectSelection->getFirstRootNode(); std::string object_name; if (node) { object_name = node->mName; } S32 tx_type = TRANS_PAY_OBJECT; if(dest_object->isAvatar()) tx_type = TRANS_GIFT; mCallback(mTargetUUID, region, amount, FALSE, tx_type, object_name); mObjectSelection = NULL; // request the object owner in order to check if the owner needs to be unmuted LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_RequestObjectPropertiesFamily); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_RequestFlags, OBJECT_PAY_REQUEST ); msg->addUUIDFast(_PREHASH_ObjectID, mTargetUUID); msg->sendReliable( region->getHost() ); } } } else { // just transfer the L$ // <edit> if(childGetText("description") == "") // </edit> mCallback(mTargetUUID, gAgent.getRegion(), amount, mTargetIsGroup, TRANS_GIFT, LLStringUtil::null); // <edit> else mCallback(mTargetUUID, gAgent.getRegion(), amount, mTargetIsGroup, TRANS_OBJECT_SALE, childGetText("description")); // </edit> // check if the payee needs to be unmuted LLMuteList::getInstance()->autoRemove(mTargetUUID, LLMuteList::AR_MONEY); } } }
void LLAttachmentsMgr::onIdle() { S32 obj_count = mPendingAttachments.size(); if (obj_count == 0) { return; } // Limit number of packets to send const S32 MAX_PACKETS_TO_SEND = 10; const S32 OBJECTS_PER_PACKET = 4; const S32 MAX_OBJECTS_TO_SEND = MAX_PACKETS_TO_SEND * OBJECTS_PER_PACKET; if( obj_count > MAX_OBJECTS_TO_SEND ) { obj_count = MAX_OBJECTS_TO_SEND; } LLUUID compound_msg_id; compound_msg_id.generate(); LLMessageSystem* msg = gMessageSystem; S32 i = 0; for (attachments_vec_t::const_iterator iter = mPendingAttachments.begin(); iter != mPendingAttachments.end(); ++iter) { if( 0 == (i % OBJECTS_PER_PACKET) ) { // Start a new message chunk msg->newMessageFast(_PREHASH_RezMultipleAttachmentsFromInv); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_HeaderData); msg->addUUIDFast(_PREHASH_CompoundMsgID, compound_msg_id ); msg->addU8Fast(_PREHASH_TotalObjects, obj_count ); msg->addBOOLFast(_PREHASH_FirstDetachAll, false ); } const AttachmentsInfo &attachment = (*iter); LLViewerInventoryItem* item = gInventory.getItem(attachment.mItemID); if (!item) { llinfos << "Attempted to add non-existant item ID:" << attachment.mItemID << llendl; continue; } S32 attachment_pt = attachment.mAttachmentPt; if (attachment.mAdd) attachment_pt |= ATTACHMENT_ADD; msg->nextBlockFast(_PREHASH_ObjectData ); msg->addUUIDFast(_PREHASH_ItemID, item->getLinkedUUID()); msg->addUUIDFast(_PREHASH_OwnerID, item->getPermissions().getOwner()); msg->addU8Fast(_PREHASH_AttachmentPt, attachment_pt); pack_permissions_slam(msg, item->getFlags(), item->getPermissions()); msg->addStringFast(_PREHASH_Name, item->getName()); msg->addStringFast(_PREHASH_Description, item->getDescription()); if( (i+1 == obj_count) || ((OBJECTS_PER_PACKET-1) == (i % OBJECTS_PER_PACKET)) ) { // End of message chunk msg->sendReliable( gAgent.getRegion()->getHost() ); } i++; } mPendingAttachments.clear(); }
// [/RLVa:KB] void ImportTracker::send_extras(LLSD& prim) { LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ObjectExtraParams); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); LLPrimitive obj; if (prim.has("flexible")) { LLFlexibleObjectData flexi; flexi.fromLLSD(prim["flexible"]); U8 tmp[MAX_OBJECT_PARAMS_SIZE]; LLDataPackerBinaryBuffer dpb(tmp, MAX_OBJECT_PARAMS_SIZE); if (flexi.pack(dpb)) { U32 datasize = (U32)dpb.getCurrentSize(); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, prim["LocalID"].asInteger()); msg->addU16Fast(_PREHASH_ParamType, 0x10); msg->addBOOLFast(_PREHASH_ParamInUse, true); msg->addU32Fast(_PREHASH_ParamSize, datasize); msg->addBinaryDataFast(_PREHASH_ParamData, tmp, datasize); } } if (prim.has("light")) { LLLightParams light; light.fromLLSD(prim["light"]); U8 tmp[MAX_OBJECT_PARAMS_SIZE]; LLDataPackerBinaryBuffer dpb(tmp, MAX_OBJECT_PARAMS_SIZE); if (light.pack(dpb)) { U32 datasize = (U32)dpb.getCurrentSize(); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, prim["LocalID"].asInteger()); msg->addU16Fast(_PREHASH_ParamType, 0x20); msg->addBOOLFast(_PREHASH_ParamInUse, true); msg->addU32Fast(_PREHASH_ParamSize, datasize); msg->addBinaryDataFast(_PREHASH_ParamData, tmp, datasize); } } //Phox: Is this really necessary? I think not. if (prim.has("chat")) { send_chat_from_viewer(prim["chat"].asString(), CHAT_TYPE_SHOUT, 0); } if (prim.has("sculpt")) { LLSculptParams sculpt; sculpt.fromLLSD(prim["sculpt"]); U8 tmp[MAX_OBJECT_PARAMS_SIZE]; LLDataPackerBinaryBuffer dpb(tmp, MAX_OBJECT_PARAMS_SIZE); if (sculpt.pack(dpb)) { U32 datasize = (U32)dpb.getCurrentSize(); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, prim["LocalID"].asInteger()); msg->addU16Fast(_PREHASH_ParamType, 0x30); msg->addBOOLFast(_PREHASH_ParamInUse, true); msg->addU32Fast(_PREHASH_ParamSize, datasize); msg->addBinaryDataFast(_PREHASH_ParamData, tmp, datasize); } } msg->sendReliable(gAgent.getRegion()->getHost()); }
void ImportTracker::link() { if(linkset.size() == 256) { LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ObjectLink); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); LLSD::array_iterator prim = linkset.beginArray(); ++prim; for (; prim != linkset.endArray(); ++prim) { msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, (*prim)["LocalID"].asInteger()); } msg->sendReliable(gAgent.getRegion()->getHost()); LLMessageSystem* msg2 = gMessageSystem; msg2->newMessageFast(_PREHASH_ObjectLink); msg2->nextBlockFast(_PREHASH_AgentData); msg2->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); msg2->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); LLSD prim2 = linkset[0]; msg2->nextBlockFast(_PREHASH_ObjectData); msg2->addU32Fast(_PREHASH_ObjectLocalID, (prim2)["LocalID"].asInteger()); prim2 = linkset[1]; msg2->nextBlockFast(_PREHASH_ObjectData); msg2->addU32Fast(_PREHASH_ObjectLocalID, (prim2)["LocalID"].asInteger()); msg2->sendReliable(gAgent.getRegion()->getHost()); } else { LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ObjectLink); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); for (LLSD::array_iterator prim = linkset.beginArray(); prim != linkset.endArray(); ++prim) { msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, (*prim)["LocalID"].asInteger()); } msg->sendReliable(gAgent.getRegion()->getHost()); } llinfos << "FINISHED IMPORT" << llendl; if (linkset[0].has("Attachment")) { llinfos << "OBJECT IS ATTACHMENT, WAITING FOR POSITION PACKETS.." << llendl; state = POSITIONING; wear(linkset[0]); } else cleanUp(); }
// Reset all the values for the parcel in preparation for a sale void LLFloaterAuction::doResetParcel() { LLParcel* parcelp = mParcelp->getParcel(); LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); if (parcelp && region && !mParcelUpdateCapUrl.empty()) { LLSD body; std::string empty; // request new properties update from simulator U32 message_flags = 0x01; body["flags"] = ll_sd_from_U32(message_flags); // Set all the default parcel properties for auction body["local_id"] = parcelp->getLocalID(); U32 parcel_flags = PF_ALLOW_LANDMARK | PF_ALLOW_FLY | PF_CREATE_GROUP_OBJECTS | PF_ALLOW_ALL_OBJECT_ENTRY | PF_ALLOW_GROUP_OBJECT_ENTRY | PF_ALLOW_GROUP_SCRIPTS | PF_RESTRICT_PUSHOBJECT | PF_SOUND_LOCAL | PF_ALLOW_VOICE_CHAT | PF_USE_ESTATE_VOICE_CHAN; body["parcel_flags"] = ll_sd_from_U32(parcel_flags); // Build a parcel name like "Ahern (128,128) PG 4032m" std::ostringstream parcel_name; LLVector3 center_point( parcelp->getCenterpoint() ); center_point.snap(0); // Get rid of fractions parcel_name << region->getName() << " (" << (S32) center_point.mV[VX] << "," << (S32) center_point.mV[VY] << ") " << region->getSimAccessString() << " " << parcelp->getArea() << "m"; std::string new_name(parcel_name.str().c_str()); body["name"] = new_name; getChild<LLUICtrl>("parcel_text")->setValue(new_name); // Set name in dialog as well, since it won't get updated otherwise body["sale_price"] = (S32) 0; body["description"] = empty; body["music_url"] = empty; body["media_url"] = empty; body["media_desc"] = empty; body["media_type"] = LLMIMETypes::getDefaultMimeType(); body["media_width"] = (S32) 0; body["media_height"] = (S32) 0; body["auto_scale"] = (S32) 0; body["media_loop"] = (S32) 0; body["obscure_media"] = (S32) 0; // OBSOLETE - no longer used body["obscure_music"] = (S32) 0; // OBSOLETE - no longer used body["media_id"] = LLUUID::null; body["group_id"] = MAINTENANCE_GROUP_ID; // Use maintenance group body["pass_price"] = (S32) 10; // Defaults to $10 body["pass_hours"] = 0.0f; body["category"] = (U8) LLParcel::C_NONE; body["auth_buyer_id"] = LLUUID::null; body["snapshot_id"] = LLUUID::null; body["user_location"] = ll_sd_from_vector3( LLVector3::zero ); body["user_look_at"] = ll_sd_from_vector3( LLVector3::zero ); body["landing_type"] = (U8) LLParcel::L_DIRECT; LL_INFOS() << "Sending parcel update to reset for auction via capability to: " << mParcelUpdateCapUrl << LL_ENDL; LLHTTPClient::post(mParcelUpdateCapUrl, body, new LLHTTPClient::Responder()); // Send a message to clear the object return time LLMessageSystem *msg = gMessageSystem; msg->newMessageFast(_PREHASH_ParcelSetOtherCleanTime); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ParcelData); msg->addS32Fast(_PREHASH_LocalID, parcelp->getLocalID()); msg->addS32Fast(_PREHASH_OtherCleanTime, 5); // 5 minute object auto-return msg->sendReliable(region->getHost()); // Clear the access lists clearParcelAccessList(parcelp, region, AL_ACCESS); clearParcelAccessList(parcelp, region, AL_BAN); clearParcelAccessList(parcelp, region, AL_ALLOW_EXPERIENCE); clearParcelAccessList(parcelp, region, AL_BLOCK_EXPERIENCE); } }
void LLToolBrushLand::modifyLandInSelectionGlobal() { if (LLViewerParcelMgr::getInstance()->selectionEmpty()) { return; } if (LLToolMgr::getInstance()->getCurrentTool() == LLToolSelectLand::getInstance()) { // selecting land, don't do anything return; } LLVector3d min; LLVector3d max; LLViewerParcelMgr::getInstance()->getSelection(min, max); S32 radioAction = gSavedSettings.getS32("RadioLandBrushAction"); mLastAffectedRegions.clear(); determineAffectedRegions(mLastAffectedRegions, LLVector3d(min.mdV[VX], min.mdV[VY], 0)); determineAffectedRegions(mLastAffectedRegions, LLVector3d(min.mdV[VX], max.mdV[VY], 0)); determineAffectedRegions(mLastAffectedRegions, LLVector3d(max.mdV[VX], min.mdV[VY], 0)); determineAffectedRegions(mLastAffectedRegions, LLVector3d(max.mdV[VX], max.mdV[VY], 0)); LLRegionPosition mid_point_region((min + max) * 0.5); LLViewerRegion* center_region = mid_point_region.getRegion(); if (center_region) { LLVector3 pos_region = mid_point_region.getPositionRegion(); U32 grids = center_region->getLand().mGridsPerEdge; S32 i = llclamp( (S32)pos_region.mV[VX], 0, (S32)grids ); S32 j = llclamp( (S32)pos_region.mV[VY], 0, (S32)grids ); mStartingZ = center_region->getLand().getZ(i+j*grids); } else { mStartingZ = 0.f; } // Stop if our selection include a no-terraform region for(region_list_t::iterator iter = mLastAffectedRegions.begin(); iter != mLastAffectedRegions.end(); ++iter) { LLViewerRegion* regionp = *iter; if (!canTerraform(regionp)) { alertNoTerraform(regionp); return; } } for(region_list_t::iterator iter = mLastAffectedRegions.begin(); iter != mLastAffectedRegions.end(); ++iter) { LLViewerRegion* regionp = *iter; //BOOL is_changed = FALSE; LLVector3 min_region = regionp->getPosRegionFromGlobal(min); LLVector3 max_region = regionp->getPosRegionFromGlobal(max); min_region.clamp(0.f, regionp->getWidth()); max_region.clamp(0.f, regionp->getWidth()); F32 seconds = gSavedSettings.getF32("LandBrushForce"); LLSurface &land = regionp->getLand(); char action = E_LAND_LEVEL; switch (radioAction) { case 0: // // average toward mStartingZ action = E_LAND_LEVEL; seconds *= 0.25f; break; case 1: action = E_LAND_RAISE; seconds *= 0.25f; break; case 2: action = E_LAND_LOWER; seconds *= 0.25f; break; case 3: action = E_LAND_SMOOTH; seconds *= 5.0f; break; case 4: action = E_LAND_NOISE; seconds *= 0.5f; break; case 5: action = E_LAND_REVERT; seconds = 0.5f; break; default: //action = E_LAND_INVALID; //seconds = 0.0f; return; break; } // Don't send a message to the region if nothing changed. //if(!is_changed) continue; // Now to update the patch information so it will redraw correctly. LLSurfacePatch *patchp= land.resolvePatchRegion(min_region); if (patchp) { patchp->dirtyZ(); } // Also force the property lines to update, normals to recompute, etc. regionp->forceUpdate(); // tell the simulator what we've done LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ModifyLand); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ModifyBlock); msg->addU8Fast(_PREHASH_Action, (U8)action); msg->addU8Fast(_PREHASH_BrushSize, getBrushIndex()); msg->addF32Fast(_PREHASH_Seconds, seconds); msg->addF32Fast(_PREHASH_Height, mStartingZ); BOOL parcel_selected = LLViewerParcelMgr::getInstance()->getParcelSelection()->getWholeParcelSelected(); LLParcel* selected_parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(); if (parcel_selected && selected_parcel) { msg->nextBlockFast(_PREHASH_ParcelData); msg->addS32Fast(_PREHASH_LocalID, selected_parcel->getLocalID()); msg->addF32Fast(_PREHASH_West, min_region.mV[VX] ); msg->addF32Fast(_PREHASH_South, min_region.mV[VY] ); msg->addF32Fast(_PREHASH_East, max_region.mV[VX] ); msg->addF32Fast(_PREHASH_North, max_region.mV[VY] ); } else { msg->nextBlockFast(_PREHASH_ParcelData); msg->addS32Fast(_PREHASH_LocalID, -1); msg->addF32Fast(_PREHASH_West, min_region.mV[VX] ); msg->addF32Fast(_PREHASH_South, min_region.mV[VY] ); msg->addF32Fast(_PREHASH_East, max_region.mV[VX] ); msg->addF32Fast(_PREHASH_North, max_region.mV[VY] ); } msg->nextBlock("ModifyBlockExtended"); msg->addF32("BrushSize", mBrushSize); msg->sendMessage(regionp->getHost()); } }
void LLToolBrushLand::modifyLandAtPointGlobal(const LLVector3d &pos_global, MASK mask) { S32 radioAction = gSavedSettings.getS32("RadioLandBrushAction"); mLastAffectedRegions.clear(); determineAffectedRegions(mLastAffectedRegions, pos_global); for(region_list_t::iterator iter = mLastAffectedRegions.begin(); iter != mLastAffectedRegions.end(); ++iter) { LLViewerRegion* regionp = *iter; //BOOL is_changed = FALSE; LLVector3 pos_region = regionp->getPosRegionFromGlobal(pos_global); LLSurface &land = regionp->getLand(); char action = E_LAND_LEVEL; switch (radioAction) { case 0: // // average toward mStartingZ action = E_LAND_LEVEL; break; case 1: action = E_LAND_RAISE; break; case 2: action = E_LAND_LOWER; break; case 3: action = E_LAND_SMOOTH; break; case 4: action = E_LAND_NOISE; break; case 5: action = E_LAND_REVERT; break; default: action = E_LAND_INVALID; break; } // Don't send a message to the region if nothing changed. //if(!is_changed) continue; // Now to update the patch information so it will redraw correctly. LLSurfacePatch *patchp= land.resolvePatchRegion(pos_region); if (patchp) { patchp->dirtyZ(); } // Also force the property lines to update, normals to recompute, etc. regionp->forceUpdate(); // tell the simulator what we've done F32 seconds = (1.0f / gFPSClamped) * gSavedSettings.getF32("LandBrushForce"); F32 x_pos = (F32)pos_region.mV[VX]; F32 y_pos = (F32)pos_region.mV[VY]; LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ModifyLand); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ModifyBlock); msg->addU8Fast(_PREHASH_Action, (U8)action); msg->addU8Fast(_PREHASH_BrushSize, getBrushIndex()); msg->addF32Fast(_PREHASH_Seconds, seconds); msg->addF32Fast(_PREHASH_Height, mStartingZ); msg->nextBlockFast(_PREHASH_ParcelData); msg->addS32Fast(_PREHASH_LocalID, -1); msg->addF32Fast(_PREHASH_West, x_pos ); msg->addF32Fast(_PREHASH_South, y_pos ); msg->addF32Fast(_PREHASH_East, x_pos ); msg->addF32Fast(_PREHASH_North, y_pos ); msg->nextBlock("ModifyBlockExtended"); msg->addF32("BrushSize", mBrushSize); msg->sendMessage(regionp->getHost()); } }
void LLViewerRegion::requestCacheMisses() { S32 full_count = mCacheMissFull.count(); S32 crc_count = mCacheMissCRC.count(); if (full_count == 0 && crc_count == 0) return; LLMessageSystem* msg = gMessageSystem; BOOL start_new_message = TRUE; S32 blocks = 0; S32 i; // Send full cache miss updates. For these, we KNOW we don't // have a viewer object. for (i = 0; i < full_count; i++) { if (start_new_message) { msg->newMessageFast(_PREHASH_RequestMultipleObjects); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); start_new_message = FALSE; } msg->nextBlockFast(_PREHASH_ObjectData); msg->addU8Fast(_PREHASH_CacheMissType, CACHE_MISS_TYPE_FULL); msg->addU32Fast(_PREHASH_ID, mCacheMissFull[i]); blocks++; if (blocks >= 255) { sendReliableMessage(); start_new_message = TRUE; blocks = 0; } } // Send CRC miss updates. For these, we _might_ have a viewer object, // but probably not. for (i = 0; i < crc_count; i++) { if (start_new_message) { msg->newMessageFast(_PREHASH_RequestMultipleObjects); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); start_new_message = FALSE; } msg->nextBlockFast(_PREHASH_ObjectData); msg->addU8Fast(_PREHASH_CacheMissType, CACHE_MISS_TYPE_CRC); msg->addU32Fast(_PREHASH_ID, mCacheMissCRC[i]); blocks++; if (blocks >= 255) { sendReliableMessage(); start_new_message = TRUE; blocks = 0; } } // finish any pending message if (!start_new_message) { sendReliableMessage(); } mCacheMissFull.reset(); mCacheMissCRC.reset(); mCacheDirty = TRUE ; // llinfos << "KILLDEBUG Sent cache miss full " << full_count << " crc " << crc_count << llendl; #if LL_RECORD_VIEWER_STATS LLViewerStatsRecorder::instance()->beginObjectUpdateEvents(this); LLViewerStatsRecorder::instance()->recordRequestCacheMissesEvent(full_count + crc_count); LLViewerStatsRecorder::instance()->endObjectUpdateEvents(); #endif }
void LLFloaterReporter::getObjectInfo(const LLUUID& object_id) { // TODO -- // 1 need to send to correct simulator if object is not // in same simulator as agent // 2 display info in widget window that gives feedback that // we have recorded the object info // 3 can pick avatar ==> might want to indicate when a picked // object is an avatar, attachment, or other category mObjectID = object_id; if (LLUUID::null != mObjectID) { // get object info for the user's benefit LLViewerObject* objectp = NULL; objectp = gObjectList.findObject( mObjectID ); if (objectp) { if ( objectp->isAttachment() ) { objectp = (LLViewerObject*)objectp->getRoot(); } // correct the region and position information LLViewerRegion *regionp = objectp->getRegion(); if (regionp) { childSetText("sim_field", regionp->getName()); // [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ) { childSetText("sim_field", RlvStrings::getString(RLV_STRING_HIDDEN_REGION)); } // [/RLVa:KB] LLVector3d global_pos; global_pos.setVec(objectp->getPositionRegion()); setPosBox(global_pos); } if (objectp->isAvatar()) { // we have the information we need std::string object_owner; LLNameValue* firstname = objectp->getNVPair("FirstName"); LLNameValue* lastname = objectp->getNVPair("LastName"); if (firstname && lastname) { object_owner.append(firstname->getString()); object_owner.append(1, ' '); object_owner.append(lastname->getString()); } else { object_owner.append("Unknown"); } childSetText("object_name", object_owner); // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RVLa-1.0.0e if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) { childSetVisible("object_name", false); // Hide the object name if the picked object represents an avataz } // [/RLVa:KB] childSetText("owner_name", object_owner); childSetText("abuser_name_edit", object_owner); mAbuserID = object_id; } else { // we have to query the simulator for information // about this object LLMessageSystem* msg = gMessageSystem; U32 request_flags = (mReportType == BUG_REPORT) ? BUG_REPORT_REQUEST : COMPLAINT_REPORT_REQUEST; msg->newMessageFast(_PREHASH_RequestObjectPropertiesFamily); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_RequestFlags, request_flags ); msg->addUUIDFast(_PREHASH_ObjectID, mObjectID); LLViewerRegion* regionp = objectp->getRegion(); msg->sendReliable( regionp->getHost() ); } } } }
// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) | Modified: RLVa-0.2.2a void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel) // [/RLVa:KB] { // [RLVa:KB] - Checked: 2010-02-27 (RLVa-1.2.0b) | Modified: RLVa-1.2.0a // Only process chat messages (ie not CHAT_TYPE_START, CHAT_TYPE_STOP, etc) if ( (rlv_handler_t::isEnabled()) && ( (CHAT_TYPE_WHISPER == type) || (CHAT_TYPE_NORMAL == type) || (CHAT_TYPE_SHOUT == type) ) ) { if (0 == channel) { // (We already did this before, but LLChatHandler::handle() calls this directly) if ( ((CHAT_TYPE_SHOUT == type) || (CHAT_TYPE_NORMAL == type)) && (gRlvHandler.hasBehaviour(RLV_BHVR_CHATNORMAL)) ) type = CHAT_TYPE_WHISPER; else if ( (CHAT_TYPE_SHOUT == type) && (gRlvHandler.hasBehaviour(RLV_BHVR_CHATSHOUT)) ) type = CHAT_TYPE_NORMAL; else if ( (CHAT_TYPE_WHISPER == type) && (gRlvHandler.hasBehaviour(RLV_BHVR_CHATWHISPER)) ) type = CHAT_TYPE_NORMAL; // Redirect chat if needed if ( ( (gRlvHandler.hasBehaviour(RLV_BHVR_REDIRCHAT) || (gRlvHandler.hasBehaviour(RLV_BHVR_REDIREMOTE)) ) && (gRlvHandler.redirectChatOrEmote(utf8_out_text)) ) ) { return; } // Filter public chat if sendchat restricted if (gRlvHandler.hasBehaviour(RLV_BHVR_SENDCHAT)) gRlvHandler.filterChat(utf8_out_text, true); } else { // Don't allow chat on a non-public channel if sendchannel restricted (unless the channel is an exception) if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SENDCHANNEL)) && (!gRlvHandler.isException(RLV_BHVR_SENDCHANNEL, channel)) ) return; // Don't allow chat on debug channel if @sendchat, @redirchat or @rediremote restricted (shows as public chat on viewers) if (CHAT_CHANNEL_DEBUG == channel) { bool fIsEmote = RlvUtil::isEmote(utf8_out_text); if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SENDCHAT)) || ((!fIsEmote) && (gRlvHandler.hasBehaviour(RLV_BHVR_REDIRCHAT))) || ((fIsEmote) && (gRlvHandler.hasBehaviour(RLV_BHVR_REDIREMOTE))) ) { return; } } } } // [/RLVa:KB] LLMessageSystem* msg = gMessageSystem; // <edit> if(channel >= 0) { // </edit> msg->newMessageFast(_PREHASH_ChatFromViewer); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ChatData); msg->addStringFast(_PREHASH_Message, utf8_out_text); msg->addU8Fast(_PREHASH_Type, type); msg->addS32("Channel", channel); // <edit> } else { msg->newMessage("ScriptDialogReply"); msg->nextBlock("AgentData"); msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); msg->nextBlock("Data"); msg->addUUID("ObjectID", gAgent.getID()); msg->addS32("ChatChannel", channel); msg->addS32("ButtonIndex", 0); msg->addString("ButtonLabel", utf8_out_text); } // </edit> gAgent.sendReliableMessage(); LLViewerStats::getInstance()->incStat(LLViewerStats::ST_CHAT_COUNT); }
void LLPanelDirEvents::performQueryOrDelete(U32 event_id) { S32 relative_day = mDay; // Update the date field to show the date IN THE SERVER'S // TIME ZONE, as that is what will be displayed in each event // Get time UTC time_t utc_time = time_corrected(); // Correct for offset utc_time += relative_day * 24 * 60 * 60; // There's only one internal tm buffer. struct tm* internal_time; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. internal_time = utc_to_pacific_time(utc_time, gPacificDaylightTime); std::string buffer = llformat("%d/%d", 1 + internal_time->tm_mon, // Jan = 0 internal_time->tm_mday); // 2001 = 101 childSetValue("date_text", buffer); // Record the relative day so back and forward buttons // offset from this day. mDay = relative_day; mDoneQuery = TRUE; setupNewSearch(); U32 scope = DFQ_DATE_EVENTS; if ( !childGetValue("incmature").asBoolean() ) scope |= DFQ_PG_EVENTS_ONLY; std::ostringstream params; // Date mode for the search if ("current" == childGetValue("date_mode").asString()) { params << "u|"; } else { params << mDay << "|"; } // Categories are stored in the database in table indra.event_category // XML must match. U32 cat_id = childGetValue("category combo").asInteger(); params << cat_id << "|"; params << childGetValue("event_search_text").asString(); // send the message if (0 == event_id) { sendDirFindQuery(gMessageSystem, mSearchID, params.str(), scope, mSearchStart); } else { // This delete will also perform a query. LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_EventGodDelete); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_EventData); msg->addU32Fast(_PREHASH_EventID, event_id); msg->nextBlockFast(_PREHASH_QueryData); msg->addUUIDFast(_PREHASH_QueryID, mSearchID); msg->addStringFast(_PREHASH_QueryText, params.str()); msg->addU32Fast(_PREHASH_QueryFlags, scope); msg->addS32Fast(_PREHASH_QueryStart, mSearchStart); gAgent.sendReliableMessage(); } }
//virtual virtual void uploadComplete(const LLSD& content) { LLObjectBackup* self = LLObjectBackup::findInstance(); if (!self) { LL_WARNS() << "Import aborted, LLObjectBackup instance gone !" << LL_ENDL; // remove the "Uploading..." message LLUploadDialog::modalUploadFinished(); return; } LLAssetType::EType asset_type = LLAssetType::lookup(mPostData["asset_type"].asString()); LLInventoryType::EType inv_type = LLInventoryType::lookup(mPostData["inventory_type"].asString()); // Update L$ and ownership credit information // since it probably changed on the server if (asset_type == LLAssetType::AT_TEXTURE || asset_type == LLAssetType::AT_SOUND || asset_type == LLAssetType::AT_ANIMATION) { LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_MoneyBalanceRequest); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgentID); msg->addUUIDFast(_PREHASH_SessionID, gAgentSessionID); msg->nextBlockFast(_PREHASH_MoneyData); msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); gAgent.sendReliableMessage(); } // Actually add the upload to viewer inventory LL_INFOS() << "Adding " << content["new_inventory_item"].asUUID() << " " << content["new_asset"].asUUID() << " to inventory." << LL_ENDL; if (mPostData["folder_id"].asUUID().notNull()) { LLPermissions perm; U32 next_owner_perm; perm.init(gAgentID, gAgentID, LLUUID::null, LLUUID::null); if (mPostData["inventory_type"].asString() == "snapshot") { next_owner_perm = PERM_ALL; } else { next_owner_perm = PERM_MOVE | PERM_TRANSFER; } perm.initMasks(PERM_ALL, PERM_ALL, PERM_NONE, PERM_NONE, next_owner_perm); S32 creation_date_now = time_corrected(); LLPointer<LLViewerInventoryItem> item; item = new LLViewerInventoryItem(content["new_inventory_item"].asUUID(), mPostData["folder_id"].asUUID(), perm, content["new_asset"].asUUID(), asset_type, inv_type, mPostData["name"].asString(), mPostData["description"].asString(), LLSaleInfo::DEFAULT, LLInventoryItemFlags::II_FLAGS_NONE, creation_date_now); gInventory.updateItem(item); gInventory.notifyObservers(); } else { LL_WARNS() << "Can't find a folder to put it into" << LL_ENDL; } // remove the "Uploading..." message LLUploadDialog::modalUploadFinished(); self->updateMap(content["new_asset"].asUUID()); self->uploadNextAsset(); }
void LLPanelPlaceProfile::displaySelectedParcelInfo(LLParcel* parcel, LLViewerRegion* region, const LLVector3d& pos_global, bool is_current_parcel) { if (!region || !parcel) return; // send EstateCovenantInfo message LLMessageSystem *msg = gMessageSystem; msg->newMessage("EstateCovenantRequest"); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID()); msg->sendReliable(region->getHost()); LLParcelData parcel_data; // HACK: Converting sim access flags to the format // returned by remote parcel response. U8 sim_access = region->getSimAccess(); switch(sim_access) { case SIM_ACCESS_MATURE: parcel_data.flags = 0x1; mParcelRatingIcon->setValue(icon_m); mRegionRatingIcon->setValue(icon_m); break; case SIM_ACCESS_ADULT: parcel_data.flags = 0x2; mParcelRatingIcon->setValue(icon_r); mRegionRatingIcon->setValue(icon_r); break; default: parcel_data.flags = 0; mParcelRatingIcon->setValue(icon_pg); mRegionRatingIcon->setValue(icon_pg); } std::string rating = LLViewerRegion::accessToString(sim_access); mParcelRatingText->setText(rating); mRegionRatingText->setText(rating); parcel_data.desc = parcel->getDesc(); parcel_data.name = parcel->getName(); parcel_data.sim_name = region->getName(); parcel_data.snapshot_id = parcel->getSnapshotID(); mPosRegion.setVec((F32)fmod(pos_global.mdV[VX], (F64)REGION_WIDTH_METERS), (F32)fmod(pos_global.mdV[VY], (F64)REGION_WIDTH_METERS), (F32)pos_global.mdV[VZ]); parcel_data.global_x = pos_global.mdV[VX]; parcel_data.global_y = pos_global.mdV[VY]; parcel_data.global_z = pos_global.mdV[VZ]; std::string on = getString("on"); std::string off = getString("off"); LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance(); // Processing parcel characteristics if (vpm->allowAgentVoice(region, parcel)) { mVoiceIcon->setValue(icon_voice); mVoiceText->setText(on); } else { mVoiceIcon->setValue(icon_voice_no); mVoiceText->setText(off); } if (vpm->allowAgentFly(region, parcel)) { mFlyIcon->setValue(icon_fly); mFlyText->setText(on); } else { mFlyIcon->setValue(icon_fly_no); mFlyText->setText(off); } if (vpm->allowAgentPush(region, parcel)) { mPushIcon->setValue(icon_push); mPushText->setText(on); } else { mPushIcon->setValue(icon_push_no); mPushText->setText(off); } if (vpm->allowAgentBuild(parcel)) { mBuildIcon->setValue(icon_build); mBuildText->setText(on); } else { mBuildIcon->setValue(icon_build_no); mBuildText->setText(off); } if (vpm->allowAgentScripts(region, parcel)) { mScriptsIcon->setValue(icon_scripts); mScriptsText->setText(on); } else { mScriptsIcon->setValue(icon_scripts_no); mScriptsText->setText(off); } if (vpm->allowAgentDamage(region, parcel)) { mDamageIcon->setValue(icon_damage); mDamageText->setText(on); } else { mDamageIcon->setValue(icon_damage_no); mDamageText->setText(off); } if (parcel->getSeeAVs()) { mSeeAVsIcon->setValue(icon_see_avs_on); mSeeAVsText->setText(on); } else { mSeeAVsIcon->setValue(icon_see_avs_off); mSeeAVsText->setText(off); } mRegionNameText->setText(region->getName()); mRegionTypeText->setText(region->getLocalizedSimProductName()); // Determine parcel owner if (parcel->isPublic()) { mParcelOwner->setText(getString("public")); mRegionOwnerText->setText(getString("public")); } else { if (parcel->getIsGroupOwned()) { mRegionOwnerText->setText(getString("group_owned_text")); if(!parcel->getGroupID().isNull()) { // FIXME: Using parcel group as region group. gCacheName->getGroup(parcel->getGroupID(), boost::bind(&LLPanelPlaceInfo::onNameCache, mRegionGroupText, _2)); gCacheName->getGroup(parcel->getGroupID(), boost::bind(&LLPanelPlaceInfo::onNameCache, mParcelOwner, _2)); } else { std::string owner = getString("none_text"); mRegionGroupText->setText(owner); mParcelOwner->setText(owner); } } else { // Figure out the owner's name std::string parcel_owner = LLSLURL("agent", parcel->getOwnerID(), "inspect").getSLURLString(); mParcelOwner->setText(parcel_owner); LLAvatarNameCache::get(region->getOwner(), boost::bind(&LLPanelPlaceInfo::onAvatarNameCache, _1, _2, mRegionOwnerText)); } if(LLParcel::OS_LEASE_PENDING == parcel->getOwnershipStatus()) { mRegionOwnerText->setText(mRegionOwnerText->getText() + getString("sale_pending_text")); } } mEstateRatingText->setText(region->getSimAccessString()); S32 area; S32 claim_price; S32 rent_price; F32 dwell; BOOL for_sale; vpm->getDisplayInfo(&area, &claim_price, &rent_price, &for_sale, &dwell); if (for_sale) { const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID(); if(auth_buyer_id.notNull()) { LLAvatarNameCache::get(auth_buyer_id, boost::bind(&LLPanelPlaceInfo::onAvatarNameCache, _1, _2, mSaleToText)); // Show sales info to a specific person or a group he belongs to. if (auth_buyer_id != gAgent.getID() && !gAgent.isInGroup(auth_buyer_id)) { for_sale = FALSE; } } else { mSaleToText->setText(getString("anyone")); } mForSalePanel->setVisible(for_sale); const U8* sign = (U8*)getString("price_text").c_str(); const U8* sqm = (U8*)getString("area_text").c_str(); mSalesPriceText->setText(llformat("%s%d ", sign, parcel->getSalePrice())); mAreaText->setText(llformat("%d %s", area, sqm)); mTrafficText->setText(llformat("%.0f", dwell)); // Can't have more than region max tasks, regardless of parcel // object bonus factor. S32 primitives = llmin(llround(parcel->getMaxPrimCapacity() * parcel->getParcelPrimBonus()), (S32)region->getMaxTasks()); const U8* available = (U8*)getString("available").c_str(); const U8* allocated = (U8*)getString("allocated").c_str(); mPrimitivesText->setText(llformat("%d %s, %d %s", primitives, available, parcel->getPrimCount(), allocated)); if (parcel->getAllowOtherScripts()) { mParcelScriptsText->setText(getString("all_residents_text")); } else if (parcel->getAllowGroupScripts()) { mParcelScriptsText->setText(getString("group_text")); } else { mParcelScriptsText->setText(off); } mTerraformLimitsText->setText(parcel->getAllowTerraform() ? on : off); if (region->getRegionFlags() & REGION_FLAGS_ALLOW_PARCEL_CHANGES) { mSubdivideText->setText(getString("can_change")); } else { mSubdivideText->setText(getString("can_not_change")); } if (region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL) { mResaleText->setText(getString("can_not_resell")); } else { mResaleText->setText(getString("can_resell")); } } mSelectedParcelID = parcel->getLocalID(); mLastSelectedRegionID = region->getRegionID(); LLPanelPlaceInfo::processParcelInfo(parcel_data); mYouAreHerePanel->setVisible(is_current_parcel); getChild<LLAccordionCtrlTab>("sales_tab")->setVisible(for_sale); }
void ScriptCounter::serializeSelection(bool delScript) { LLDynamicArray<LLViewerObject*> catfayse; foo=LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); sstr.str(""); doDelete=false; scriptcount=0; objIDS.clear(); delUUIDS.clear(); objectCount=0; countingDone=false; reqObjectID.setNull(); if(foo) { if(foo->isAvatar()) { LLVOAvatar* av=find_avatar_from_object(foo); if(av) { for (LLVOAvatar::attachment_map_t::iterator iter = av->mAttachmentPoints.begin(); iter != av->mAttachmentPoints.end(); ++iter) { LLViewerJointAttachment* attachment = iter->second; if (!attachment->getValid()) continue ; LLViewerObject* object = attachment->getObject(); if(object) { catfayse.put(object); objectCount++; } } } } else { for (LLObjectSelection::valid_root_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_root_begin(); iter != LLSelectMgr::getInstance()->getSelection()->valid_root_end(); iter++) { LLSelectNode* selectNode = *iter; LLViewerObject* object = selectNode->getObject(); if(object) { catfayse.put(object); objectCount++; } } doDelete=delScript; } F32 throttle = gSavedSettings.getF32("OutBandwidth"); if((throttle == 0.f) || (throttle > 128000.f)) { gMessageSystem->mPacketRing.setOutBandwidth(128000); gMessageSystem->mPacketRing.setUseOutThrottle(TRUE); } cmdline_printchat("Counting scripts. Please wait."); if((objectCount == 1) && !(foo->isAvatar())) { LLViewerObject *reqObject=((LLViewerObject*)foo->getRoot()); if(reqObject->isAvatar()) { for (LLObjectSelection::iterator iter = LLSelectMgr::getInstance()->getSelection()->begin(); iter != LLSelectMgr::getInstance()->getSelection()->end(); iter++ ) { LLSelectNode *nodep = *iter; LLViewerObject* objectp = nodep->getObject(); if (objectp->isRootEdit()) { reqObjectID=objectp->getID(); LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ObjectSelect); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, objectp->getLocalID()); msg->sendReliable(gAgent.getRegionHost()); break; } } } else { reqObjectID=reqObject->getID(); LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_RequestObjectPropertiesFamily); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_RequestFlags, 0 ); msg->addUUIDFast(_PREHASH_ObjectID, reqObjectID); gAgent.sendReliableMessage(); } } serialize(catfayse); } }
void LLFloaterBuyLandUI::updateCovenantInfo() { LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); if(!region) return; LLTextBox* region_name = getChild<LLTextBox>("region_name_text"); if (region_name) { region_name->setText(region->getName()); } LLTextBox* region_type = getChild<LLTextBox>("region_type_text"); if (region_type) { region_type->setText(region->getSimProductName()); } LLTextBox* resellable_clause = getChild<LLTextBox>("resellable_clause"); if (resellable_clause) { if (region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL) { resellable_clause->setText(getString("can_not_resell")); } else { resellable_clause->setText(getString("can_resell")); } } LLTextBox* changeable_clause = getChild<LLTextBox>("changeable_clause"); if (changeable_clause) { if (region->getRegionFlags() & REGION_FLAGS_ALLOW_PARCEL_CHANGES) { changeable_clause->setText(getString("can_change")); } else { changeable_clause->setText(getString("can_not_change")); } } LLCheckBoxCtrl* check = getChild<LLCheckBoxCtrl>("agree_covenant"); if(check) { check->set(false); check->setEnabled(true); check->setCallbackUserData(this); check->setCommitCallback(onChangeAgreeCovenant); } LLTextBox* box = getChild<LLTextBox>("covenant_text"); if(box) { box->setVisible(FALSE); } // send EstateCovenantInfo message LLMessageSystem *msg = gMessageSystem; msg->newMessage("EstateCovenantRequest"); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID()); msg->sendReliable(region->getHost()); }
// <edit> void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExtStat ext_status) // StoreAssetData callback (fixed) { LLResourceData* data = (LLResourceData*)user_data; S32 expected_upload_cost = data ? data->mExpectedUploadCost : 0; //LLAssetType::EType pref_loc = data->mPreferredLocation; BOOL is_balance_sufficient = TRUE; if(!data) { LLUploadDialog::modalUploadFinished(); return; } if(result >= 0) { LLFolderType::EType dest_loc = (data->mPreferredLocation == LLFolderType::FT_NONE) ? LLFolderType::assetTypeToFolderType(data->mAssetInfo.mType) : data->mPreferredLocation; if (LLAssetType::AT_SOUND == data->mAssetInfo.mType || LLAssetType::AT_TEXTURE == data->mAssetInfo.mType || LLAssetType::AT_ANIMATION == data->mAssetInfo.mType) { // Charge the user for the upload. LLViewerRegion* region = gAgent.getRegion(); if(!(can_afford_transaction(expected_upload_cost))) { LLStringUtil::format_map_t args; args["[NAME]"] = data->mAssetInfo.getName(); args["[CURRENCY]"] = gHippoGridManager->getConnectedGrid()->getCurrencySymbol(); args["[AMOUNT]"] = llformat("%d", expected_upload_cost); LLFloaterBuyCurrency::buyCurrency( LLTrans::getString("UploadingCosts", args), expected_upload_cost ); is_balance_sufficient = FALSE; } else if(region) { // Charge user for upload gStatusBar->debitBalance(expected_upload_cost); LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_MoneyTransferRequest); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_MoneyData); msg->addUUIDFast(_PREHASH_SourceID, gAgent.getID()); msg->addUUIDFast(_PREHASH_DestID, LLUUID::null); msg->addU8("Flags", 0); // we tell the sim how much we were expecting to pay so it // can respond to any discrepancy msg->addS32Fast(_PREHASH_Amount, expected_upload_cost); msg->addU8Fast(_PREHASH_AggregatePermNextOwner, (U8)LLAggregatePermissions::AP_EMPTY); msg->addU8Fast(_PREHASH_AggregatePermInventory, (U8)LLAggregatePermissions::AP_EMPTY); msg->addS32Fast(_PREHASH_TransactionType, TRANS_UPLOAD_CHARGE); msg->addStringFast(_PREHASH_Description, NULL); msg->sendReliable(region->getHost()); } } if(is_balance_sufficient) { // Actually add the upload to inventory llinfos << "Adding " << uuid << " to inventory." << llendl; const LLUUID folder_id = gInventory.findCategoryUUIDForType(dest_loc); if(folder_id.notNull()) { U32 next_owner_perms = data->mNextOwnerPerm; if(PERM_NONE == next_owner_perms) { next_owner_perms = PERM_MOVE | PERM_TRANSFER; } create_inventory_item(gAgent.getID(), gAgent.getSessionID(), folder_id, data->mAssetInfo.mTransactionID, data->mAssetInfo.getName(), data->mAssetInfo.getDescription(), data->mAssetInfo.mType, data->mInventoryType, NOT_WEARABLE, next_owner_perms, LLPointer<LLInventoryCallback>(NULL)); } else { llwarns << "Can't find a folder to put it in" << llendl; } } } else // if(result >= 0) { LLSD args; args["FILE"] = LLInventoryType::lookupHumanReadable(data->mInventoryType); args["REASON"] = std::string(LLAssetStorage::getErrorString(result)); LLNotificationsUtil::add("CannotUploadReason", args); } LLUploadDialog::modalUploadFinished(); delete data; data = NULL; }
void LLFloaterBuyLandUI::updateCovenantInfo() { LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); if(!region) return; U8 sim_access = region->getSimAccess(); std::string rating = LLViewerRegion::accessToString(sim_access); LLTextBox* region_name = getChild<LLTextBox>("region_name_text"); if (region_name) { std::string region_name_txt = region->getName() + " ("+rating +")"; region_name->setText(region_name_txt); LLIconCtrl* rating_icon = getChild<LLIconCtrl>("rating_icon"); LLRect rect = rating_icon->getRect(); S32 icon_left_pad = region_name->getRect().mLeft + region_name->getTextBoundingRect().getWidth() + ICON_PAD; rating_icon->setRect(rect.setOriginAndSize(icon_left_pad, rect.mBottom, rect.getWidth(), rect.getHeight())); switch(sim_access) { case SIM_ACCESS_PG: rating_icon->setValue(getString("icon_PG")); break; case SIM_ACCESS_ADULT: rating_icon->setValue(getString("icon_R")); break; default: rating_icon->setValue(getString("icon_M")); } } LLTextBox* region_type = getChild<LLTextBox>("region_type_text"); if (region_type) { region_type->setText(region->getSimProductName()); } LLTextBox* resellable_clause = getChild<LLTextBox>("resellable_clause"); if (resellable_clause) { if (region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL) { resellable_clause->setText(getString("can_not_resell")); } else { resellable_clause->setText(getString("can_resell")); } } LLTextBox* changeable_clause = getChild<LLTextBox>("changeable_clause"); if (changeable_clause) { if (region->getRegionFlags() & REGION_FLAGS_ALLOW_PARCEL_CHANGES) { changeable_clause->setText(getString("can_change")); } else { changeable_clause->setText(getString("can_not_change")); } } LLCheckBoxCtrl* check = getChild<LLCheckBoxCtrl>("agree_covenant"); if(check) { check->set(false); check->setEnabled(true); check->setCommitCallback(onChangeAgreeCovenant, this); } LLTextBox* box = getChild<LLTextBox>("covenant_text"); if(box) { box->setVisible(FALSE); } // send EstateCovenantInfo message LLMessageSystem *msg = gMessageSystem; msg->newMessage("EstateCovenantRequest"); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID()); msg->sendReliable(region->getHost()); }
// Dragging. void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask) { LLViewerObject* objectp = mGrabPick.getObject(); if (!objectp || !hasMouseCapture() ) return; if (objectp->isDead()) { // Bail out of drag because object has been killed setMouseCapture(FALSE); return; } //-------------------------------------------------- // Toggle spinning //-------------------------------------------------- if (mSpinGrabbing && !(mask == MASK_SPIN) && !gGrabBtnSpin) { // user released ALT key, stop spinning stopSpin(); } else if (!mSpinGrabbing && (mask == MASK_SPIN) ) { // user pressed ALT key, start spinning startSpin(); } //-------------------------------------------------- // Toggle vertical dragging //-------------------------------------------------- if (mVerticalDragging && !(mask == MASK_VERTICAL) && !gGrabBtnVertical) { // ...switch to horizontal dragging mVerticalDragging = FALSE; mDragStartPointGlobal = gViewerWindow->clickPointInWorldGlobal(x, y, objectp); mDragStartFromCamera = mDragStartPointGlobal - gAgent.getCameraPositionGlobal(); } else if (!mVerticalDragging && (mask == MASK_VERTICAL) ) { // ...switch to vertical dragging mVerticalDragging = TRUE; mDragStartPointGlobal = gViewerWindow->clickPointInWorldGlobal(x, y, objectp); mDragStartFromCamera = mDragStartPointGlobal - gAgent.getCameraPositionGlobal(); } const F32 RADIANS_PER_PIXEL_X = 0.01f; const F32 RADIANS_PER_PIXEL_Y = 0.01f; S32 dx = x - (gViewerWindow->getWindowWidth() / 2); S32 dy = y - (gViewerWindow->getWindowHeight() / 2); if (dx != 0 || dy != 0) { mAccumDeltaX += dx; mAccumDeltaY += dy; S32 dist_sq = mAccumDeltaX * mAccumDeltaX + mAccumDeltaY * mAccumDeltaY; if (dist_sq > SLOP_DIST_SQ) { mOutsideSlop = TRUE; } // mouse has moved outside center mHasMoved = TRUE; if (mSpinGrabbing) { //------------------------------------------------------ // Handle spinning //------------------------------------------------------ // x motion maps to rotation around vertical axis LLVector3 up(0.f, 0.f, 1.f); LLQuaternion rotation_around_vertical( dx*RADIANS_PER_PIXEL_X, up ); // y motion maps to rotation around left axis const LLVector3 &agent_left = LLViewerCamera::getInstance()->getLeftAxis(); LLQuaternion rotation_around_left( dy*RADIANS_PER_PIXEL_Y, agent_left ); // compose with current rotation mSpinRotation = mSpinRotation * rotation_around_vertical; mSpinRotation = mSpinRotation * rotation_around_left; // TODO: Throttle these LLMessageSystem *msg = gMessageSystem; msg->newMessageFast(_PREHASH_ObjectSpinUpdate); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ObjectData); msg->addUUIDFast(_PREHASH_ObjectID, objectp->getID() ); msg->addQuatFast(_PREHASH_Rotation, mSpinRotation ); msg->sendMessage( objectp->getRegion()->getHost() ); } else { //------------------------------------------------------ // Handle grabbing //------------------------------------------------------ LLVector3d x_part; x_part.setVec(LLViewerCamera::getInstance()->getLeftAxis()); x_part.mdV[VZ] = 0.0; x_part.normVec(); LLVector3d y_part; if( mVerticalDragging ) { y_part.setVec(LLViewerCamera::getInstance()->getUpAxis()); // y_part.setVec(0.f, 0.f, 1.f); } else { // drag toward camera y_part = x_part % LLVector3d::z_axis; y_part.mdV[VZ] = 0.0; y_part.normVec(); } mGrabHiddenOffsetFromCamera = mGrabHiddenOffsetFromCamera + (x_part * (-dx * GRAB_SENSITIVITY_X)) + (y_part * ( dy * GRAB_SENSITIVITY_Y)); // Send the message to the viewer. F32 dt = mGrabTimer.getElapsedTimeAndResetF32(); U32 dt_milliseconds = (U32) (1000.f * dt); // need to return offset from mGrabStartPoint LLVector3d grab_point_global; grab_point_global = gAgent.getCameraPositionGlobal() + mGrabHiddenOffsetFromCamera; /* Snap to grid disabled for grab tool - very confusing // Handle snapping to grid, but only when the tool is formally selected. BOOL snap_on = gSavedSettings.getBOOL("SnapEnabled"); if (snap_on && !gGrabTransientTool) { F64 snap_size = gSavedSettings.getF32("GridResolution"); U8 snap_dimensions = (mVerticalDragging ? 3 : 2); for (U8 i = 0; i < snap_dimensions; i++) { grab_point_global.mdV[i] += snap_size / 2; grab_point_global.mdV[i] -= fmod(grab_point_global.mdV[i], snap_size); } } */ // Don't let object centers go underground. F32 land_height = LLWorld::getInstance()->resolveLandHeightGlobal(grab_point_global); if (grab_point_global.mdV[VZ] < land_height) { grab_point_global.mdV[VZ] = land_height; } // For safety, cap heights where objects can be dragged if (grab_point_global.mdV[VZ] > MAX_OBJECT_Z) { grab_point_global.mdV[VZ] = MAX_OBJECT_Z; } grab_point_global = LLWorld::getInstance()->clipToVisibleRegions(mDragStartPointGlobal, grab_point_global); // propagate constrained grab point back to grab offset mGrabHiddenOffsetFromCamera = grab_point_global - gAgent.getCameraPositionGlobal(); // Handle auto-rotation at screen edge. LLVector3 grab_pos_agent = gAgent.getPosAgentFromGlobal( grab_point_global ); LLCoordGL grab_center_gl( gViewerWindow->getWindowWidth() / 2, gViewerWindow->getWindowHeight() / 2); LLViewerCamera::getInstance()->projectPosAgentToScreen(grab_pos_agent, grab_center_gl); const S32 ROTATE_H_MARGIN = gViewerWindow->getWindowWidth() / 20; const F32 ROTATE_ANGLE_PER_SECOND = 30.f * DEG_TO_RAD; const F32 rotate_angle = ROTATE_ANGLE_PER_SECOND / gFPSClamped; // ...build mode moves camera about focus point if (grab_center_gl.mX < ROTATE_H_MARGIN) { if (gAgent.getFocusOnAvatar()) { gAgent.yaw(rotate_angle); } else { gAgent.cameraOrbitAround(rotate_angle); } } else if (grab_center_gl.mX > gViewerWindow->getWindowWidth() - ROTATE_H_MARGIN) { if (gAgent.getFocusOnAvatar()) { gAgent.yaw(-rotate_angle); } else { gAgent.cameraOrbitAround(-rotate_angle); } } // Don't move above top of screen or below bottom if ((grab_center_gl.mY < gViewerWindow->getWindowHeight() - 6) && (grab_center_gl.mY > 24)) { // Transmit update to simulator LLVector3 grab_pos_region = objectp->getRegion()->getPosRegionFromGlobal( grab_point_global ); LLMessageSystem *msg = gMessageSystem; msg->newMessageFast(_PREHASH_ObjectGrabUpdate); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ObjectData); msg->addUUIDFast(_PREHASH_ObjectID, objectp->getID() ); msg->addVector3Fast(_PREHASH_GrabOffsetInitial, mGrabOffsetFromCenterInitial ); msg->addVector3Fast(_PREHASH_GrabPosition, grab_pos_region ); msg->addU32Fast(_PREHASH_TimeSinceLast, dt_milliseconds ); msg->nextBlock("SurfaceInfo"); msg->addVector3("UVCoord", LLVector3(mGrabPick.mUVCoords)); msg->addVector3("STCoord", LLVector3(mGrabPick.mSTCoords)); msg->addS32Fast(_PREHASH_FaceIndex, mGrabPick.mObjectFace); msg->addVector3("Position", mGrabPick.mIntersection); msg->addVector3("Normal", mGrabPick.mNormal); msg->addVector3("Binormal", mGrabPick.mBinormal); msg->sendMessage( objectp->getRegion()->getHost() ); } } gViewerWindow->moveCursorToCenter(); LLSelectMgr::getInstance()->updateSelectionCenter(); } // once we've initiated a drag, lock the camera down if (mHasMoved) { if (!gAgent.cameraMouselook() && !objectp->isHUDAttachment() && objectp->getRoot() == gAgent.getAvatarObject()->getRoot()) { // force focus to point in space where we were looking previously gAgent.setFocusGlobal(gAgent.calcFocusPositionTargetGlobal(), LLUUID::null); gAgent.setFocusOnAvatar(FALSE, ANIMATE); } else { gAgent.clearFocusObject(); } } // HACK to avoid assert: error checking system makes sure that the cursor is set during every handleHover. This is actually a no-op since the cursor is hidden. gViewerWindow->setCursor(UI_CURSOR_ARROW); lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolGrab (active) [cursor hidden]" << llendl; }
void LLPanelGroupVoting::impl::sendStartGroupProposal() { if ( !gAgent.hasPowerInGroup(mGroupID, GP_PROPOSAL_START) ) return; F32 majority = 0.f; S32 duration_seconds = (S32)mDuration->get()*24*60*60; // duration days * 24hours/day * 60min/hr * 60sec/min switch (mMajority->getSelectedIndex()) { case 0: // Simple Majority majority = 0.f; break; case 1: // 2/3 Majority majority = 2.f/3.f; break; case 2: // Unanimous majority = 1.0f; break; } S32 quorum = llfloor(mQuorum->get()); //*************************************Conversion to capability LLSD body; std::string url = gAgent.getRegion()->getCapability("StartGroupProposal"); if (!url.empty()) { body["agent-id"] = gAgent.getID(); body["session-id"] = gAgent.getSessionID(); body["group-id"] = mGroupID; body["majority"] = majority; body["quorum"] = quorum; body["duration"] = duration_seconds; body["proposal-text"] = mProposalText->getText(); LLHTTPClient::post( url, body, new LLStartGroupVoteResponder(mGroupID), 300); } else { //DEPRECATED!!!!!!! This is a fallback just in case our backend cap is not there. Delete this block ASAP! LLMessageSystem *msg = gMessageSystem; msg->newMessageFast(_PREHASH_StartGroupProposal); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() ); msg->nextBlockFast(_PREHASH_ProposalData); msg->addUUIDFast(_PREHASH_GroupID, mGroupID); msg->addF32Fast(_PREHASH_Majority, majority ); msg->addS32Fast(_PREHASH_Quorum, quorum ); msg->addS32Fast(_PREHASH_Duration, duration_seconds ); msg->addStringFast(_PREHASH_ProposalText, mProposalText->getText()); gAgent.sendReliableMessage(); //This code was moved from the callers to here as part of deprecation. sendGroupProposalsRequest(mGroupID); setEnableListProposals(); } }
void LLPanelDirEvents::performQueryOrDelete(U32 event_id) { S32 relative_day = mDay; // Update the date field to show the date IN THE SERVER'S // TIME ZONE, as that is what will be displayed in each event // Get time UTC time_t utc_time = time_corrected(); // Correct for offset utc_time += relative_day * 24 * 60 * 60; // There's only one internal tm buffer. struct tm* internal_time; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. internal_time = utc_to_pacific_time(utc_time, gPacificDaylightTime); std::string date; timeStructToFormattedString(internal_time, "%m-%d", date); childSetValue("date_text", date); // Record the relative day so back and forward buttons // offset from this day. mDay = relative_day; mDoneQuery = TRUE; U32 scope = DFQ_DATE_EVENTS; if ( gAgent.wantsPGOnly()) scope |= DFQ_PG_SIMS_ONLY; if ( childGetValue("incpg").asBoolean() ) scope |= DFQ_INC_PG; if ( childGetValue("incmature").asBoolean() ) scope |= DFQ_INC_MATURE; if ( childGetValue("incadult").asBoolean() ) scope |= DFQ_INC_ADULT; // Add old query flags in case we are talking to an old server if ( childGetValue("incpg").asBoolean() && !childGetValue("incmature").asBoolean()) { scope |= DFQ_PG_EVENTS_ONLY; } if ( !( scope & (DFQ_INC_PG | DFQ_INC_MATURE | DFQ_INC_ADULT ))) { LLNotificationsUtil::add("NoContentToSearch"); return; } setupNewSearch(); std::ostringstream params; // Date mode for the search if ("current" == childGetValue("date_mode").asString()) { params << "u|"; } else { params << mDay << "|"; } // Categories are stored in the database in table indra.event_category // XML must match. U32 cat_id = childGetValue("category combo").asInteger(); params << cat_id << "|"; params << childGetValue("event_search_text").asString(); // send the message if (0 == event_id) { sendDirFindQuery(gMessageSystem, mSearchID, params.str(), scope, mSearchStart); } else { // This delete will also perform a query. LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_EventGodDelete); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_EventData); msg->addU32Fast(_PREHASH_EventID, event_id); msg->nextBlockFast(_PREHASH_QueryData); msg->addUUIDFast(_PREHASH_QueryID, mSearchID); msg->addStringFast(_PREHASH_QueryText, params.str()); msg->addU32Fast(_PREHASH_QueryFlags, scope); msg->addS32Fast(_PREHASH_QueryStart, mSearchStart); gAgent.sendReliableMessage(); } }
void link_inventory_item( const LLUUID& agent_id, const LLUUID& item_id, const LLUUID& parent_id, const std::string& new_name, const std::string& new_description, const LLAssetType::EType asset_type, LLPointer<LLInventoryCallback> cb) { const LLInventoryObject *baseobj = gInventory.getObject(item_id); if (!baseobj) { llwarns << "attempt to link to unknown item, linked-to-item's itemID " << item_id << llendl; return; } if (baseobj && baseobj->getIsLinkType()) { llwarns << "attempt to create a link to a link, linked-to-item's itemID " << item_id << llendl; return; } if (baseobj && !LLAssetType::lookupCanLink(baseobj->getType())) { // Fail if item can be found but is of a type that can't be linked. // Arguably should fail if the item can't be found too, but that could // be a larger behavioral change. llwarns << "attempt to link an unlinkable item, type = " << baseobj->getActualType() << llendl; return; } LLUUID transaction_id; LLInventoryType::EType inv_type = LLInventoryType::IT_NONE; if (dynamic_cast<const LLInventoryCategory *>(baseobj)) { inv_type = LLInventoryType::IT_CATEGORY; } else { const LLViewerInventoryItem *baseitem = dynamic_cast<const LLViewerInventoryItem *>(baseobj); if (baseitem) { inv_type = baseitem->getInventoryType(); } } LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_LinkInventoryItem); msg->nextBlock(_PREHASH_AgentData); { msg->addUUIDFast(_PREHASH_AgentID, agent_id); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); } msg->nextBlock(_PREHASH_InventoryBlock); { msg->addU32Fast(_PREHASH_CallbackID, gInventoryCallbacks.registerCB(cb)); msg->addUUIDFast(_PREHASH_FolderID, parent_id); msg->addUUIDFast(_PREHASH_TransactionID, transaction_id); msg->addUUIDFast(_PREHASH_OldItemID, item_id); msg->addS8Fast(_PREHASH_Type, (S8)asset_type); msg->addS8Fast(_PREHASH_InvType, (S8)inv_type); msg->addStringFast(_PREHASH_Name, new_name); msg->addStringFast(_PREHASH_Description, new_description); } gAgent.sendReliableMessage(); }
void ImportTracker::send_properties(LLSD& prim, int counter) { if(prim.has("properties")) { if(counter == 1)//root only shit { //prim["LocalID"] LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ObjectPermissions); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_HeaderData); msg->addBOOLFast(_PREHASH_Override, FALSE); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, prim["LocalID"].asInteger()); msg->addU8Fast(_PREHASH_Field, PERM_NEXT_OWNER); msg->addBOOLFast(_PREHASH_Set, PERM_ITEM_UNRESTRICTED); msg->addU32Fast(_PREHASH_Mask, U32(atoi(prim["next_owner_mask"].asString().c_str()))); /*msg->sendReliable(gAgent.getRegion()->getHost()); //LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ObjectPermissions); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_HeaderData); msg->addBOOLFast(_PREHASH_Override, data->mOverride);*/ msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, prim["LocalID"].asInteger()); msg->addU8Fast(_PREHASH_Field, PERM_GROUP); msg->addBOOLFast(_PREHASH_Set, PERM_ITEM_UNRESTRICTED); msg->addU32Fast(_PREHASH_Mask, U32(atoi(prim["group_mask"].asString().c_str()))); /*msg->sendReliable(gAgent.getRegion()->getHost()); //LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ObjectPermissions); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_HeaderData); msg->addBOOLFast(_PREHASH_Override, data->mOverride);*/ msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, prim["LocalID"].asInteger()); msg->addU8Fast(_PREHASH_Field, PERM_EVERYONE); msg->addBOOLFast(_PREHASH_Set, PERM_ITEM_UNRESTRICTED); msg->addU32Fast(_PREHASH_Mask, U32(atoi(prim["everyone_mask"].asString().c_str()))); msg->sendReliable(gAgent.getRegion()->getHost()); msg->newMessageFast(_PREHASH_ObjectSaleInfo); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_LocalID, prim["LocalID"].asInteger()); LLSaleInfo sale_info; BOOL a; U32 b; sale_info.fromLLSD(prim["sale_info"],a,b); sale_info.packMessage(msg); msg->sendReliable(gAgent.getRegion()->getHost()); //no facilities exist to send any other information at this time. } } }
void LLPrefsIMImpl::apply() { LLTextEditor* busy = getChild<LLTextEditor>("busy_response"); LLWString busy_response; if (busy) busy_response = busy->getWText(); LLWStringUtil::replaceTabsWithSpaces(busy_response, 4); LLWStringUtil::replaceChar(busy_response, '\n', '^'); LLWStringUtil::replaceChar(busy_response, ' ', '%'); if(mGotPersonalInfo) { gSavedPerAccountSettings.setString("BusyModeResponse", std::string(wstring_to_utf8str(busy_response))); gSavedSettings.setBOOL("IMInChatHistory", childGetValue("include_im_in_chat_history").asBoolean()); gSavedSettings.setBOOL("IMShowTimestamps", childGetValue("show_timestamps_check").asBoolean()); gSavedSettings.setBOOL("ChatOnlineNotification", childGetValue("friends_online_notify_checkbox").asBoolean()); gSavedPerAccountSettings.setString("InstantMessageLogPath", childGetText("log_path_string")); gSavedPerAccountSettings.setBOOL("LogInstantMessages",childGetValue("log_instant_messages").asBoolean()); gSavedPerAccountSettings.setBOOL("LogChat",childGetValue("log_chat").asBoolean()); gSavedPerAccountSettings.setBOOL("LogShowHistory",childGetValue("log_show_history").asBoolean()); gSavedPerAccountSettings.setBOOL("IMLogTimestamp",childGetValue("log_instant_messages_timestamp").asBoolean()); gSavedPerAccountSettings.setBOOL("LogChatTimestamp",childGetValue("log_chat_timestamp").asBoolean()); gSavedPerAccountSettings.setBOOL("LogChatIM",childGetValue("log_chat_IM").asBoolean()); gSavedPerAccountSettings.setBOOL("LogTimestampDate",childGetValue("log_date_timestamp").asBoolean()); gDirUtilp->setChatLogsDir(gSavedPerAccountSettings.getString("InstantMessageLogPath")); gDirUtilp->setPerAccountChatLogsDir(gSavedSettings.getString("FirstName"), gSavedSettings.getString("LastName") ); LLFile::mkdir(gDirUtilp->getPerAccountChatLogsDir()); bool new_im_via_email = childGetValue("send_im_to_email").asBoolean(); bool new_hide_online = childGetValue("online_visibility").asBoolean(); if((new_im_via_email != mOriginalIMViaEmail) ||(new_hide_online != mOriginalHideOnlineStatus)) { LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_UpdateUserInfo); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_UserData); msg->addBOOLFast(_PREHASH_IMViaEMail, new_im_via_email); // This hack is because we are representing several different // possible strings with a single checkbox. Since most users // can only select between 2 values, we represent it as a // checkbox. This breaks down a little bit for liaisons, but // works out in the end. if(new_hide_online != mOriginalHideOnlineStatus) { if(new_hide_online) mDirectoryVisibility = VISIBILITY_HIDDEN; else mDirectoryVisibility = VISIBILITY_DEFAULT; //Update showonline value, otherwise multiple applys won't work mOriginalHideOnlineStatus = new_hide_online; } msg->addString("DirectoryVisibility", mDirectoryVisibility); gAgent.sendReliableMessage(); } } }