CHUI-268 (Transfer the common functionality from LLNearbyChat and LLIMFloater to LLIMConversation): moved appendMessage() to base class
parent
42dbf23dc5
commit
47fe3b48fe
|
|
@ -223,6 +223,46 @@ void LLIMConversation::onFocusLost()
|
|||
LLTransientDockableFloater::onFocusLost();
|
||||
}
|
||||
|
||||
std::string LLIMConversation::appendTime()
|
||||
{
|
||||
time_t utc_time;
|
||||
utc_time = time_corrected();
|
||||
std::string timeStr ="["+ LLTrans::getString("TimeHour")+"]:["
|
||||
+LLTrans::getString("TimeMin")+"]";
|
||||
|
||||
LLSD substitution;
|
||||
|
||||
substitution["datetime"] = (S32) utc_time;
|
||||
LLStringUtil::format (timeStr, substitution);
|
||||
|
||||
return timeStr;
|
||||
}
|
||||
|
||||
void LLIMConversation::appendMessage(const LLChat& chat, const LLSD &args)
|
||||
{
|
||||
LLChat& tmp_chat = const_cast<LLChat&>(chat);
|
||||
|
||||
if(tmp_chat.mTimeStr.empty())
|
||||
tmp_chat.mTimeStr = appendTime();
|
||||
|
||||
if (!chat.mMuted)
|
||||
{
|
||||
tmp_chat.mFromName = chat.mFromName;
|
||||
LLSD chat_args;
|
||||
if (args) chat_args = args;
|
||||
chat_args["use_plain_text_chat_history"] =
|
||||
gSavedSettings.getBOOL("PlainTextChatHistory");
|
||||
chat_args["show_time"] = gSavedSettings.getBOOL("IMShowTime");
|
||||
chat_args["show_names_for_p2p_conv"] =
|
||||
!mIsP2PChat || gSavedSettings.getBOOL("IMShowNamesForP2PConv");
|
||||
|
||||
if (mChatHistory)
|
||||
{
|
||||
mChatHistory->appendMessage(chat, chat_args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LLIMConversation::buildParticipantList()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -104,6 +104,11 @@ protected:
|
|||
/* virtual */ void onFocusLost();
|
||||
/* virtual */ void onFocusReceived();
|
||||
|
||||
// prepare chat's params and out one message to chatHistory
|
||||
void appendMessage(const LLChat& chat, const LLSD &args = 0);
|
||||
|
||||
std::string appendTime();
|
||||
|
||||
bool mIsNearbyChat;
|
||||
bool mIsP2PChat;
|
||||
|
||||
|
|
|
|||
|
|
@ -848,25 +848,6 @@ void LLIMFloater::sessionInitReplyReceived(const LLUUID& im_session_id)
|
|||
}
|
||||
}
|
||||
|
||||
void LLIMFloater::appendMessage(const LLChat& chat, const LLSD &args)
|
||||
{
|
||||
LLChat& tmp_chat = const_cast<LLChat&>(chat);
|
||||
|
||||
if (!chat.mMuted)
|
||||
{
|
||||
tmp_chat.mFromName = chat.mFromName;
|
||||
LLSD chat_args;
|
||||
if (args) chat_args = args;
|
||||
chat_args["use_plain_text_chat_history"] =
|
||||
gSavedSettings.getBOOL("PlainTextChatHistory");
|
||||
chat_args["show_time"] = gSavedSettings.getBOOL("IMShowTime");
|
||||
chat_args["show_names_for_p2p_conv"] = !mIsP2PChat
|
||||
|| gSavedSettings.getBOOL("IMShowNamesForP2PConv");
|
||||
|
||||
mChatHistory->appendMessage(chat, chat_args);
|
||||
}
|
||||
}
|
||||
|
||||
void LLIMFloater::updateMessages()
|
||||
{
|
||||
std::list<LLSD> messages;
|
||||
|
|
|
|||
|
|
@ -152,7 +152,6 @@ private:
|
|||
|
||||
BOOL isInviteAllowed() const;
|
||||
BOOL inviteToSession(const uuid_vec_t& agent_ids);
|
||||
void appendMessage(const LLChat& chat, const LLSD &args = 0);
|
||||
static void onInputEditorFocusReceived( LLFocusableElement* caller,void* userdata );
|
||||
static void onInputEditorFocusLost(LLFocusableElement* caller, void* userdata);
|
||||
static void onInputEditorKeystroke(LLTextEditor* caller, void* userdata);
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@
|
|||
|
||||
S32 LLNearbyChat::sLastSpecialChatChannel = 0;
|
||||
|
||||
// --- 2 functions in the global namespace :( ---
|
||||
// --- function in the global namespace :( ---
|
||||
bool isWordsName(const std::string& name)
|
||||
{
|
||||
// checking to see if it's display name plus username in parentheses
|
||||
|
|
@ -89,22 +89,6 @@ bool isWordsName(const std::string& name)
|
|||
}
|
||||
}
|
||||
|
||||
std::string appendTime()
|
||||
{
|
||||
time_t utc_time;
|
||||
utc_time = time_corrected();
|
||||
std::string timeStr ="["+ LLTrans::getString("TimeHour")+"]:["
|
||||
+LLTrans::getString("TimeMin")+"]";
|
||||
|
||||
LLSD substitution;
|
||||
|
||||
substitution["datetime"] = (S32) utc_time;
|
||||
LLStringUtil::format (timeStr, substitution);
|
||||
|
||||
return timeStr;
|
||||
}
|
||||
|
||||
|
||||
const S32 EXPANDED_HEIGHT = 266;
|
||||
const S32 COLLAPSED_HEIGHT = 60;
|
||||
const S32 EXPANDED_MIN_HEIGHT = 150;
|
||||
|
|
@ -129,6 +113,7 @@ LLNearbyChat::LLNearbyChat(const LLSD& llsd)
|
|||
mSpeakerMgr(NULL),
|
||||
mExpandedHeight(COLLAPSED_HEIGHT + EXPANDED_HEIGHT)
|
||||
{
|
||||
mIsP2PChat = false;
|
||||
mIsNearbyChat = true;
|
||||
setIsChrome(TRUE);
|
||||
mKey = LLSD();
|
||||
|
|
@ -604,31 +589,6 @@ void LLNearbyChat::sendChat( EChatType type )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void LLNearbyChat::appendMessage(const LLChat& chat, const LLSD &args)
|
||||
{
|
||||
LLChat& tmp_chat = const_cast<LLChat&>(chat);
|
||||
|
||||
if(tmp_chat.mTimeStr.empty())
|
||||
tmp_chat.mTimeStr = appendTime();
|
||||
|
||||
if (!chat.mMuted)
|
||||
{
|
||||
tmp_chat.mFromName = chat.mFromName;
|
||||
LLSD chat_args;
|
||||
if (args) chat_args = args;
|
||||
chat_args["use_plain_text_chat_history"] =
|
||||
gSavedSettings.getBOOL("PlainTextChatHistory");
|
||||
chat_args["show_time"] = gSavedSettings.getBOOL("IMShowTime");
|
||||
chat_args["show_names_for_p2p_conv"] = true;
|
||||
|
||||
if (mChatHistory)
|
||||
{
|
||||
mChatHistory->appendMessage(chat, chat_args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLNearbyChat::addMessage(const LLChat& chat,bool archive,const LLSD &args)
|
||||
{
|
||||
appendMessage(chat, args);
|
||||
|
|
|
|||
|
|
@ -108,8 +108,6 @@ protected:
|
|||
|
||||
private:
|
||||
|
||||
// prepare chat's params and out one message to chatHistory
|
||||
void appendMessage(const LLChat& chat, const LLSD &args = 0);
|
||||
void onNearbySpeakers ();
|
||||
|
||||
/*virtual*/ void refresh();
|
||||
|
|
|
|||
Loading…
Reference in New Issue