From 297a292784b7458c704c4a086eb0206310ad7570 Mon Sep 17 00:00:00 2001 From: phr0z3nt04st Date: Mon, 14 Jun 2010 21:01:24 -0500 Subject: [PATCH] Added eavesdropping detection in voice and fixed empty filter crash. --- indra/newview/llfloatermessagelog.cpp | 2 +- indra/newview/llvoiceclient.cpp | 29 ++++++++++++++++++++++++++- indra/newview/llvoiceclient.h | 4 ++++ 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/indra/newview/llfloatermessagelog.cpp b/indra/newview/llfloatermessagelog.cpp index 2bdabde67..3a626018b 100644 --- a/indra/newview/llfloatermessagelog.cpp +++ b/indra/newview/llfloatermessagelog.cpp @@ -859,7 +859,7 @@ void LLFloaterMessageLog::startApplyingFilter(std::string filter, BOOL force) LLMessageLogFilter new_filter = LLMessageLogFilter(); sMessageLogFilterString = filter; new_filter.set(sMessageLogFilterString); - if(filter.at(filter.length()-1) != ' ') + if(!filter.length() || filter.at(filter.length()-1) != ' ') childSetText("filter_edit", filter + " "); if(force || (new_filter.mNegativeNames != sMessageLogFilter.mNegativeNames) diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 81ce1f4e8..d7127120c 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -2568,7 +2568,7 @@ void LLVoiceClient::sessionCreateSendMessage(sessionState *session, bool startAu if(!session->mHash.empty()) { stream - << "" << LLURI::escape(session->mHash, allowed_chars) << "" + << "" << LLURI::escape(session->mHash, allowed_chars) << "" << "SHA1UserName"; } @@ -4842,6 +4842,17 @@ LLVoiceClient::participantState::participantState(const std::string &uri) : { } +// +//static +void LLVoiceClient::sessionState::onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group, void* user_data) +{ + LLChat chat; + chat.mText = "Possible eavesdropping by "+ first +" "+ last +" detected"; + chat.mSourceType = CHAT_SOURCE_SYSTEM; + LLFloaterChat::addChat(chat); +} +// + LLVoiceClient::participantState *LLVoiceClient::sessionState::addParticipant(const std::string &uri) { participantState *result = NULL; @@ -4886,6 +4897,22 @@ LLVoiceClient::participantState *LLVoiceClient::sessionState::addParticipant(con if(result->updateMuteState()) mVolumeDirty = true; + // + if(nameFromsipURI(uri) != gVoiceClient->mAccountName) + { + // let us check to see if they are actually in the sim + LLViewerRegion* regionp = gAgent.getRegion(); + if(regionp) + { + if(regionp->mMapAvatarIDs.find(id) == -1) + { + // They are not in my list of people in my sim, they must be a spy. + gCacheName->getName(id, onAvatarNameLookup, NULL); + } + } + } + // + } else { diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h index acb9fff99..4f352c23c 100644 --- a/indra/newview/llvoiceclient.h +++ b/indra/newview/llvoiceclient.h @@ -299,6 +299,10 @@ static void updatePosition(void); sessionState(); ~sessionState(); + // + static void onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group, void* user_data); + // + participantState *addParticipant(const std::string &uri); // Note: after removeParticipant returns, the participant* that was passed to it will have been deleted. // Take care not to use the pointer again after that.