void LLObjectBackup::exportNextTexture() { if (mTexturesList.empty()) { LL_INFOS("ObjectBackup") << "Finished exporting textures." << LL_ENDL; return; } LLUUID id; std::list<LLUUID>::iterator iter; iter = mTexturesList.begin(); while (true) { if (iter == mTexturesList.end()) { mNextTextureReady = true; return; } id = (*iter); if (id.isNull()) { // NULL texture id: just remove and ignore. mTexturesList.remove(id); iter = mTexturesList.begin(); continue; } LLViewerTexture* imagep = LLViewerTextureManager::findTexture(id); if (imagep != NULL) { S32 cur_discard = imagep->getDiscardLevel(); if (cur_discard > 0) { if (imagep->getBoostLevel() != LLViewerTexture::BOOST_PREVIEW) { // we want to force discard 0: this one does this. imagep->setBoostLevel(LLViewerTexture::BOOST_PREVIEW); } } else { break; } } else { LL_WARNS("ObjectBackup") << "We *DON'T* have the texture " << id.asString() << LL_ENDL; mNonExportedTextures |= TEXTURE_MISSING; mTexturesList.remove(id); return; } iter++; } mTexturesList.remove(id); LL_INFOS("ObjectBackup") << "Requesting texture " << id << LL_ENDL; LLImageJ2C* mFormattedImage = new LLImageJ2C; CacheReadResponder* responder = new CacheReadResponder(id, mFormattedImage); LLAppViewer::getTextureCache()->readFromCache(id, LLWorkerThread::PRIORITY_HIGH, 0, 999999, responder); }
//static void LLFloaterWebContent::create( const std::string &url, const std::string& target, const std::string& uuid, bool show_chrome, const LLRect& preferred_media_size) { lldebugs << "url = " << url << ", target = " << target << ", uuid = " << uuid << llendl; std::string tag = target; if(target.empty() || target == "_blank") { if(!uuid.empty()) { tag = uuid; } else { // create a unique tag for this instance LLUUID id; id.generate(); tag = id.asString(); } } S32 browser_window_limit = gSavedSettings.getS32("WebContentWindowLimit"); if(LLFloaterReg::findInstance("web_content", tag) != NULL) { // There's already a web browser for this tag, so we won't be opening a new window. } else if(browser_window_limit != 0) { // showInstance will open a new window. Figure out how many web browsers are already open, // and close the least recently opened one if this will put us over the limit. LLFloaterReg::const_instance_list_t &instances = LLFloaterReg::getFloaterList("web_content"); lldebugs << "total instance count is " << instances.size() << llendl; for(LLFloaterReg::const_instance_list_t::const_iterator iter = instances.begin(); iter != instances.end(); iter++) { lldebugs << " " << (*iter)->getKey() << llendl; } if(instances.size() >= (size_t)browser_window_limit) { // Destroy the least recently opened instance (*instances.begin())->closeFloater(); } } LLFloaterWebContent *browser = dynamic_cast<LLFloaterWebContent*> (LLFloaterReg::showInstance("web_content", tag)); llassert(browser); if(browser) { browser->mUUID = uuid; // tell the browser instance to load the specified URL browser->open_media(url, target); LLViewerMedia::proxyWindowOpened(target, uuid); browser->getChild<LLLayoutPanel>("status_bar")->setVisible(show_chrome); browser->getChild<LLLayoutPanel>("nav_controls")->setVisible(show_chrome); if (!show_chrome) { browser->setResizeLimits(100, 100); } if (!preferred_media_size.isEmpty()) { //ignore x, y for now browser->geometryChanged(browser->getRect().mLeft, browser->getRect().mBottom, preferred_media_size.getWidth(), preferred_media_size.getHeight()); } } }
void LLPanelGroupGeneral::setGroupID(const LLUUID& id) { LLPanelGroupTab::setGroupID(id); // <FS> Get group key display and copy URI/name button pointers LLTextEditor* groupKeyEditor = getChild<LLTextEditor>("group_key"); LLButton* copyURIButton = getChild<LLButton>("copy_uri"); LLButton* copyNameButton = getChild<LLButton>("copy_name"); // happens when a new group is created // </FS> if(id == LLUUID::null) { // <FS> if (groupKeyEditor) groupKeyEditor->setValue(LLSD()); if (copyURIButton) copyURIButton->setEnabled(FALSE); if (copyNameButton) copyNameButton->setEnabled(FALSE); // </FS> reset(); return; } // <FS> // fill in group key if (groupKeyEditor) groupKeyEditor->setValue(id.asString()); // activate copy URI button if (copyURIButton) copyURIButton->setEnabled(TRUE); // </FS> BOOL accept_notices = FALSE; BOOL list_in_profile = FALSE; LLGroupData data; if(gAgent.getGroupData(mGroupID,data)) { accept_notices = data.mAcceptNotices; list_in_profile = data.mListInProfile; } mCtrlReceiveNotices = getChild<LLCheckBoxCtrl>("receive_notices"); if (mCtrlReceiveNotices) { mCtrlReceiveNotices->set(accept_notices); mCtrlReceiveNotices->setEnabled(data.mID.notNull()); } mCtrlListGroup = getChild<LLCheckBoxCtrl>("list_groups_in_profile"); if (mCtrlListGroup) { mCtrlListGroup->set(list_in_profile); mCtrlListGroup->setEnabled(data.mID.notNull()); } // <exodus> mCtrlReceiveGroupChat = getChild<LLCheckBoxCtrl>("receive_chat"); if (mCtrlReceiveGroupChat) { if(data.mID.notNull()) { mCtrlReceiveGroupChat->set(!exoGroupMuteList::instance().isMuted(data.mID)); } mCtrlReceiveGroupChat->setEnabled(data.mID.notNull()); } // </exodus> mCtrlShowInGroupList->setEnabled(data.mID.notNull()); mActiveTitleLabel = getChild<LLTextBox>("active_title_label"); mComboActiveTitle = getChild<LLComboBox>("active_title"); mFounderName->setVisible(true); mInsignia->setImageAssetID(LLUUID::null); resetDirty(); activate(); }
bool FSFloaterObjectExport::exportTexture(const LLUUID& texture_id) { if(texture_id.isNull()) { LL_WARNS("export") << "Attempted to export NULL texture." << LL_ENDL; return false; } if (mTextureChecked.count(texture_id) != 0) { return mTextureChecked[texture_id]; } if (gAssetStorage->mStaticVFS->getExists(texture_id, LLAssetType::AT_TEXTURE)) { LL_DEBUGS("export") << "Texture " << texture_id.asString() << " is local static." << LL_ENDL; // no need to save the texture data as the viewer already has it in a local file. mTextureChecked[texture_id] = true; return true; } //TODO: check for local file static texture. The above will only get the static texture in the static db, not individual textures. LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTexture(texture_id); bool texture_export = false; std::string name; std::string description; if (LLGridManager::getInstance()->isInSecondLife()) { if (imagep->mComment.find("a") != imagep->mComment.end()) { if (LLUUID(imagep->mComment["a"]) == gAgentID) { texture_export = true; LL_DEBUGS("export") << texture_id << " pass texture export comment check." << LL_ENDL; } } } if (texture_export) { FSExportPermsCheck::canExportAsset(texture_id, &name, &description); } else { texture_export = FSExportPermsCheck::canExportAsset(texture_id, &name, &description); } mTextureChecked[texture_id] = texture_export; if (!texture_export) { LL_DEBUGS("export") << "Texture " << texture_id << " failed export check." << LL_ENDL; return false; } LL_DEBUGS("export") << "Loading image texture " << texture_id << LL_ENDL; mRequestedTexture[texture_id].name = name; mRequestedTexture[texture_id].description = description; LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture(texture_id, FTT_DEFAULT, MIPMAP_TRUE); image->setBoostLevel(LLViewerTexture::BOOST_MAX_LEVEL); image->forceToSaveRawImage(0); image->setLoadedCallback(FSFloaterObjectExport::onImageLoaded, 0, TRUE, FALSE, this, &mCallbackTextureList); return true; }
void LLIMMgr::inviteToSession( const LLUUID& session_id, const std::string& session_name, const LLUUID& caller_id, const std::string& caller_name, EInstantMessage type, EInvitationType inv_type, const std::string& session_handle, const std::string& session_uri) { //ignore invites from muted residents if (LLMuteList::getInstance()->isMuted(caller_id)) { return; } std::string notify_box_type; BOOL ad_hoc_invite = FALSE; if(type == IM_SESSION_P2P_INVITE) { //P2P is different...they only have voice invitations notify_box_type = "VoiceInviteP2P"; } else if ( gAgent.isInGroup(session_id) ) { //only really old school groups have voice invitations notify_box_type = "VoiceInviteGroup"; } else if ( inv_type == INVITATION_TYPE_VOICE ) { //else it's an ad-hoc //and a voice ad-hoc notify_box_type = "VoiceInviteAdHoc"; ad_hoc_invite = TRUE; } else if ( inv_type == INVITATION_TYPE_IMMEDIATE ) { notify_box_type = "InviteAdHoc"; ad_hoc_invite = TRUE; } LLSD payload; payload["session_id"] = session_id; payload["session_name"] = session_name; payload["caller_id"] = caller_id; payload["caller_name"] = caller_name; payload["type"] = type; payload["inv_type"] = inv_type; payload["session_handle"] = session_handle; payload["session_uri"] = session_uri; payload["notify_box_type"] = notify_box_type; LLVoiceChannel* channelp = LLVoiceChannel::getChannelByID(session_id); if (channelp && channelp->callStarted()) { // you have already started a call to the other user, so just accept the invite LLNotifications::instance().forceResponse(LLNotification::Params("VoiceInviteP2P").payload(payload), 0); return; } if (type == IM_SESSION_P2P_INVITE || ad_hoc_invite) { if ( // we're rejecting non-friend voice calls and this isn't a friend (gSavedSettings.getBOOL("VoiceCallsFriendsOnly") && (LLAvatarTracker::instance().getBuddyInfo(caller_id) == NULL)) ) { // silently decline the call LLNotifications::instance().forceResponse(LLNotification::Params("VoiceInviteP2P").payload(payload), 1); return; } } if ( !mPendingInvitations.has(session_id.asString()) ) { if (caller_name.empty()) { gCacheName->get(caller_id, true, // voice boost::bind(&LLIMMgr::onInviteNameLookup, _1, _2, _3, payload)); } else { LLSD args; args["NAME"] = caller_name; args["GROUP"] = session_name; LLNotifications::instance().add(notify_box_type, args, payload, &inviteUserResponse); } mPendingInvitations[session_id.asString()] = LLSD(); } }
// <FS:Ansariel> Server-side storage std::string exoGroupMuteList::getMutelistString(const LLUUID& group) const { return std::string("Group:" + group.asString()); }
void LLInspectAvatar::copyUUID() { gClipboard.copyFromString(utf8str_to_wstring(mAvatarID.asString())); }
LLSD FSData::resolveClientTag(LLUUID id, bool new_system, LLColor4 color){ //WS: Create a new LLSD based on the data from the LegacyClientList if LLSD curtag; curtag["uuid"]=id.asString(); curtag["id_based"]=new_system; curtag["tex_color"]=color.getValue(); // If we don't want to display anything...return if(gSavedSettings.getU32("FSClientTagsVisibility2") == 0) { return curtag; } //WS: Do we want to use Legacy Clienttags? if(gSavedSettings.getU32("FSUseLegacyClienttags") > 0) { if(LegacyClientList.has(id.asString())) { curtag=LegacyClientList[id.asString()]; } else { if(id == LLUUID("5d9581af-d615-bc16-2667-2f04f8eeefe4"))//green { curtag["name"]="Phoenix"; curtag["color"] = LLColor4::green.getValue(); curtag["alt"] = "ed63fbd0-589e-fe1d-a3d0-16905efaa96b"; } else if(id == LLUUID("e35f7d40-6071-4b29-9727-5647bdafb5d5"))//white { curtag["name"] = "Phoenix"; curtag["color"] = LLColor4::white.getValue(); curtag["alt"] = "ed63fbd0-589e-fe1d-a3d0-16905efaa96b"; } else if(id == LLUUID("ae4e92fb-023d-23ba-d060-3403f953ab1a"))//pink { curtag["name"] = "Phoenix"; curtag["color"] = LLColor4::pink.getValue(); curtag["alt"] = "ed63fbd0-589e-fe1d-a3d0-16905efaa96b"; } else if(id == LLUUID("e71b780e-1a57-400d-4649-959f69ec7d51"))//red { curtag["name"] = "Phoenix"; curtag["color"] = LLColor4::red.getValue(); curtag["alt"] = "ed63fbd0-589e-fe1d-a3d0-16905efaa96b"; } else if(id == LLUUID("c1c189f5-6dab-fc03-ea5a-f9f68f90b018"))//orange { curtag["name"] = "Phoenix"; curtag["color"] = LLColor4::orange.getValue(); curtag["alt"] = "ed63fbd0-589e-fe1d-a3d0-16905efaa96b"; } else if(id == LLUUID("8cf0577c-22d3-6a73-523c-15c0a90d6c27")) //purple { curtag["name"] = "Phoenix"; curtag["color"] = LLColor4::purple.getValue(); curtag["alt"] = "ed63fbd0-589e-fe1d-a3d0-16905efaa96b"; } else if(id == LLUUID("5f0e7c32-38c3-9214-01f0-fb16a5b40128"))//yellow { curtag["name"] = "Phoenix"; curtag["color"] = LLColor4::yellow.getValue(); curtag["alt"] = "ed63fbd0-589e-fe1d-a3d0-16905efaa96b"; } else if(id == LLUUID("5bb6e4a6-8e24-7c92-be2e-91419bb0ebcb"))//blue { curtag["name"] = "Phoenix"; curtag["color"] = LLColor4::blue.getValue(); curtag["alt"] = "ed63fbd0-589e-fe1d-a3d0-16905efaa96b"; } else if(id == LLUUID("ed63fbd0-589e-fe1d-a3d0-16905efaa96b"))//default (red) { curtag["name"] = "Phoenix"; curtag["color"] = LLColor4::red.getValue(); } else if(id == LLUUID("c228d1cf-4b5d-4ba8-84f4-899a0796aa97"))//viewer 2.0 { curtag["name"] = "LL Viewer"; } else if(id == LLUUID("cc7a030f-282f-c165-44d2-b5ee572e72bf")) { curtag["name"] = "Imprudence"; } else if(id == LLUUID("54d93609-1392-2a93-255c-a9dd429ecca5")) { curtag["name"] = "Emergence"; } else if(id == LLUUID("8873757c-092a-98fb-1afd-ecd347566fcd")) { curtag["name"] = "Ascent"; } else if(id == LLUUID("f25263b7-6167-4f34-a4ef-af65213b2e39")) { curtag["name"] = "Singularity"; } if(curtag.has("name")) curtag["tpvd"]=true; } } // Filtering starts here: //WS: If the current tag has an "alt" definied and we don't want multiple colors. Resolve the alt. if((gSavedSettings.getU32("FSColorClienttags") == 1) && curtag.has("alt")) { curtag = resolveClientTag(curtag["alt"], new_system, color); } //WS: If we have a tag using the new system, check if we want to display it's name and/or color if(new_system) { if(gSavedSettings.getU32("FSClientTagsVisibility2") >= 3) { // strnlen() doesn't exist on OS X before 10.7. -- TS char tag_temp[UUID_BYTES+1]; strncpy(tag_temp,(const char*)&id.mData[0], UUID_BYTES); tag_temp[UUID_BYTES] = '\0'; U32 tag_len = strlen(tag_temp); std::string clienttagname = std::string((const char*)&id.mData[0], tag_len); LLStringFn::replace_ascii_controlchars(clienttagname, LL_UNKNOWN_CHAR); curtag["name"] = clienttagname; } if(gSavedSettings.getU32("FSColorClienttags") >= 3 || curtag["tpvd"].asBoolean()) { if(curtag["tpvd"].asBoolean() && gSavedSettings.getU32("FSColorClienttags") < 3) { if(color == LLColor4::blue || color == LLColor4::yellow || color == LLColor4::purple || color == LLColor4((F32)0.99,(F32)0.39,(F32)0.12,(F32)1) || color == LLColor4::red || color == LLColor4((F32)0.99,(F32)0.56,(F32)0.65,(F32)1) || color == LLColor4::white || color == LLColor4::green) { curtag["color"] = color.getValue(); } } else { curtag["color"] = color.getValue(); } } } //If we only want to display tpvd viewer. And "tpvd" is not available or false, then // clear the data, but keep the basedata (like uuid, id_based and tex_color) for (maybe) later displaying. if(gSavedSettings.getU32("FSClientTagsVisibility2") <= 1 && (!curtag.has("tpvd") || !curtag["tpvd"].asBoolean())) { curtag.clear(); } curtag["uuid"]=id.asString(); curtag["id_based"]=new_system; curtag["tex_color"]=color.getValue(); return curtag; }
LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject, const std::string& message, const std::string& from_name, const LLUUID& group_id, const LLUUID& group_insignia, const std::string& group_name, const LLDate& time_stamp, const bool& has_inventory, const std::string& inventory_name, const LLSD& inventory_offer) : LLPanel("groupnotify", LLGroupNotifyBox::getGroupNotifyRect(), BORDER_YES), mAnimating(TRUE), mTimer(), mGroupID(group_id), mHasInventory(has_inventory), mInventoryOffer(NULL) { const S32 VPAD = 2; const S32 TOP = getRect().getHeight() - 32; // Get past the top menu bar const S32 BOTTOM_PAD = VPAD * 2; const S32 BTN_TOP = BOTTOM_PAD + BTN_HEIGHT + VPAD; const S32 RIGHT = getRect().getWidth() - HPAD - HPAD; const S32 LINE_HEIGHT = 16; const S32 LABEL_WIDTH = 64; const S32 ICON_WIDTH = 64; time_t timestamp = (time_t)time_stamp.secondsSinceEpoch(); if (!timestamp) time(×tamp); std::string time_buf; timeToFormattedString(timestamp, gSavedSettings.getString("TimestampFormat"), time_buf); if (mHasInventory) { mInventoryOffer = new LLOfferInfo(inventory_offer); } setFocusRoot(TRUE); setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); setBackgroundVisible(TRUE); setBackgroundOpaque(TRUE); setBackgroundColor( gColors.getColor("GroupNotifyBoxColor") ); LLIconCtrl* icon; LLTextEditor* text; S32 y = TOP; S32 x = HPAD + HPAD; class NoticeText : public LLTextBox { public: NoticeText(const std::string& name, const LLRect& rect, const std::string& text = LLStringUtil::null, const LLFontGL* font = NULL) : LLTextBox(name, rect, text, font) { setHAlign(LLFontGL::RIGHT); setFontShadow(LLFontGL::DROP_SHADOW_SOFT); setBorderVisible(FALSE); setColor( gColors.getColor("GroupNotifyTextColor") ); setBackgroundColor( gColors.getColor("GroupNotifyBoxColor") ); } }; // Title addChild(new NoticeText(std::string("title"),LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),LLTrans::getString("GroupNotifyGroupNotice"),LLFontGL::getFontSansSerifHuge())); y -= llfloor(1.5f*LINE_HEIGHT); x += HPAD + HPAD + ICON_WIDTH; std::stringstream from; from << LLTrans::getString("GroupNotifySentBy") << " " + from_name << LLTrans::getString(",") + " " << group_name; addChild(new NoticeText(std::string("group"),LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),from.str(),LLFontGL::getFontSansSerif())); y -= (LINE_HEIGHT + VPAD); x = HPAD + HPAD; // TODO: change this to be the group icon. if (!group_insignia.isNull()) { icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+ICON_WIDTH, y-ICON_WIDTH), group_insignia.asString()); } else { icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+ICON_WIDTH, y-ICON_WIDTH), std::string("notify_box_icon.tga")); } icon->setMouseOpaque(FALSE); addChild(icon); x += HPAD + HPAD + ICON_WIDTH; // If we have inventory with this message, leave room for the name. S32 box_bottom = BTN_TOP + (mHasInventory ? (LINE_HEIGHT + 2*VPAD) : 0); text = new LLViewerTextEditor(std::string("box"), LLRect(x, y, RIGHT, box_bottom), DB_GROUP_NOTICE_MSG_STR_LEN, LLStringUtil::null, LLFontGL::getFontSansSerif(), FALSE); static const LLStyleSP headerstyle(new LLStyle(true,LLColor4::black,"SansSerifBig")); static const LLStyleSP datestyle(new LLStyle(true,LLColor4::black,"serif")); text->appendStyledText(subject + "\n",false,false,headerstyle); text->appendStyledText(time_buf,false,false,datestyle); // Sadly, our LLTextEditor can't handle both styled and unstyled text // at the same time. Hence this space must be styled. JC text->appendColoredText(std::string(" "),false,false,LLColor4::grey4); text->setParseHTML(TRUE); text->appendColoredText(std::string("\n\n") + message,false,false,LLColor4::grey4); LLColor4 semi_transparent(1.0f,1.0f,1.0f,0.8f); text->setCursor(0,0); text->setEnabled(FALSE); text->setWordWrap(TRUE); //text->setTabStop(FALSE); // was interfering with copy-and-paste text->setTabsToNextField(TRUE); text->setMouseOpaque(TRUE); text->setBorderVisible(TRUE); text->setTakesNonScrollClicks(TRUE); text->setHideScrollbarForShortDocs(TRUE); text->setReadOnlyBgColor ( semi_transparent ); text->setWriteableBgColor ( semi_transparent ); addChild(text); y = box_bottom - VPAD; if (mHasInventory) { addChild(new NoticeText(std::string("subjecttitle"),LLRect(x,y,x + LABEL_WIDTH,y - LINE_HEIGHT),LLTrans::getString("GroupNotifyAttached"),LLFontGL::getFontSansSerif())); LLUIImagePtr item_icon = LLInventoryIcon::getIcon(mInventoryOffer->mType, LLInventoryType::IT_TEXTURE, 0, FALSE); x += LABEL_WIDTH + HPAD; std::stringstream ss; ss << " " << inventory_name; LLTextBox *line = new LLTextBox(std::string("object_name"),LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),ss.str(),LLFontGL::getFontSansSerif()); line->setEnabled(FALSE); line->setBorderVisible(TRUE); line->setDisabledColor(LLColor4::blue4); line->setFontStyle(LLFontGL::NORMAL); line->setBackgroundVisible(true); line->setBackgroundColor( semi_transparent ); addChild(line); icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+16, y-16), item_icon->getName()); icon->setMouseOpaque(FALSE); addChild(icon); } LLButton* btn; btn = new LLButton(LLTrans::getString("next"), LLRect(getRect().getWidth()-26, BOTTOM_PAD + 20, getRect().getWidth()-2, BOTTOM_PAD), std::string("notify_next.png"), std::string("notify_next.png"), LLStringUtil::null, boost::bind(&LLGroupNotifyBox::onClickNext, this), LLFontGL::getFontSansSerif()); btn->setToolTip(LLTrans::getString("next")); btn->setScaleImage(TRUE); addChild(btn); mNextBtn = btn; S32 btn_width = 80; S32 wide_btn_width = 120; LLRect btn_rect; x = 3 * HPAD; btn_rect.setOriginAndSize(x, BOTTOM_PAD, btn_width, BTN_HEIGHT); btn = new LLButton(LLTrans::getString("ok"), btn_rect, LLStringUtil::null, boost::bind(&LLGroupNotifyBox::onClickOk,this)); addChild(btn, -1); setDefaultBtn(btn); x += btn_width + HPAD; btn_rect.setOriginAndSize(x, BOTTOM_PAD, wide_btn_width, BTN_HEIGHT); btn = new LLButton(LLTrans::getString("GroupNotifyGroupNotices"), btn_rect, LLStringUtil::null, boost::bind(LLGroupActions::showTab, mGroupID, "notices_tab")); btn->setToolTip(LLTrans::getString("GroupNotifyViewPastNotices")); addChild(btn, -1); if (mHasInventory) { x += wide_btn_width + HPAD; btn_rect.setOriginAndSize(x, BOTTOM_PAD, wide_btn_width, BTN_HEIGHT); std::string btn_lbl(""); if(is_openable(mInventoryOffer->mType)) { btn_lbl = LLTrans::getString("GroupNotifyOpenAttachment"); } else { btn_lbl = LLTrans::getString("GroupNotifySaveAttachment"); } mSaveInventoryBtn = new LLButton(btn_lbl, btn_rect, LLStringUtil::null, boost::bind(&LLGroupNotifyBox::onClickSaveInventory,this)); mSaveInventoryBtn->setVisible(mHasInventory); addChild(mSaveInventoryBtn); } sGroupNotifyBoxCount++; // If this is the only notify box, don't show the next button if (sGroupNotifyBoxCount == 1) { mNextBtn->setVisible(FALSE); } }
void LLIMMgr::inviteToSession( const LLUUID& session_id, const std::string& session_name, const LLUUID& caller_id, const std::string& caller_name, EInstantMessage type, EInvitationType inv_type, const std::string& session_handle, const std::string& session_uri) { //ignore invites from muted residents if (LLMuteList::getInstance()->isMuted(caller_id)) { return; } std::string notify_box_type; BOOL ad_hoc_invite = FALSE; if(type == IM_SESSION_P2P_INVITE) { //P2P is different...they only have voice invitations notify_box_type = "VoiceInviteP2P"; } else if ( gAgent.isInGroup(session_id) ) { //only really old school groups have voice invitations notify_box_type = "VoiceInviteGroup"; } else if ( inv_type == INVITATION_TYPE_VOICE ) { //else it's an ad-hoc //and a voice ad-hoc notify_box_type = "VoiceInviteAdHoc"; ad_hoc_invite = TRUE; } else if ( inv_type == INVITATION_TYPE_IMMEDIATE ) { notify_box_type = "InviteAdHoc"; ad_hoc_invite = TRUE; } LLSD payload; payload["session_id"] = session_id; payload["session_name"] = session_name; payload["caller_id"] = caller_id; payload["caller_name"] = caller_name; payload["type"] = type; payload["inv_type"] = inv_type; payload["session_handle"] = session_handle; payload["session_uri"] = session_uri; payload["notify_box_type"] = notify_box_type; LLVoiceChannel* channelp = LLVoiceChannel::getChannelByID(session_id); if (channelp && channelp->callStarted()) { // you have already started a call to the other user, so just accept the invite LLNotifications::instance().forceResponse(LLNotification::Params("VoiceInviteP2P").payload(payload), 0); return; } if (type == IM_SESSION_P2P_INVITE || ad_hoc_invite) { // is the inviter a friend? if (LLAvatarTracker::instance().getBuddyInfo(caller_id) == NULL) { // if not, and we are ignoring voice invites from non-friends // then silently decline if (gSavedSettings.getBOOL("VoiceCallsFriendsOnly")) { // invite not from a friend, so decline LLNotifications::instance().forceResponse(LLNotification::Params("VoiceInviteP2P").payload(payload), 1); return; } } } if ( !mPendingInvitations.has(session_id.asString()) ) { if (caller_name.empty()) { gCacheName->getName(caller_id, onInviteNameLookup, new LLSD(payload)); } else { LLSD args; args["NAME"] = caller_name; //args["GROUP"] = session_name; LLGroupMgrGroupData* temp = LLGroupMgr::getInstance()->getGroupData(session_id); bool waiting = false; if(temp) { if (temp->isGroupPropertiesDataComplete()) { args["GROUP"] = temp->mName; } else { waiting = true; } } else { waiting = true; } if(waiting) { LLGroupMgr::getInstance()->sendGroupPropertiesRequest(session_id); } LLNotifications::instance().add(notify_box_type, args, payload, &inviteUserResponse); } mPendingInvitations[session_id.asString()] = LLSD(); } }
static void copy_group_profile_uri(const LLUUID& id) { gViewerWindow->getWindow()->copyTextToClipboard(utf8str_to_wstring("secondlife:///app/group/"+id.asString()+"/about")); }
static void variable_table_push(lua_State* L, LLMessageSystem *msg, const char* block_name, const int block_num, LLLuaTable &block_variable_table, LLMessageVariable* variable) { const char* var_name = variable->getName(); block_variable_table.pushkeystring(L, var_name); switch(variable->getType()) { case MVT_U8: { U8 value; msg->getU8Fast(block_name, var_name, value, block_num); block_variable_table.pushvalue(L, value); } break; case MVT_U16: { U16 value; msg->getU16Fast(block_name, var_name, value, block_num); block_variable_table.pushvalue(L, value); } break; case MVT_U32: { U32 value; msg->getU32Fast(block_name, var_name, value, block_num); block_variable_table.pushvalue(L, value); } break; case MVT_U64: { U64 value; msg->getU64Fast(block_name, var_name, value, block_num); block_variable_table.pushvalue(L, value); } break; case MVT_S8: { S8 value; msg->getS8Fast(block_name, var_name, value, block_num); block_variable_table.pushvalue(L, value); } break; case MVT_S16: { S16 value; msg->getS16Fast(block_name, var_name, value, block_num); block_variable_table.pushvalue(L, value); } break; case MVT_S32: { S32 value; msg->getS32Fast(block_name, var_name, value, block_num); block_variable_table.pushvalue(L, value); } break; case MVT_F32: { F32 value; msg->getF32Fast(block_name, var_name, value, block_num); block_variable_table.pushvalue(L, value); } break; case MVT_F64: { F64 value; msg->getF64Fast(block_name, var_name, value, block_num); block_variable_table.pushvalue(L, value); } break; case MVT_LLVector3: { LLVector3 value; msg->getVector3Fast(block_name, var_name, value, block_num); LLLuaTable vector(L); for(int i = 0; i < 3; i++) { vector.pushvalue(L, value.mV[i]); } block_variable_table.push(L); } break; case MVT_LLVector3d: { LLVector3d value; msg->getVector3dFast(block_name, var_name, value, block_num); LLLuaTable vector(L); for(int i = 0; i < 3; i++) { vector.pushvalue(L, value.mdV[i]); } block_variable_table.push(L); } break; case MVT_LLVector4: { LLVector4 value; msg->getVector4Fast(block_name, var_name, value, block_num); LLLuaTable vector(L); for(int i = 0; i < 4; i++) { vector.pushvalue(L, value.mV[i]); } block_variable_table.push(L); } break; case MVT_LLQuaternion: { LLQuaternion value; msg->getQuatFast(block_name, var_name, value, block_num); LLLuaTable quat(L); for(int i = 0; i < 4; i++) { quat.pushvalue(L, value.mQ[i]); } block_variable_table.push(L); } break; case MVT_LLUUID: { LLUUID value; msg->getUUIDFast(block_name, var_name, value, block_num); block_variable_table.pushvalue(L, value.asString().c_str()); } break; case MVT_BOOL: { BOOL value; msg->getBOOLFast(block_name, var_name, value, block_num); block_variable_table.pushvalue(L, value); } break; case MVT_IP_ADDR: { U32 value; msg->getIPAddrFast(block_name, var_name, value, block_num); block_variable_table.pushvalue(L, LLHost(value, 0).getIPString().c_str()); } break; case MVT_IP_PORT: { U16 value; msg->getIPPort(block_name, var_name, value, block_num); block_variable_table.pushvalue(L, value); } case MVT_VARIABLE: case MVT_FIXED: default: { S32 size = msg->getSize(block_name, block_num, var_name); if(size) { std::ostringstream stream; char* value = new char[size + 1]; msg->getBinaryDataFast(block_name, var_name, value, size, block_num); value[size] = '\0'; S32 readable = 0; S32 unreadable = 0; for(S32 i = 0; i < size; i++) { if(!value[i]) { if(i != (size - 1)) { // don't want null terminator hiding data unreadable = S32_MAX; break; } } else if(value[i] < 0x20 || value[i] >= 0x7F) { unreadable = S32_MAX; break; } else readable++; } if(readable >= unreadable) { stream << value; delete[] value; } else { for(S32 i = 0; i < size; i++) stream << llformat("%02X ", (U8)value[i]); } block_variable_table.pushvalue(L, stream.str().c_str()); } else { block_variable_table.pushvalue(L,""); //empty string } } break; } //end switch }
std::string LLFloaterAO::idstr(LLUUID id) { if(id.notNull()) return id.asString(); else return ""; }
// IW - uuid is passed by value to avoid side effects, please don't re-add & void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LLGetAssetCallback callback, void *user_data, BOOL is_priority) { LL_DEBUGS("AssetStorage") << "LLAssetStorage::getAssetData() - " << uuid << "," << LLAssetType::lookup(type) << llendl; LL_DEBUGS("AssetStorage") << "ASSET_TRACE requesting " << uuid << " type " << LLAssetType::lookup(type) << llendl; if (user_data) { // The *user_data should not be passed without a callback to clean it up. llassert(callback != NULL) } if (mShutDown) { LL_DEBUGS("AssetStorage") << "ASSET_TRACE cancelled " << uuid << " type " << LLAssetType::lookup(type) << " shutting down" << llendl; if (callback) { callback(mVFS, uuid, type, user_data, LL_ERR_ASSET_REQUEST_FAILED, LL_EXSTAT_NONE); } return; } if (uuid.isNull()) { // Special case early out for NULL uuid and for shutting down if (callback) { callback(mVFS, uuid, type, user_data, LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE, LL_EXSTAT_NULL_UUID); } return; } /* <edit> */ if(std::find(mBlackListedAsset.begin(),mBlackListedAsset.end(),uuid) != mBlackListedAsset.end()) { llinfos << "Blacklisted asset " << uuid.asString() << " was trying to be accessed!!!!!!" << llendl; if (callback) { callback(mVFS, uuid, type, user_data, LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE, LL_EXSTAT_NULL_UUID); } return; } /* </edit> */ // Try static VFS first. if (findInStaticVFSAndInvokeCallback(uuid,type,callback,user_data)) { LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << uuid << " found in static VFS" << llendl; return; } BOOL exists = mVFS->getExists(uuid, type); LLVFile file(mVFS, uuid, type); U32 size = exists ? file.getSize() : 0; if (size > 0) { // we've already got the file // theoretically, partial files w/o a pending request shouldn't happen // unless there's a weird error if (callback) { callback(mVFS, uuid, type, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED); } LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << uuid << " found in VFS" << llendl; } else { if (exists) { llwarns << "Asset vfile " << uuid << ":" << type << " found with bad size " << file.getSize() << ", removing" << llendl; file.remove(); } BOOL duplicate = FALSE; // check to see if there's a pending download of this uuid already for (request_list_t::iterator iter = mPendingDownloads.begin(); iter != mPendingDownloads.end(); ++iter ) { LLAssetRequest *tmp = *iter; if ((type == tmp->getType()) && (uuid == tmp->getUUID())) { if (callback == tmp->mDownCallback && user_data == tmp->mUserData) { // this is a duplicate from the same subsystem - throw it away llwarns << "Discarding duplicate request for asset " << uuid << "." << LLAssetType::lookup(type) << llendl; return; } // this is a duplicate request // queue the request, but don't actually ask for it again duplicate = TRUE; } } if (duplicate) { LL_DEBUGS("AssetStorage") << "Adding additional non-duplicate request for asset " << uuid << "." << LLAssetType::lookup(type) << llendl; } // This can be overridden by subclasses _queueDataRequest(uuid, type, callback, user_data, duplicate, is_priority); } }
BOOL LLImageJ2COJ::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time, BOOL reversible) { const S32 MAX_COMPS = 5; opj_cparameters_t parameters; /* compression parameters */ opj_event_mgr_t event_mgr; /* event manager */ /* configure the event callbacks (not required) setting of each callback is optional */ memset(&event_mgr, 0, sizeof(opj_event_mgr_t)); event_mgr.error_handler = error_callback; event_mgr.warning_handler = warning_callback; event_mgr.info_handler = info_callback; /* set encoding parameters to default values */ opj_set_default_encoder_parameters(¶meters); parameters.cod_format = 0; parameters.cp_disto_alloc = 1; if (reversible) { parameters.tcp_numlayers = 1; parameters.tcp_rates[0] = 0.0f; } else { parameters.tcp_numlayers = 5; parameters.tcp_rates[0] = 1920.0f; parameters.tcp_rates[1] = 480.0f; parameters.tcp_rates[2] = 120.0f; parameters.tcp_rates[3] = 30.0f; parameters.tcp_rates[4] = 10.0f; parameters.irreversible = 1; if (raw_image.getComponents() >= 3) { parameters.tcp_mct = 1; } } std::string comment_metadata; if (!comment_text) { //Inserting owner id, upload time, and dimensions //See http://wiki.secondlife.com/wiki/Texture_meta-data for details. extern LLUUID gAgentID; time_t now = time(NULL); tm * ptime = gmtime(&now); //std::string color_avg(llformat("c=%02x%02x%02x%02x")); //Perhaps do this some day... std::string timestr(llformat("z=%04i%02i%02i%02i%02i%02i",ptime->tm_year+1900,ptime->tm_mon+1,ptime->tm_mday,ptime->tm_hour,ptime->tm_min,ptime->tm_sec)); comment_metadata=llformat("a=%s&%s&h=%u&w=%u",gAgentID.asString().c_str(),timestr.c_str(),(U32)raw_image.getHeight(),(U32)raw_image.getWidth()); parameters.cp_comment = (char *) comment_metadata.c_str(); } else { // Awful hacky cast, too lazy to copy right now. parameters.cp_comment = (char *) comment_text; } // // Fill in the source image from our raw image // OPJ_COLOR_SPACE color_space = CLRSPC_SRGB; opj_image_cmptparm_t cmptparm[MAX_COMPS]; opj_image_t * image = NULL; S32 numcomps = llmin((S32)raw_image.getComponents(),(S32)MAX_COMPS); //Clamp avoid overrunning buffer -Shyotl S32 width = raw_image.getWidth(); S32 height = raw_image.getHeight(); memset(&cmptparm[0], 0, MAX_COMPS * sizeof(opj_image_cmptparm_t)); for(S32 c = 0; c < numcomps; c++) { cmptparm[c].prec = 8; cmptparm[c].bpp = 8; cmptparm[c].sgnd = 0; cmptparm[c].dx = parameters.subsampling_dx; cmptparm[c].dy = parameters.subsampling_dy; cmptparm[c].w = width; cmptparm[c].h = height; } /* create the image */ image = opj_image_create(numcomps, &cmptparm[0], color_space); image->x1 = width; image->y1 = height; S32 i = 0; const U8 *src_datap = raw_image.getData(); for (S32 y = height - 1; y >= 0; y--) { for (S32 x = 0; x < width; x++) { const U8 *pixel = src_datap + (y*width + x) * numcomps; for (S32 c = 0; c < numcomps; c++) { image->comps[c].data[i] = *pixel; pixel++; } i++; } } /* encode the destination image */ /* ---------------------------- */ int codestream_length; opj_cio_t *cio = NULL; /* get a J2K compressor handle */ opj_cinfo_t* cinfo = opj_create_compress(CODEC_J2K); /* catch events using our callbacks and give a local context */ opj_set_event_mgr((opj_common_ptr)cinfo, &event_mgr, stderr); /* setup the encoder parameters using the current image and using user parameters */ opj_setup_encoder(cinfo, ¶meters, image); /* open a byte stream for writing */ /* allocate memory for all tiles */ cio = opj_cio_open((opj_common_ptr)cinfo, NULL, 0); /* encode the image */ bool bSuccess = opj_encode(cinfo, cio, image, NULL); if (!bSuccess) { opj_cio_close(cio); llinfos << "Failed to encode image." << llendl; return FALSE; } codestream_length = cio_tell(cio); base.copyData(cio->buffer, codestream_length); base.updateData(); // set width, height /* close and free the byte stream */ opj_cio_close(cio); /* free remaining compression structures */ opj_destroy_compress(cinfo); /* free user parameters structure */ if(parameters.cp_matrice) free(parameters.cp_matrice); /* free image data */ opj_image_destroy(image); return TRUE; }
void AnimationExplorer::addAnimation(const LLUUID& id, const LLUUID& played_by, F64 time) { // don't add animations that are played by ourselves when the filter box is checked if(played_by==gAgentAvatarp->getID()) { if(mNoOwnedAnimationsCheckBox->getValue().asBoolean()) { return; } } // set object name to UUID at first std::string playedByName=played_by.asString(); // find out if the object is still in reach LLViewerObject* vo=gObjectList.findObject(played_by); if(vo) { // if it was an avatar, get the name here if(vo->isAvatar()) { playedByName=std::string(vo->getNVPair("FirstName")->getString())+" "+ std::string(vo->getNVPair("LastName")->getString()); } // not an avatar, do a lookup by UUID else { // find out if we know the name to this UUID already std::map<LLUUID,std::string>::iterator iter=mKnownIDs.find(played_by); // if we don't know it yet, start a lookup if(iter==mKnownIDs.end()) { // if we are not already looking up this object's name, send a request out if(std::find(mRequestedIDs.begin(),mRequestedIDs.end(),played_by)==mRequestedIDs.end()) { // remember which object names we already requested mRequestedIDs.push_back(played_by); 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,vo->getLocalID()); msg->sendReliable(gAgentAvatarp->getRegion()->getHost()); msg->newMessageFast(_PREHASH_ObjectDeselect); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID,vo->getLocalID()); msg->sendReliable(gAgentAvatarp->getRegion()->getHost()); } } else { // we know the name already playedByName=mKnownIDs[played_by]; } } } // insert the item into the scroll list LLSD item; item["columns"][0]["column"]="played_by"; item["columns"][0]["value"]=playedByName; item["columns"][1]["column"]="played"; item["columns"][1]["value"]=LLTrans::getString("animation_explorer_still_playing"); item["columns"][2]["column"]="timestamp"; item["columns"][2]["value"]=time; item["columns"][3]["column"]="animation_id"; item["columns"][3]["value"]=id; item["columns"][4]["column"]="object_id"; item["columns"][4]["value"]=played_by; mAnimationScrollList->addElement(item,ADD_TOP); }
void LLFloaterAvatarList::updateAvatarList() { //llinfos << "radar refresh: updating map" << llendl; // Check whether updates are enabled LLCheckboxCtrl* check = getChild<LLCheckboxCtrl>("update_enabled_cb"); if (check && !check->getValue()) { mUpdate = FALSE; refreshTracker(); return; } else { mUpdate = TRUE; } //moved to pipeline to prevent a crash //gPipeline.forAllVisibleDrawables(updateParticleActivity); //todo: make this less of a hacked up copypasta from dales 1.18. if(gAudiop != NULL) { LLAudioEngine::source_map::iterator iter; for (iter = gAudiop->mAllSources.begin(); iter != gAudiop->mAllSources.end(); ++iter) { LLAudioSource *sourcep = iter->second; LLUUID uuid = sourcep->getOwnerID(); LLAvatarListEntry *ent = getAvatarEntry(uuid); if ( ent ) { ent->setActivity(LLAvatarListEntry::ACTIVITY_SOUND); } } } LLVector3d mypos = gAgent.getPositionGlobal(); { std::vector<LLUUID> avatar_ids; std::vector<LLUUID> sorted_avatar_ids; std::vector<LLVector3d> positions; LLWorld::instance().getAvatars(&avatar_ids, &positions, mypos, F32_MAX); sorted_avatar_ids = avatar_ids; std::sort(sorted_avatar_ids.begin(), sorted_avatar_ids.end()); BOOST_FOREACH(std::vector<LLCharacter*>::value_type& iter, LLCharacter::sInstances) { LLUUID avid = iter->getID(); if (!std::binary_search(sorted_avatar_ids.begin(), sorted_avatar_ids.end(), avid)) { avatar_ids.push_back(avid); } } size_t i; size_t count = avatar_ids.size(); static LLCachedControl<bool> announce(gSavedSettings, "RadarChatKeys"); std::queue<LLUUID> announce_keys; for (i = 0; i < count; ++i) { std::string name; const LLUUID &avid = avatar_ids[i]; LLVector3d position; LLVOAvatar* avatarp = gObjectList.findAvatar(avid); if (avatarp) { // Skip if avatar is dead(what's that?) // or if the avatar is ourselves. // or if the avatar is a dummy if (avatarp->isDead() || avatarp->isSelf() || avatarp->mIsDummy) { continue; } // Get avatar data position = gAgent.getPosGlobalFromAgent(avatarp->getCharacterPosition()); name = avatarp->getFullname(); if (!LLAvatarNameCache::getPNSName(avatarp->getID(), name)) continue; //duped for lower section if (name.empty() || (name.compare(" ") == 0))// || (name.compare(gCacheName->getDefaultName()) == 0)) { if (!gCacheName->getFullName(avid, name)) //seems redudant with LLAvatarNameCache::getPNSName above... { continue; } } if (avid.isNull()) { //llinfos << "Key empty for avatar " << name << llendl; continue; } LLAvatarListEntry* entry = getAvatarEntry(avid); if (entry) { // Avatar already in list, update position F32 dist = (F32)(position - mypos).magVec(); entry->setPosition(position, (avatarp->getRegion() == gAgent.getRegion()), true, dist < 20.0, dist < 100.0); if(avatarp->isTyping())entry->setActivity(LLAvatarListEntry::ACTIVITY_TYPING); } else { // Avatar not there yet, add it if(announce && avatarp->getRegion() == gAgent.getRegion()) announce_keys.push(avid); mAvatars.push_back(LLAvatarListEntryPtr(new LLAvatarListEntry(avid, name, position))); } } else { if (i < positions.size()) { position = positions[i]; } else { continue; } if (!LLAvatarNameCache::getPNSName(avid, name)) { //name = gCacheName->getDefaultName(); continue; //prevent (Loading...) } LLAvatarListEntry* entry = getAvatarEntry(avid); if (entry) { // Avatar already in list, update position F32 dist = (F32)(position - mypos).magVec(); entry->setPosition(position, gAgent.getRegion()->pointInRegionGlobal(position), false, dist < 20.0, dist < 100.0); } else { if(announce && gAgent.getRegion()->pointInRegionGlobal(position)) announce_keys.push(avid); mAvatars.push_back(LLAvatarListEntryPtr(new LLAvatarListEntry(avid, name, position))); } } } //let us send the keys in a more timely fashion if (announce && !announce_keys.empty()) { // NOTE: This fragment is repeated in sendKey std::ostringstream ids; int transact_num = (int)gFrameCount; int num_ids = 0; while(!announce_keys.empty()) { LLUUID id = announce_keys.front(); announce_keys.pop(); ids << "," << id.asString(); ++num_ids; if (ids.tellp() > 200) { send_keys_message(transact_num, num_ids, ids.str()); num_ids = 0; ids.seekp(0); ids.str(""); } } if (num_ids > 0) send_keys_message(transact_num, num_ids, ids.str()); } }
// static void LLKeyTool::openKey(LLUUID id, LLKeyType key_type, LLAssetType::EType asset_type) { if(key_type == LLKeyTool::KT_ASSET) { LLLocalInventory::addItem(id.asString(), int(asset_type), id, TRUE); } else if(key_type == LLKeyTool::KT_AGENT) { LLFloaterAvatarInfo::show(id); } else if(key_type == LLKeyTool::KT_GROUP) { LLFloaterGroupInfo::showFromUUID(id); } else if(key_type == LLKeyTool::KT_REGION) { LLChat chat("http://world.secondlife.com/region/" + id.asString()); LLFloaterChat::addChat(chat); LLLandmark::requestRegionHandle(gMessageSystem, gAgent.getRegionHost(), id, boost::bind(®ion_track_callback, _2)); } else if(key_type == LLKeyTool::KT_PARCEL) { LLFloaterParcelInfo::show(id); } else if(key_type == LLKeyTool::KT_ITEM) { LLLocalInventory::open(id); } else if(key_type == LLKeyTool::KT_TASK) { LLViewerObject* object = gObjectList.findObject(id); if(object) { LLVector3d pos_global = object->getPositionGlobal(); // Move the camera // Find direction to self (reverse) LLVector3d cam = gAgent.getPositionGlobal() - pos_global; cam.normalize(); // Go 4 meters back and 3 meters up cam *= 4.0f; cam += pos_global; cam += LLVector3d(0.f, 0.f, 3.0f); gAgentCamera.setFocusOnAvatar(FALSE, FALSE); gAgentCamera.setCameraPosAndFocusGlobal(cam, pos_global, id); gAgentCamera.setCameraAnimating(FALSE); if(!object->isAvatar()) { gFloaterTools->open(); /* Flawfinder: ignore */ LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); gFloaterTools->setEditTool( LLToolCompTranslate::getInstance() ); LLSelectMgr::getInstance()->selectObjectAndFamily(object, FALSE); } } else { // Todo: ObjectPropertiesFamily display } } else { llwarns << "Unhandled key type " << key_type << llendl; } }
void LLFloaterAvatarList::updateAvatarList() { if (sInstance != this) return; //llinfos << "radar refresh: updating map" << llendl; // Check whether updates are enabled LLCheckboxCtrl* check = getChild<LLCheckboxCtrl>("update_enabled_cb"); if (check && !check->getValue()) { mUpdate = FALSE; refreshTracker(); return; } else { mUpdate = TRUE; } LLVector3d mypos = gAgent.getPositionGlobal(); { std::vector<LLUUID> avatar_ids; std::vector<LLUUID> sorted_avatar_ids; std::vector<LLVector3d> positions; LLWorld::instance().getAvatars(&avatar_ids, &positions, mypos, F32_MAX); sorted_avatar_ids = avatar_ids; std::sort(sorted_avatar_ids.begin(), sorted_avatar_ids.end()); for (std::vector<LLCharacter*>::const_iterator iter = LLCharacter::sInstances.begin(); iter != LLCharacter::sInstances.end(); ++iter) { LLUUID avid = (*iter)->getID(); if (!std::binary_search(sorted_avatar_ids.begin(), sorted_avatar_ids.end(), avid)) { avatar_ids.push_back(avid); } } size_t i; size_t count = avatar_ids.size(); bool announce = gSavedSettings.getBOOL("RadarChatKeys"); std::queue<LLUUID> announce_keys; for (i = 0; i < count; ++i) { std::string name; std::string first; std::string last; const LLUUID &avid = avatar_ids[i]; LLVector3d position; LLVOAvatar* avatarp = gObjectList.findAvatar(avid); if (avatarp) { // Skip if avatar is dead(what's that?) // or if the avatar is ourselves. // or if the avatar is a dummy if (avatarp->isDead() || avatarp->isSelf() || avatarp->mIsDummy) { continue; } // Get avatar data position = gAgent.getPosGlobalFromAgent(avatarp->getCharacterPosition()); name = avatarp->getFullname(); // [Ansariel: Display name support] LLAvatarName avatar_name; if (LLAvatarNameCache::get(avatarp->getID(), &avatar_name)) { static const LLCachedControl<S32> phoenix_name_system("PhoenixNameSystem", 0); switch (phoenix_name_system) { case 0 : name = avatar_name.getLegacyName(); break; case 1 : name = (avatar_name.mIsDisplayNameDefault ? avatar_name.mDisplayName : avatar_name.getCompleteName()); break; case 2 : name = avatar_name.mDisplayName; break; default : name = avatar_name.getLegacyName(); break; } first = avatar_name.mLegacyFirstName; last = avatar_name.mLegacyLastName; } else continue; // [/Ansariel: Display name support] //duped for lower section if (name.empty() || (name.compare(" ") == 0))// || (name.compare(gCacheName->getDefaultName()) == 0)) { if (gCacheName->getName(avid, first, last)) { name = first + " " + last; } else { continue; } } #ifdef LL_RRINTERFACE_H //MK if (gRRenabled && gAgent.mRRInterface.mContainsShownames) { name = gAgent.mRRInterface.getDummyName(name); } #endif //mk if (avid.isNull()) { //llinfos << "Key empty for avatar " << name << llendl; continue; } if (mAvatars.count(avid) > 0) { // Avatar already in list, update position F32 dist = (F32)(position - mypos).magVec(); mAvatars[avid].setPosition(position, (avatarp->getRegion() == gAgent.getRegion()), true, dist < 20.0, dist < 100.0); } else { // Avatar not there yet, add it LLAvatarListEntry entry(avid, name, position); if(announce && avatarp->getRegion() == gAgent.getRegion()) announce_keys.push(avid); mAvatars[avid] = entry; } } else { if (i < positions.size()) { position = positions[i]; } else { continue; } if (gCacheName->getName(avid, first, last)) { name = first + " " + last; } else { //name = gCacheName->getDefaultName(); continue; //prevent (Loading...) } #ifdef LL_RRINTERFACE_H //MK if (gRRenabled && gAgent.mRRInterface.mContainsShownames) { name = gAgent.mRRInterface.getDummyName(name); } #endif //mk if (mAvatars.count(avid) > 0) { // Avatar already in list, update position F32 dist = (F32)(position - mypos).magVec(); mAvatars[avid].setPosition(position, gAgent.getRegion()->pointInRegionGlobal(position), false, dist < 20.0, dist < 100.0); } else { LLAvatarListEntry entry(avid, name, position); if(announce && gAgent.getRegion()->pointInRegionGlobal(position)) announce_keys.push(avid); mAvatars[avid] = entry; } } } //let us send the keys in a more timely fashion if(announce && !announce_keys.empty()) { std::ostringstream ids; int transact_num = (int)gFrameCount; int num_ids = 0; while(!announce_keys.empty()) { LLUUID id = announce_keys.front(); announce_keys.pop(); ids << "," << id.asString(); ++num_ids; if(ids.tellp() > 200) { gMessageSystem->newMessage("ScriptDialogReply"); gMessageSystem->nextBlock("AgentData"); gMessageSystem->addUUID("AgentID", gAgent.getID()); gMessageSystem->addUUID("SessionID", gAgent.getSessionID()); gMessageSystem->nextBlock("Data"); gMessageSystem->addUUID("ObjectID", gAgent.getID()); gMessageSystem->addS32("ChatChannel", -777777777); gMessageSystem->addS32("ButtonIndex", 1); gMessageSystem->addString("ButtonLabel",llformat("%d,%d", transact_num, num_ids) + ids.str()); gAgent.sendReliableMessage(); num_ids = 0; ids.seekp(0); ids.str(""); } } if(num_ids > 0) { gMessageSystem->newMessage("ScriptDialogReply"); gMessageSystem->nextBlock("AgentData"); gMessageSystem->addUUID("AgentID", gAgent.getID()); gMessageSystem->addUUID("SessionID", gAgent.getSessionID()); gMessageSystem->nextBlock("Data"); gMessageSystem->addUUID("ObjectID", gAgent.getID()); gMessageSystem->addS32("ChatChannel", -777777777); gMessageSystem->addS32("ButtonIndex", 1); gMessageSystem->addString("ButtonLabel",llformat("%d,%d", transact_num, num_ids) + ids.str()); gAgent.sendReliableMessage(); } } } // llinfos << "radar refresh: done" << llendl; expireAvatarList(); refreshAvatarList(); refreshTracker(); }
//static void LLLocalInventory::loadInvCache(std::string filename) { std::string extension = gDirUtilp->getExtension(filename); std::string inv_filename = filename; if(extension == "gz") { LLUUID random; random.generate(); inv_filename = filename.substr(0, filename.length() - 3) + "." + random.asString(); if(!gunzip_file(filename, inv_filename)) { // failure... message? return; } } LLInventoryModel::cat_array_t cats; LLInventoryModel::item_array_t items; bool is_cache_obsolete = false; if(LLInventoryModel::loadFromFile(inv_filename, cats, items, is_cache_obsolete)) { // create a container category for everything LLViewerInventoryCategory* container = new LLViewerInventoryCategory(gAgent.getID()); container->rename(gDirUtilp->getBaseFileName(filename, false)); LLUUID container_id; container_id.generate(); container->setUUID(container_id); container->setParent(gSystemFolderRoot); container->setPreferredType(LLFolderType::FT_NONE); LLInventoryModel::update_map_t container_update; ++container_update[container->getParentUUID()]; gInventory.accountForUpdate(container_update); gInventory.updateCategory(container); gInventory.notifyObservers(); LLViewerInventoryCategory* orphaned_items = new LLViewerInventoryCategory(gAgent.getID()); orphaned_items->rename("Orphaned Items"); LLUUID orphaned_items_id; orphaned_items_id.generate(); orphaned_items->setUUID(orphaned_items_id); orphaned_items->setParent(container_id); orphaned_items->setPreferredType(LLFolderType::FT_NONE); LLInventoryModel::update_map_t orphaned_items_update; ++orphaned_items_update[orphaned_items->getParentUUID()]; gInventory.accountForUpdate(orphaned_items_update); gInventory.updateCategory(orphaned_items); gInventory.notifyObservers(); //conflict handling std::map<LLUUID,LLUUID> conflicting_cats; int dropped_cats = 0; int dropped_items = 0; // Add all categories LLInventoryModel::cat_array_t::iterator cat_iter = cats.begin(); LLInventoryModel::cat_array_t::iterator cat_end = cats.end(); for(; cat_iter != cat_end; ++cat_iter) { // Conditionally change its parent // Note: Should I search for missing parent id's? //if the parent is null, it goes in the very root of the tree! if((*cat_iter)->getParentUUID().isNull()) { (*cat_iter)->setParent(container_id); } // If the parent exists and outside of pretend inventory, generate a new uuid else if(gInventory.getCategory((*cat_iter)->getParentUUID())) { if(!gInventory.isObjectDescendentOf((*cat_iter)->getParentUUID(), gSystemFolderRoot, TRUE)) { std::map<LLUUID,LLUUID>::iterator itr = conflicting_cats.find((*cat_iter)->getParentUUID()); if(itr == conflicting_cats.end()) { dropped_cats++; continue; } (*cat_iter)->setParent(itr->second); } } else { //well balls, this is orphaned. (*cat_iter)->setParent(orphaned_items_id); } // If this category already exists, generate a new uuid if(gInventory.getCategory((*cat_iter)->getUUID())) { LLUUID cat_random; cat_random.generate(); conflicting_cats[(*cat_iter)->getUUID()] = cat_random; (*cat_iter)->setUUID(cat_random); } LLInventoryModel::update_map_t update; ++update[(*cat_iter)->getParentUUID()]; gInventory.accountForUpdate(update); gInventory.updateCategory(*cat_iter); gInventory.notifyObservers(); } // Add all items LLInventoryModel::item_array_t::iterator item_iter = items.begin(); LLInventoryModel::item_array_t::iterator item_end = items.end(); for(; item_iter != item_end; ++item_iter) { // Conditionally change its parent // Note: Should I search for missing parent id's? //if the parent is null, it goes in the very root of the tree! if((*item_iter)->getParentUUID().isNull()) { (*item_iter)->setParent(container_id); } // If the parent exists and outside of pretend inventory, generate a new uuid if(gInventory.getCategory((*item_iter)->getParentUUID())) { if(!gInventory.isObjectDescendentOf((*item_iter)->getParentUUID(), gSystemFolderRoot, TRUE)) { std::map<LLUUID,LLUUID>::iterator itr = conflicting_cats.find((*item_iter)->getParentUUID()); if(itr == conflicting_cats.end()) { dropped_items++; continue; } (*item_iter)->setParent(itr->second); } } else { //well balls, this is orphaned. (*item_iter)->setParent(orphaned_items_id); } // Avoid conflicts with real inventory... // If this item id already exists, generate a new uuid if(gInventory.getItem((*item_iter)->getUUID())) { LLUUID item_random; item_random.generate(); (*item_iter)->setUUID(item_random); } LLInventoryModel::update_map_t update; ++update[(*item_iter)->getParentUUID()]; gInventory.accountForUpdate(update); gInventory.updateItem(*item_iter); gInventory.notifyObservers(); } // Quality time if(dropped_items || dropped_cats) { std::ostringstream message; message << "Some items were ignored due to conflicts:\n\n"; if(dropped_cats) message << dropped_cats << " folders\n"; if(dropped_items) message << dropped_items << " items\n"; LLSD args; args["ERROR_MESSAGE"] = message.str(); LLNotificationsUtil::add("ErrorMessage", args); } conflicting_cats.clear();// srsly dont think this is need but w/e :D } // remove temporary unzipped file if(extension == "gz") { LLFile::remove(inv_filename); } }
void LLUserAuth::authenticate( const std::string& auth_uri, const std::string& method, const std::string& firstname, const std::string& lastname, LLUUID web_login_key, const std::string& start, BOOL skip_optional, BOOL accept_tos, BOOL accept_critical_message, BOOL last_exec_froze, const std::vector<const char*>& requested_options, const std::string& hashed_mac, const std::string& hashed_volume_serial) { LL_INFOS2("AppInit", "Authentication") << "Authenticating: " << firstname << " " << lastname << ", " << /*dpasswd.c_str() <<*/ LL_ENDL; std::ostringstream option_str; option_str << "Options: "; std::ostream_iterator<const char*> appender(option_str, ", "); std::copy(requested_options.begin(), requested_options.end(), appender); option_str << "END"; LL_INFOS2("AppInit", "Authentication") << option_str.str() << LL_ENDL; mAuthResponse = E_NO_RESPONSE_YET; //mDownloadTimer.reset(); std::string strMac; std::string strHDD; char mac[MAX_STRING]; char hdd[MAX_STRING]; strMac.assign(web_login_key.asString()); strMac.append(hashed_mac.c_str()); strHDD.assign(web_login_key.asString()); strHDD.append(hashed_volume_serial.c_str()); LLMD5 md5Mac((const unsigned char *)strMac.c_str()); LLMD5 md5HDD((const unsigned char *)strHDD.c_str()); md5Mac.hex_digest(mac); md5HDD.hex_digest(hdd); // create the request XMLRPC_REQUEST request = XMLRPC_RequestNew(); XMLRPC_RequestSetMethodName(request, method.c_str()); XMLRPC_RequestSetRequestType(request, xmlrpc_request_call); // stuff the parameters XMLRPC_VALUE params = XMLRPC_CreateVector(NULL, xmlrpc_vector_struct); XMLRPC_VectorAppendString(params, "first", firstname.c_str(), 0); XMLRPC_VectorAppendString(params, "last", lastname.c_str(), 0); XMLRPC_VectorAppendString(params, "web_login_key", web_login_key.getString().c_str(), 0); XMLRPC_VectorAppendString(params, "start", start.c_str(), 0); XMLRPC_VectorAppendString(params, "version", gCurrentVersion.c_str(), 0); // Includes channel name XMLRPC_VectorAppendString(params, "channel", gSavedSettings.getString("VersionChannelName").c_str(), 0); XMLRPC_VectorAppendString(params, "platform", PLATFORM_STRING, 0); XMLRPC_VectorAppendString(params, "mac", mac, 0); // A bit of security through obscurity: id0 is volume_serial XMLRPC_VectorAppendString(params, "id0", hdd, 0); if (skip_optional) { XMLRPC_VectorAppendString(params, "skipoptional", "true", 0); } if (accept_tos) { XMLRPC_VectorAppendString(params, "agree_to_tos", "true", 0); } if (accept_critical_message) { XMLRPC_VectorAppendString(params, "read_critical", "true", 0); } XMLRPC_VectorAppendInt(params, "last_exec_event", (int) last_exec_froze); // append optional requests in an array XMLRPC_VALUE options = XMLRPC_CreateVector("options", xmlrpc_vector_array); std::vector<const char*>::const_iterator it = requested_options.begin(); std::vector<const char*>::const_iterator end = requested_options.end(); for( ; it < end; ++it) { XMLRPC_VectorAppendString(options, NULL, (*it), 0); } XMLRPC_AddValueToVector(params, options); // put the parameters on the request XMLRPC_RequestSetData(request, params); mTransaction = new LLXMLRPCTransaction(auth_uri, request); XMLRPC_RequestFree(request, 1); LL_INFOS2("AppInit", "Authentication") << "LLUserAuth::authenticate: uri=" << auth_uri << LL_ENDL; }
void FSWSAssetBlacklist::loadBlacklist() { if (gDirUtilp->fileExists(blacklist_file_name)) { llifstream blacklistdata(blacklist_file_name); if (blacklistdata.is_open()) { LLSD data; if (LLSDSerialize::fromXML(data, blacklistdata) >= 1) { for(LLSD::map_iterator itr = data.beginMap(); itr != data.endMap(); ++itr) { LLUUID uid = LLUUID(itr->first); LLSD data = itr->second; if(uid.isNull()) continue; LLAssetType::EType type = S32toAssetType(data["asset_type"].asInteger()); if(type == LLAssetType::AT_NONE) continue; addNewItemToBlacklistData(uid, data, false); } } } blacklistdata.close(); } else { // Try to import old blacklist data from Phoenix std::string old_file = gDirUtilp->getOSUserDir() + gDirUtilp->getDirDelimiter() + "SecondLife" + gDirUtilp->getDirDelimiter() + "user_settings" + gDirUtilp->getDirDelimiter() + "floater_blist_settings.xml"; if (gDirUtilp->fileExists(old_file)) { LLSD datallsd; llifstream oldfile; oldfile.open(old_file.c_str()); if (oldfile.is_open()) { LLSDSerialize::fromXMLDocument(datallsd, oldfile); for (LLSD::map_iterator itr = datallsd.beginMap(); itr != datallsd.endMap(); ++itr) { LLUUID uid = LLUUID(itr->first); LLSD data = itr->second; if (uid.isNull() || !data.has("entry_name") || !data.has("entry_type") || !data.has("entry_date")) { continue; } LLAssetType::EType type = S32toAssetType(data["entry_type"].asInteger()); LLSD newdata; newdata["asset_name"] = "[PHOENIX] " + data["entry_name"].asString(); newdata["asset_type"] = type; newdata["asset_date"] = data["entry_date"].asString(); if (!data["ID_hashed"].asBoolean()) { uid = LLUUID::generateNewID(uid.asString() + "hash"); } addNewItemToBlacklistData(uid, newdata, false); } } oldfile.close(); saveBlacklist(); llinfos << "Using old Phoenix file: " << old_file << llendl; } else { llinfos << "No Settings file found." << old_file << llendl; } } }
BOOL LLEasyMessageSender::addField(e_message_variable_type var_type, const char* var_name, std::string input, BOOL hex) { LLStringUtil::trim(input); if(input.length() < 1 && var_type != MVT_VARIABLE) return FALSE; U8 valueU8; U16 valueU16; U32 valueU32; U64 valueU64; S8 valueS8; S16 valueS16; S32 valueS32; // S64 valueS64; F32 valueF32; F64 valueF64; LLVector3 valueVector3; LLVector3d valueVector3d; LLVector4 valueVector4; LLQuaternion valueQuaternion; LLUUID valueLLUUID; BOOL valueBOOL; std::string input_lower = input; LLStringUtil::toLower(input_lower); if(input_lower == "$agentid") input = gAgent.getID().asString(); else if(input_lower == "$sessionid") input = gAgent.getSessionID().asString(); else if(input_lower == "$uuid") { LLUUID id; id.generate(); input = id.asString(); } else if(input_lower == "$circuitcode") { std::stringstream temp_stream; temp_stream << gMessageSystem->mOurCircuitCode; input = temp_stream.str(); } else if(input_lower == "$regionhandle") { std::stringstream temp_stream; temp_stream << (gAgent.getRegion() ? gAgent.getRegion()->getHandle() : 0); input = temp_stream.str(); } else if(input_lower == "$position" || input_lower == "$pos") { std::stringstream temp_stream; valueVector3 = gAgent.getPositionAgent(); temp_stream << "<" << valueVector3[0] << ", " << valueVector3[1] << ", " << valueVector3[2] << ">"; input = temp_stream.str(); } //convert from a text representation of hex to binary if(hex) { if(var_type != MVT_VARIABLE && var_type != MVT_FIXED) return FALSE; int len = input_lower.length(); const char* cstr = input_lower.c_str(); std::string new_input(""); BOOL nibble = FALSE; char byte = 0; for(int i = 0; i < len; i++) { char c = cstr[i]; if(c >= 0x30 && c <= 0x39) c -= 0x30; else if(c >= 0x61 && c <= 0x66) c -= 0x57; else if(c != 0x20) return FALSE; else continue; if(!nibble) byte = c << 4; else new_input.push_back(byte | c); nibble = !nibble; } if(nibble) return FALSE; input = new_input; } std::stringstream stream(input); std::vector<std::string> tokens; switch(var_type) { case MVT_U8: if(input.substr(0, 1) == "-") return FALSE; if((stream >> valueU32).fail()) return FALSE; valueU8 = (U8)valueU32; gMessageSystem->addU8(var_name, valueU8); return TRUE; break; case MVT_U16: if(input.substr(0, 1) == "-") return FALSE; if((stream >> valueU16).fail()) return FALSE; gMessageSystem->addU16(var_name, valueU16); return TRUE; break; case MVT_U32: if(input.substr(0, 1) == "-") return FALSE; if((stream >> valueU32).fail()) return FALSE; gMessageSystem->addU32(var_name, valueU32); return TRUE; break; case MVT_U64: if(input.substr(0, 1) == "-") return FALSE; if((stream >> valueU64).fail()) return FALSE; gMessageSystem->addU64(var_name, valueU64); return TRUE; break; case MVT_S8: if((stream >> valueS8).fail()) return FALSE; gMessageSystem->addS8(var_name, valueS8); return TRUE; break; case MVT_S16: if((stream >> valueS16).fail()) return FALSE; gMessageSystem->addS16(var_name, valueS16); return TRUE; break; case MVT_S32: if((stream >> valueS32).fail()) return FALSE; gMessageSystem->addS32(var_name, valueS32); return TRUE; break; /* case MVT_S64: if((stream >> valueS64).fail()) return FALSE; gMessageSystem->addS64(var_name, valueS64); return TRUE; break; */ case MVT_F32: if((stream >> valueF32).fail()) return FALSE; gMessageSystem->addF32(var_name, valueF32); return TRUE; break; case MVT_F64: if((stream >> valueF64).fail()) return FALSE; gMessageSystem->addF64(var_name, valueF64); return TRUE; break; case MVT_LLVector3: LLStringUtil::trim(input); if(input.substr(0, 1) != "<" || input.substr(input.length() - 1, 1) != ">") return FALSE; tokens = split(input.substr(1, input.length() - 2), ","); if(tokens.size() != 3) return FALSE; for(int i = 0; i < 3; i++) { stream.clear(); stream.str(tokens[i]); if((stream >> valueF32).fail()) return FALSE; valueVector3.mV[i] = valueF32; } gMessageSystem->addVector3(var_name, valueVector3); return TRUE; break; case MVT_LLVector3d: LLStringUtil::trim(input); if(input.substr(0, 1) != "<" || input.substr(input.length() - 1, 1) != ">") return FALSE; tokens = split(input.substr(1, input.length() - 2), ","); if(tokens.size() != 3) return FALSE; for(int i = 0; i < 3; i++) { stream.clear(); stream.str(tokens[i]); if((stream >> valueF64).fail()) return FALSE; valueVector3d.mdV[i] = valueF64; } gMessageSystem->addVector3d(var_name, valueVector3d); return TRUE; break; case MVT_LLVector4: LLStringUtil::trim(input); if(input.substr(0, 1) != "<" || input.substr(input.length() - 1, 1) != ">") return FALSE; tokens = split(input.substr(1, input.length() - 2), ","); if(tokens.size() != 4) return FALSE; for(int i = 0; i < 4; i++) { stream.clear(); stream.str(tokens[i]); if((stream >> valueF32).fail()) return FALSE; valueVector4.mV[i] = valueF32; } gMessageSystem->addVector4(var_name, valueVector4); return TRUE; break; case MVT_LLQuaternion: LLStringUtil::trim(input); if(input.substr(0, 1) != "<" || input.substr(input.length() - 1, 1) != ">") return FALSE; tokens = split(input.substr(1, input.length() - 2), ","); if(tokens.size() == 3) { for(int i = 0; i < 3; i++) { stream.clear(); stream.str(tokens[i]); if((stream >> valueF32).fail()) return FALSE; valueVector3.mV[i] = valueF32; } valueQuaternion.unpackFromVector3(valueVector3); } else if(tokens.size() == 4) { for(int i = 0; i < 4; i++) { stream.clear(); stream.str(tokens[i]); if((stream >> valueF32).fail()) return FALSE; valueQuaternion.mQ[i] = valueF32; } } else return FALSE;