Commit bd42fd13 authored by andreykproductengine's avatar andreykproductengine
Browse files

SL-11719 Fixed init of conversation log

parent 5ce0d626
......@@ -189,16 +189,6 @@ LLConversationLog::LLConversationLog() :
mAvatarNameCacheConnection(),
mLoggingEnabled(false)
{
if(gSavedPerAccountSettings.controlExists("KeepConversationLogTranscripts"))
{
LLControlVariable * keep_log_ctrlp = gSavedPerAccountSettings.getControl("KeepConversationLogTranscripts").get();
S32 log_mode = keep_log_ctrlp->getValue();
keep_log_ctrlp->getSignal()->connect(boost::bind(&LLConversationLog::enableLogging, this, _2));
if (log_mode > 0)
{
enableLogging(log_mode);
}
}
}
void LLConversationLog::enableLogging(S32 log_mode)
......@@ -443,6 +433,20 @@ bool LLConversationLog::moveLog(const std::string &originDirectory, const std::s
return true;
}
void LLConversationLog::initLoggingState()
{
if (gSavedPerAccountSettings.controlExists("KeepConversationLogTranscripts"))
{
LLControlVariable * keep_log_ctrlp = gSavedPerAccountSettings.getControl("KeepConversationLogTranscripts").get();
S32 log_mode = keep_log_ctrlp->getValue();
keep_log_ctrlp->getSignal()->connect(boost::bind(&LLConversationLog::enableLogging, this, _2));
if (log_mode > 0)
{
enableLogging(log_mode);
}
}
}
std::string LLConversationLog::getFileName()
{
std::string filename = "conversation";
......
......@@ -107,7 +107,7 @@ class LLConversation
* To distinguish two conversations with the same sessionID it's also needed to compare their creation date.
*/
class LLConversationLog : public LLParamSingleton<LLConversationLog>, LLIMSessionObserver
class LLConversationLog : public LLSingleton<LLConversationLog>, LLIMSessionObserver
{
LLSINGLETON(LLConversationLog);
public:
......@@ -147,6 +147,12 @@ class LLConversationLog : public LLParamSingleton<LLConversationLog>, LLIMSessio
bool getIsLoggingEnabled() { return mLoggingEnabled; }
bool isLogEmpty() { return mConversations.empty(); }
/**
* inits connection to per account settings,
* loads saved file and inits enabled state
*/
void initLoggingState();
/**
* constructs file name in which conversations log will be saved
* file name is conversation.log
......
......@@ -942,12 +942,6 @@ bool idle_startup()
LLFile::mkdir(gDirUtilp->getChatLogsDir());
LLFile::mkdir(gDirUtilp->getPerAccountChatLogsDir());
//Initialize conversation log only when chat log directories are ready
if (!LLConversationLog::instanceExists())
{
// Check existance since this part can be reached twice if login fails
LLConversationLog::initParamSingleton();
}
//good a place as any to create user windlight directories
std::string user_windlight_path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight", ""));
......@@ -1298,6 +1292,12 @@ bool idle_startup()
LLStartUp::initExperiences();
display_startup();
// If logging should be enebled, turns it on and loads history from disk
// Note: does not happen on init of singleton because preferences can use
// this instance without logging in
LLConversationLog::getInstance()->initLoggingState();
LLStartUp::setStartupState( STATE_MULTIMEDIA_INIT );
return FALSE;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment