From 067e6d2a831180cb4c900bc7fa56ec79cd4e4eb6 Mon Sep 17 00:00:00 2001 From: phr0z3nt04st Date: Tue, 6 Jul 2010 19:10:28 -0500 Subject: [PATCH] Added more information to inspect and fixed some bugs in the eavesdropping detection --- indra/newview/llfloateractivespeakers.cpp | 18 +++- indra/newview/llfloaterinspect.cpp | 96 ++++++++++++++++--- indra/newview/llfloaterinspect.h | 11 ++- indra/newview/llvoiceclient.cpp | 24 +++-- .../default/xui/en-us/floater_inspect.xml | 5 + 5 files changed, 131 insertions(+), 23 deletions(-) diff --git a/indra/newview/llfloateractivespeakers.cpp b/indra/newview/llfloateractivespeakers.cpp index 89b3af621..4eb4a2623 100644 --- a/indra/newview/llfloateractivespeakers.cpp +++ b/indra/newview/llfloateractivespeakers.cpp @@ -512,15 +512,23 @@ void LLPanelActiveSpeakers::refreshSpeakers() // if(!mShowTextChatters && !(speakerp->mStatus == LLSpeaker::STATUS_NOT_IN_CHANNEL) && speakerp->mID != gAgent.getID()) { - // let us check to see if they are actually in the sim - LLViewerRegion* regionp = gAgent.getRegion(); - if(regionp) + bool found = false; + for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); + iter != LLWorld::getInstance()->getRegionList().end(); ++iter) { - if(regionp->mMapAvatarIDs.find(speakerp->mID) == -1) + LLViewerRegion* regionp = *iter; + // let us check to see if they are actually in the sim + if(regionp) { - name_cell->setColor(LLColor4::red); + if(regionp->mMapAvatarIDs.find(speakerp->mID) != -1) + { + found = true; + break; + } } } + if(!found) + name_cell->setColor(LLColor4::red); } // diff --git a/indra/newview/llfloaterinspect.cpp b/indra/newview/llfloaterinspect.cpp index c6855d695..6bf39cd1f 100644 --- a/indra/newview/llfloaterinspect.cpp +++ b/indra/newview/llfloaterinspect.cpp @@ -212,7 +212,7 @@ void LLFloaterInspect::refresh() { LLSelectNode* obj = *iter; LLSD row; - std::string owner_name, creator_name, time; + std::string owner_name, creator_name, time, last_owner_name; if (obj->mCreationDate == 0) { // Don't have valid information from the server, so skip this one @@ -223,6 +223,9 @@ void LLFloaterInspect::refresh() timeToFormattedString(timestamp, gSavedSettings.getString("TimestampFormat"), time); gCacheName->getFullName(obj->mPermissions->getOwner(), owner_name); gCacheName->getFullName(obj->mPermissions->getCreator(), creator_name); + // + gCacheName->getFullName(obj->mPermissions->getLastOwner(), last_owner_name); + // row["id"] = obj->getObject()->getID(); row["columns"][0]["column"] = "object_name"; row["columns"][0]["type"] = "text"; @@ -236,15 +239,59 @@ void LLFloaterInspect::refresh() { row["columns"][0]["value"] = obj->mName; } - row["columns"][1]["column"] = "owner_name"; - row["columns"][1]["type"] = "text"; - row["columns"][1]["value"] = owner_name; - row["columns"][2]["column"] = "creator_name"; - row["columns"][2]["type"] = "text"; - row["columns"][2]["value"] = creator_name; - row["columns"][3]["column"] = "creation_date"; - row["columns"][3]["type"] = "text"; - row["columns"][3]["value"] = time; + // + int i = 1; + row["columns"][i]["column"] = "owner_name"; + row["columns"][i]["type"] = "text"; + row["columns"][i]["value"] = owner_name; + ++i; + row["columns"][i]["column"] = "last_owner_name"; + row["columns"][i]["type"] = "text"; + row["columns"][i]["value"] = last_owner_name; + ++i; + row["columns"][i]["column"] = "creator_name"; + row["columns"][i]["type"] = "text"; + row["columns"][i]["value"] = creator_name; + ++i; + row["columns"][i]["column"] = "face_num"; + row["columns"][i]["type"] = "text"; + row["columns"][i]["value"] = llformat("%d",obj->getObject()->getNumFaces()); + ++i; + row["columns"][i]["column"] = "vertex_num"; + row["columns"][i]["type"] = "text"; + row["columns"][i]["value"] = llformat("%d",obj->getObject()->getNumVertices()); + ++i; + // inventory silliness + S32 scripts,total_inv; + std::map >::iterator itr = mInventoryNums.find(obj->getObject()->getID()); + if(itr != mInventoryNums.end()) + { + scripts = itr->second.first; + total_inv = itr->second.second; + } + else + { + scripts = 0; + total_inv = 0; + if(std::find(mQueue.begin(),mQueue.end(),obj->getObject()->getID()) == mQueue.end()) + { + mQueue.push_back(obj->getObject()->getID()); + registerVOInventoryListener(obj->getObject(),NULL); + requestVOInventory(); + } + } + row["columns"][i]["column"] = "script_num"; + row["columns"][i]["type"] = "text"; + row["columns"][i]["value"] = llformat("%d",scripts); + ++i; + row["columns"][i]["column"] = "inv_num"; + row["columns"][i]["type"] = "text"; + row["columns"][i]["value"] = llformat("%d",total_inv); + ++i; + row["columns"][i]["column"] = "creation_date"; + row["columns"][i]["type"] = "text"; + row["columns"][i]["value"] = time; + // mObjectList->addElement(row, ADD_TOP); } if(selected_index > -1 && mObjectList->getItemIndex(selected_uuid) == selected_index) @@ -258,7 +305,31 @@ void LLFloaterInspect::refresh() onSelectObject(this, NULL); mObjectList->setScrollPos(pos); } - +// +void LLFloaterInspect::inventoryChanged(LLViewerObject* viewer_object, + InventoryObjectList* inv, + S32, + void* q_id) +{ + S32 scripts = 0; + std::vector::iterator iter = std::find(mQueue.begin(),mQueue.end(),viewer_object->getID()); + if (viewer_object && inv && iter != mQueue.end() ) + { + InventoryObjectList::const_iterator it = inv->begin(); + InventoryObjectList::const_iterator end = inv->end(); + for ( ; it != end; ++it) + { + if((*it)->getType() == LLAssetType::AT_LSL_TEXT) + { + scripts++; + } + } + mInventoryNums[viewer_object->getID()] = std::make_pair(scripts,inv->size()); + mQueue.erase(iter); + mDirty = TRUE; + } +} +// void LLFloaterInspect::onFocusReceived() { LLToolMgr::getInstance()->setTransientTool(LLToolCompInspect::getInstance()); @@ -269,6 +340,9 @@ void LLFloaterInspect::dirty() { if(sInstance) { + // + sInstance->mInventoryNums.clear(); + sInstance->mQueue.clear(); sInstance->setDirty(); } } diff --git a/indra/newview/llfloaterinspect.h b/indra/newview/llfloaterinspect.h index 57bba6864..b9d43358c 100644 --- a/indra/newview/llfloaterinspect.h +++ b/indra/newview/llfloaterinspect.h @@ -36,13 +36,14 @@ #define LL_LLFLOATERINSPECT_H #include "llfloater.h" +#include "llvoinventorylistener.h" //class LLTool; class LLObjectSelection; class LLScrollListCtrl; class LLUICtrl; -class LLFloaterInspect : public LLFloater +class LLFloaterInspect : public LLFloater, public LLVOInventoryListener { public: virtual ~LLFloaterInspect(void); @@ -63,12 +64,20 @@ protected: LLFloaterInspect(); void setDirty() { mDirty = TRUE; } bool mDirty; + // + /*virtual*/ void inventoryChanged(LLViewerObject* obj, + InventoryObjectList* inv, + S32 serial_num, + void* queue); private: // static data static LLFloaterInspect* sInstance; LLSafeHandle mObjectSelection; + // + std::map > mInventoryNums; // + std::vector mQueue; }; #endif //LL_LLFLOATERINSPECT_H diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index c713962d1..49aef02e6 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -75,6 +75,10 @@ // for MD5 hash #include "llmd5.h" +// +#include "llworld.h" +// + #define USE_SESSION_GROUPS 0 static bool sConnectingToAgni = false; @@ -4903,16 +4907,24 @@ LLVoiceClient::participantState *LLVoiceClient::sessionState::addParticipant(con // if(nameFromsipURI(uri) != gVoiceClient->mAccountName) { - // let us check to see if they are actually in the sim - LLViewerRegion* regionp = gAgent.getRegion(); - if(regionp) + bool found = true; + for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); + iter != LLWorld::getInstance()->getRegionList().end(); ++iter) { - if(regionp->mMapAvatarIDs.find(id) == -1) + LLViewerRegion* regionp = *iter; + // let us check to see if they are actually in the sim + if(regionp) { - // They are not in my list of people in my sim, they must be a spy. - gCacheName->getName(id, onAvatarNameLookup, NULL); + if(regionp->mMapAvatarIDs.find(id) != -1) + { + found = true; + break; + } } } + if(!found) + // They are not in my list of people in my sims, they must be a spy. + gCacheName->getName(id, onAvatarNameLookup, NULL); } // diff --git a/indra/newview/skins/default/xui/en-us/floater_inspect.xml b/indra/newview/skins/default/xui/en-us/floater_inspect.xml index fbb1133e4..5999dd549 100644 --- a/indra/newview/skins/default/xui/en-us/floater_inspect.xml +++ b/indra/newview/skins/default/xui/en-us/floater_inspect.xml @@ -9,7 +9,12 @@ top="-20"> + + + + +