summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdoc/contributions.txt2
-rwxr-xr-xindra/newview/llgiveinventory.cpp6
-rwxr-xr-xindra/newview/lllogchat.cpp108
-rwxr-xr-xindra/newview/lllogchat.h6
4 files changed, 52 insertions, 70 deletions
diff --git a/doc/contributions.txt b/doc/contributions.txt
index 240bce5719..7e8ab46b1a 100755
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -185,7 +185,6 @@ Ansariel Hiller
BUG-3764
STORM-1984
STORM-1979
- MAINT-4036
Aralara Rajal
Arare Chantilly
CHUIBUG-191
@@ -758,7 +757,6 @@ Kitty Barnett
STORM-1905
VWR-24217
STORM-1804
- MAINT-4036
Kolor Fall
Komiko Okamoto
Korvel Noh
diff --git a/indra/newview/llgiveinventory.cpp b/indra/newview/llgiveinventory.cpp
index b2fc41526e..813d2081ce 100755
--- a/indra/newview/llgiveinventory.cpp
+++ b/indra/newview/llgiveinventory.cpp
@@ -328,10 +328,8 @@ void LLGiveInventory::logInventoryOffer(const LLUUID& to_agent, const LLUUID &im
{
// Build a new format username or firstname_lastname for legacy names
// to use it for a history log filename.
- if (LLLogChat::buildIMP2PLogFilename(to_agent, LLStringUtil::null, full_name))
- {
- LLIMModel::instance().logToFile(full_name, LLTrans::getString("SECOND_LIFE"), im_session_id, LLTrans::getString("inventory_item_offered-im"));
- }
+ full_name = LLCacheName::buildUsername(full_name);
+ LLIMModel::instance().logToFile(full_name, LLTrans::getString("SECOND_LIFE"), im_session_id, LLTrans::getString("inventory_item_offered-im"));
}
}
}
diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp
index 743bb8973b..06e517a861 100755
--- a/indra/newview/lllogchat.cpp
+++ b/indra/newview/lllogchat.cpp
@@ -261,46 +261,6 @@ std::string LLLogChat::cleanFileName(std::string filename)
return filename;
}
-bool LLLogChat::buildIMP2PLogFilename(const LLUUID& idAgent, const std::string& strName, std::string& strFilename)
-{
- static LLCachedControl<bool> fLegacyFilenames(gSavedSettings, "UseLegacyIMLogNames", true);
-
- // If we have the name cached then we can simply return the username
- LLAvatarName avName;
- if (LLAvatarNameCache::get(idAgent, &avName))
- {
- if (!fLegacyFilenames)
- {
- strFilename = avName.getUserName();
- }
- else
- {
- strFilename = LLCacheName::cleanFullName(avName.getLegacyName());
- }
- return true;
- }
- else
- {
- // Try and get it from the legacy cache if we can
- std::string strLegacyName;
- if (gCacheName->getFullName(idAgent, strLegacyName))
- strLegacyName = strName;
-
- if (!fLegacyFilenames)
- {
- // If we don't have it cached 'strName' *should* be a legacy name (or a complete name) and we can construct a username from that
- strFilename = LLCacheName::buildUsername(strName);
- return strName != strFilename; // If the assumption above was wrong then the two will match which signals failure
- }
- else
- {
- // Strip any possible mention of a username
- strFilename = LLCacheName::buildLegacyName(strName);
- return (!strFilename.empty()); // Assume success as long as the filename isn't an empty string
- }
- }
-}
-
std::string LLLogChat::timestamp(bool withdate)
{
std::string timeStr;
@@ -610,6 +570,13 @@ void LLLogChat::findTranscriptFiles(std::string pattern, std::vector<std::string
LLFILE * filep = LLFile::fopen(fullname, "rb");
if (NULL != filep)
{
+ if(makeLogFileName("chat")== fullname)
+ {
+ //Add Nearby chat history to the list of transcriptions
+ list_of_transcriptions.push_back(gDirUtilp->add(dirname, filename));
+ LLFile::close(filep);
+ continue;
+ }
char buffer[LOG_RECALL_SIZE];
fseek(filep, 0, SEEK_END); // seek to end of file
@@ -782,34 +749,59 @@ void LLLogChat::deleteTranscripts()
// static
bool LLLogChat::isTranscriptExist(const LLUUID& avatar_id, bool is_group)
{
- std::string strFileName;
- if (!is_group)
- buildIMP2PLogFilename(avatar_id, LLStringUtil::null, strFileName);
- else
- gCacheName->getGroupName(avatar_id, strFileName);
+ std::vector<std::string> list_of_transcriptions;
+ LLLogChat::getListOfTranscriptFiles(list_of_transcriptions);
- std::string strFilePath = makeLogFileName(strFileName);
- if ( (!strFilePath.empty()) && (LLFile::isfile(strFilePath)) )
+ if (list_of_transcriptions.size() > 0)
{
- return true;
+ LLAvatarName avatar_name;
+ LLAvatarNameCache::get(avatar_id, &avatar_name);
+ std::string avatar_user_name = avatar_name.getAccountName();
+ if(!is_group)
+ {
+ std::replace(avatar_user_name.begin(), avatar_user_name.end(), '.', '_');
+ BOOST_FOREACH(std::string& transcript_file_name, list_of_transcriptions)
+ {
+ if (std::string::npos != transcript_file_name.find(avatar_user_name))
+ {
+ return true;
+ }
+ }
+ }
+ else
+ {
+ std::string file_name;
+ gCacheName->getGroupName(avatar_id, file_name);
+ file_name = makeLogFileName(file_name);
+ BOOST_FOREACH(std::string& transcript_file_name, list_of_transcriptions)
+ {
+ if (transcript_file_name == file_name)
+ {
+ return true;
+ }
+ }
+ }
+
}
- // If a dated file existed it'll return a valid path; otherwise, it returns the undated unverified path so we do need to check it
- strFilePath = oldLogFileName(strFileName);
- return (!strFilePath.empty()) && (LLFile::isfile(strFilePath));
+ return false;
}
bool LLLogChat::isNearbyTranscriptExist()
{
- std::string strFilePath = makeLogFileName("chat");
- if ( (!strFilePath.empty()) && (LLFile::isfile(strFilePath)) )
+ std::vector<std::string> list_of_transcriptions;
+ LLLogChat::getListOfTranscriptFiles(list_of_transcriptions);
+
+ std::string file_name;
+ file_name = makeLogFileName("chat");
+ BOOST_FOREACH(std::string& transcript_file_name, list_of_transcriptions)
{
- return true;
+ if (transcript_file_name == file_name)
+ {
+ return true;
+ }
}
-
- // If a dated file existed it'll return a valid path; otherwise, it returns the undated unverified path so we do need to check it
- strFilePath = oldLogFileName("chat");
- return (!strFilePath.empty()) && (LLFile::isfile(strFilePath));
+ return false;
}
//*TODO mark object's names in a special way so that they will be distinguishable form avatar name
diff --git a/indra/newview/lllogchat.h b/indra/newview/lllogchat.h
index d1dbf2d119..ca597599dd 100755
--- a/indra/newview/lllogchat.h
+++ b/indra/newview/lllogchat.h
@@ -92,12 +92,6 @@ public:
static std::string timestamp(bool withdate = false);
static std::string makeLogFileName(std::string(filename));
-
- /**
- * Attempts to build the correct IM P2P log filename for the specified agent UUID and agent name
- */
- static bool buildIMP2PLogFilename(const LLUUID& idAgent, const std::string& strName, std::string& strFilename);
-
/**
*Add functions to get old and non date stamped file names when needed
*/