commit
1d4d4fec00
|
|
@ -61,7 +61,14 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id)
|
||||||
mLastMessageIndex(-1),
|
mLastMessageIndex(-1),
|
||||||
mDialog(IM_NOTHING_SPECIAL),
|
mDialog(IM_NOTHING_SPECIAL),
|
||||||
mChatHistory(NULL),
|
mChatHistory(NULL),
|
||||||
mInputEditor(NULL),
|
mInputEditor(NULL),
|
||||||
|
mSavedTitle(),
|
||||||
|
mTypingStart(),
|
||||||
|
mShouldSendTypingState(false),
|
||||||
|
mMeTyping(false),
|
||||||
|
mOtherTyping(false),
|
||||||
|
mTypingTimer(),
|
||||||
|
mTypingTimeoutTimer(),
|
||||||
mPositioned(false),
|
mPositioned(false),
|
||||||
mSessionInitialized(false)
|
mSessionInitialized(false)
|
||||||
{
|
{
|
||||||
|
|
@ -95,6 +102,7 @@ void LLIMFloater::onFocusReceived()
|
||||||
// virtual
|
// virtual
|
||||||
void LLIMFloater::onClose(bool app_quitting)
|
void LLIMFloater::onClose(bool app_quitting)
|
||||||
{
|
{
|
||||||
|
setTyping(false);
|
||||||
gIMMgr->leaveSession(mSessionID);
|
gIMMgr->leaveSession(mSessionID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -141,6 +149,7 @@ void LLIMFloater::onSendMsg( LLUICtrl* ctrl, void* userdata )
|
||||||
{
|
{
|
||||||
LLIMFloater* self = (LLIMFloater*) userdata;
|
LLIMFloater* self = (LLIMFloater*) userdata;
|
||||||
self->sendMsg();
|
self->sendMsg();
|
||||||
|
self->setTyping(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLIMFloater::sendMsg()
|
void LLIMFloater::sendMsg()
|
||||||
|
|
@ -228,12 +237,27 @@ BOOL LLIMFloater::postBuild()
|
||||||
LLLogChat::loadHistory(getTitle(), &chatFromLogFile, (void *)this);
|
LLLogChat::loadHistory(getTitle(), &chatFromLogFile, (void *)this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mTypingStart = LLTrans::getString("IM_typing_start_string");
|
||||||
|
|
||||||
//*TODO if session is not initialized yet, add some sort of a warning message like "starting session...blablabla"
|
//*TODO if session is not initialized yet, add some sort of a warning message like "starting session...blablabla"
|
||||||
//see LLFloaterIMPanel for how it is done (IB)
|
//see LLFloaterIMPanel for how it is done (IB)
|
||||||
|
|
||||||
return LLDockableFloater::postBuild();
|
return LLDockableFloater::postBuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// virtual
|
||||||
|
void LLIMFloater::draw()
|
||||||
|
{
|
||||||
|
if ( mMeTyping )
|
||||||
|
{
|
||||||
|
// Time out if user hasn't typed for a while.
|
||||||
|
if ( mTypingTimeoutTimer.getElapsedTimeF32() > LLAgent::TYPING_TIMEOUT_SECS )
|
||||||
|
{
|
||||||
|
setTyping(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LLFloater::draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
|
@ -402,7 +426,8 @@ void LLIMFloater::sessionInitReplyReceived(const LLUUID& im_session_id)
|
||||||
|
|
||||||
void LLIMFloater::updateMessages()
|
void LLIMFloater::updateMessages()
|
||||||
{
|
{
|
||||||
std::list<LLSD> messages = LLIMModel::instance().getMessages(mSessionID, mLastMessageIndex+1);
|
std::list<LLSD> messages;
|
||||||
|
LLIMModel::instance().getMessages(mSessionID, messages, mLastMessageIndex+1);
|
||||||
std::string agent_name;
|
std::string agent_name;
|
||||||
|
|
||||||
gCacheName->getFullName(gAgentID, agent_name);
|
gCacheName->getFullName(gAgentID, agent_name);
|
||||||
|
|
@ -450,7 +475,7 @@ void LLIMFloater::onInputEditorFocusReceived( LLFocusableElement* caller, void*
|
||||||
void LLIMFloater::onInputEditorFocusLost(LLFocusableElement* caller, void* userdata)
|
void LLIMFloater::onInputEditorFocusLost(LLFocusableElement* caller, void* userdata)
|
||||||
{
|
{
|
||||||
LLIMFloater* self = (LLIMFloater*) userdata;
|
LLIMFloater* self = (LLIMFloater*) userdata;
|
||||||
self->setTyping(FALSE);
|
self->setTyping(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
|
@ -460,19 +485,118 @@ void LLIMFloater::onInputEditorKeystroke(LLLineEditor* caller, void* userdata)
|
||||||
std::string text = self->mInputEditor->getText();
|
std::string text = self->mInputEditor->getText();
|
||||||
if (!text.empty())
|
if (!text.empty())
|
||||||
{
|
{
|
||||||
self->setTyping(TRUE);
|
self->setTyping(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Deleting all text counts as stopping typing.
|
// Deleting all text counts as stopping typing.
|
||||||
self->setTyping(FALSE);
|
self->setTyping(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LLIMFloater::setTyping(bool typing)
|
||||||
//just a stub for now
|
|
||||||
void LLIMFloater::setTyping(BOOL typing)
|
|
||||||
{
|
{
|
||||||
|
if ( typing )
|
||||||
|
{
|
||||||
|
// Started or proceeded typing, reset the typing timeout timer
|
||||||
|
mTypingTimeoutTimer.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( mMeTyping != typing )
|
||||||
|
{
|
||||||
|
// Typing state is changed
|
||||||
|
mMeTyping = typing;
|
||||||
|
// So, should send current state
|
||||||
|
mShouldSendTypingState = true;
|
||||||
|
// In case typing is started, send state after some delay
|
||||||
|
mTypingTimer.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Don't want to send typing indicators to multiple people, potentially too
|
||||||
|
// much network traffic. Only send in person-to-person IMs.
|
||||||
|
if ( mShouldSendTypingState && mDialog == IM_NOTHING_SPECIAL )
|
||||||
|
{
|
||||||
|
if ( mMeTyping )
|
||||||
|
{
|
||||||
|
if ( mTypingTimer.getElapsedTimeF32() > 1.f )
|
||||||
|
{
|
||||||
|
// Still typing, send 'start typing' notification
|
||||||
|
LLIMModel::instance().sendTypingState(mSessionID, mOtherParticipantUUID, TRUE);
|
||||||
|
mShouldSendTypingState = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Send 'stop typing' notification immediately
|
||||||
|
LLIMModel::instance().sendTypingState(mSessionID, mOtherParticipantUUID, FALSE);
|
||||||
|
mShouldSendTypingState = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
|
||||||
|
if (speaker_mgr)
|
||||||
|
speaker_mgr->setSpeakerTyping(gAgent.getID(), FALSE);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLIMFloater::processIMTyping(const LLIMInfo* im_info, BOOL typing)
|
||||||
|
{
|
||||||
|
if ( typing )
|
||||||
|
{
|
||||||
|
// other user started typing
|
||||||
|
addTypingIndicator(im_info);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// other user stopped typing
|
||||||
|
removeTypingIndicator(im_info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLIMFloater::addTypingIndicator(const LLIMInfo* im_info)
|
||||||
|
{
|
||||||
|
// We may have lost a "stop-typing" packet, don't add it twice
|
||||||
|
if ( im_info && !mOtherTyping )
|
||||||
|
{
|
||||||
|
mOtherTyping = true;
|
||||||
|
|
||||||
|
// Create typing is started title string
|
||||||
|
LLUIString typing_start(mTypingStart);
|
||||||
|
typing_start.setArg("[NAME]", im_info->mName);
|
||||||
|
|
||||||
|
// Save and set new title
|
||||||
|
mSavedTitle = getTitle();
|
||||||
|
setTitle (typing_start);
|
||||||
|
|
||||||
|
// Update speaker
|
||||||
|
LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
|
||||||
|
if ( speaker_mgr )
|
||||||
|
{
|
||||||
|
speaker_mgr->setSpeakerTyping(im_info->mFromID, TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLIMFloater::removeTypingIndicator(const LLIMInfo* im_info)
|
||||||
|
{
|
||||||
|
if ( mOtherTyping )
|
||||||
|
{
|
||||||
|
mOtherTyping = false;
|
||||||
|
|
||||||
|
// Revert the title to saved one
|
||||||
|
setTitle(mSavedTitle);
|
||||||
|
|
||||||
|
if ( im_info )
|
||||||
|
{
|
||||||
|
// Update speaker
|
||||||
|
LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID);
|
||||||
|
if ( speaker_mgr )
|
||||||
|
{
|
||||||
|
speaker_mgr->setSpeakerTyping(im_info->mFromID, FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLIMFloater::chatFromLogFile(LLLogChat::ELogLineType type, std::string line, void* userdata)
|
void LLIMFloater::chatFromLogFile(LLLogChat::ELogLineType type, std::string line, void* userdata)
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,8 @@ public:
|
||||||
// LLView overrides
|
// LLView overrides
|
||||||
/*virtual*/ BOOL postBuild();
|
/*virtual*/ BOOL postBuild();
|
||||||
/*virtual*/ void setVisible(BOOL visible);
|
/*virtual*/ void setVisible(BOOL visible);
|
||||||
|
// Check typing timeout timer.
|
||||||
|
/*virtual*/ void draw();
|
||||||
|
|
||||||
// LLFloater overrides
|
// LLFloater overrides
|
||||||
/*virtual*/ void onClose(bool app_quitting);
|
/*virtual*/ void onClose(bool app_quitting);
|
||||||
|
|
@ -85,6 +87,7 @@ public:
|
||||||
void setPositioned(bool b) { mPositioned = b; };
|
void setPositioned(bool b) { mPositioned = b; };
|
||||||
|
|
||||||
void onVisibilityChange(const LLSD& new_visibility);
|
void onVisibilityChange(const LLSD& new_visibility);
|
||||||
|
void processIMTyping(const LLIMInfo* im_info, BOOL typing);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// process focus events to set a currently active session
|
// process focus events to set a currently active session
|
||||||
|
|
@ -94,7 +97,7 @@ private:
|
||||||
static void onInputEditorFocusReceived( LLFocusableElement* caller, void* userdata );
|
static void onInputEditorFocusReceived( LLFocusableElement* caller, void* userdata );
|
||||||
static void onInputEditorFocusLost(LLFocusableElement* caller, void* userdata);
|
static void onInputEditorFocusLost(LLFocusableElement* caller, void* userdata);
|
||||||
static void onInputEditorKeystroke(LLLineEditor* caller, void* userdata);
|
static void onInputEditorKeystroke(LLLineEditor* caller, void* userdata);
|
||||||
void setTyping(BOOL typing);
|
void setTyping(bool typing);
|
||||||
void onSlide();
|
void onSlide();
|
||||||
static void* createPanelIMControl(void* userdata);
|
static void* createPanelIMControl(void* userdata);
|
||||||
static void* createPanelGroupControl(void* userdata);
|
static void* createPanelGroupControl(void* userdata);
|
||||||
|
|
@ -103,6 +106,11 @@ private:
|
||||||
|
|
||||||
static void chatFromLogFile(LLLogChat::ELogLineType type, std::string line, void* userdata);
|
static void chatFromLogFile(LLLogChat::ELogLineType type, std::string line, void* userdata);
|
||||||
|
|
||||||
|
// Add the "User is typing..." indicator.
|
||||||
|
void addTypingIndicator(const LLIMInfo* im_info);
|
||||||
|
|
||||||
|
// Remove the "User is typing..." indicator.
|
||||||
|
void removeTypingIndicator(const LLIMInfo* im_info = NULL);
|
||||||
|
|
||||||
LLPanelChatControlPanel* mControlPanel;
|
LLPanelChatControlPanel* mControlPanel;
|
||||||
LLUUID mSessionID;
|
LLUUID mSessionID;
|
||||||
|
|
@ -114,6 +122,14 @@ private:
|
||||||
LLLineEditor* mInputEditor;
|
LLLineEditor* mInputEditor;
|
||||||
bool mPositioned;
|
bool mPositioned;
|
||||||
|
|
||||||
|
std::string mSavedTitle;
|
||||||
|
LLUIString mTypingStart;
|
||||||
|
bool mMeTyping;
|
||||||
|
bool mOtherTyping;
|
||||||
|
bool mShouldSendTypingState;
|
||||||
|
LLFrameTimer mTypingTimer;
|
||||||
|
LLFrameTimer mTypingTimeoutTimer;
|
||||||
|
|
||||||
bool mSessionInitialized;
|
bool mSessionInitialized;
|
||||||
LLSD mQueuedMsgsForInit;
|
LLSD mQueuedMsgsForInit;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -272,7 +272,8 @@ void LLIMModel::testMessages()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LLIMModel::newSession(LLUUID session_id, std::string name, EInstantMessage type, LLUUID other_participant_id, const std::vector<LLUUID>& ids)
|
bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type,
|
||||||
|
const LLUUID& other_participant_id, const std::vector<LLUUID>& ids)
|
||||||
{
|
{
|
||||||
if (is_in_map(sSessionsMap, session_id))
|
if (is_in_map(sSessionsMap, session_id))
|
||||||
{
|
{
|
||||||
|
|
@ -289,7 +290,7 @@ bool LLIMModel::newSession(LLUUID session_id, std::string name, EInstantMessage
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LLIMModel::clearSession(LLUUID session_id)
|
bool LLIMModel::clearSession(const LLUUID& session_id)
|
||||||
{
|
{
|
||||||
if (sSessionsMap.find(session_id) == sSessionsMap.end()) return false;
|
if (sSessionsMap.find(session_id) == sSessionsMap.end()) return false;
|
||||||
delete (sSessionsMap[session_id]);
|
delete (sSessionsMap[session_id]);
|
||||||
|
|
@ -297,16 +298,13 @@ bool LLIMModel::clearSession(LLUUID session_id)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//*TODO remake it, instead of returing the list pass it as as parameter (IB)
|
void LLIMModel::getMessages(const LLUUID& session_id, std::list<LLSD>& messages, int start_index)
|
||||||
std::list<LLSD> LLIMModel::getMessages(LLUUID session_id, int start_index)
|
|
||||||
{
|
{
|
||||||
std::list<LLSD> return_list;
|
|
||||||
|
|
||||||
LLIMSession* session = findIMSession(session_id);
|
LLIMSession* session = findIMSession(session_id);
|
||||||
if (!session)
|
if (!session)
|
||||||
{
|
{
|
||||||
llwarns << "session " << session_id << "does not exist " << llendl;
|
llwarns << "session " << session_id << "does not exist " << llendl;
|
||||||
return return_list;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int i = session->mMsgs.size() - start_index;
|
int i = session->mMsgs.size() - start_index;
|
||||||
|
|
@ -317,7 +315,7 @@ std::list<LLSD> LLIMModel::getMessages(LLUUID session_id, int start_index)
|
||||||
{
|
{
|
||||||
LLSD msg;
|
LLSD msg;
|
||||||
msg = *iter;
|
msg = *iter;
|
||||||
return_list.push_back(*iter);
|
messages.push_back(*iter);
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -327,14 +325,9 @@ std::list<LLSD> LLIMModel::getMessages(LLUUID session_id, int start_index)
|
||||||
arg["session_id"] = session_id;
|
arg["session_id"] = session_id;
|
||||||
arg["num_unread"] = 0;
|
arg["num_unread"] = 0;
|
||||||
mNoUnreadMsgsSignal(arg);
|
mNoUnreadMsgsSignal(arg);
|
||||||
|
|
||||||
// TODO: in the future is there a more efficient way to return these
|
|
||||||
//of course there is - return as parameter (IB)
|
|
||||||
return return_list;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LLIMModel::addToHistory(LLUUID session_id, std::string from, LLUUID from_id, std::string utf8_text) {
|
bool LLIMModel::addToHistory(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, const std::string& utf8_text) {
|
||||||
|
|
||||||
LLIMSession* session = findIMSession(session_id);
|
LLIMSession* session = findIMSession(session_id);
|
||||||
|
|
||||||
|
|
@ -383,8 +376,8 @@ bool LLIMModel::logToFile(const LLUUID& session_id, const std::string& from, con
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//*TODO add const qualifier and pass by references (IB)
|
bool LLIMModel::addMessage(const LLUUID& session_id, const std::string& from, const LLUUID& from_id,
|
||||||
bool LLIMModel::addMessage(LLUUID session_id, std::string from, LLUUID from_id, std::string utf8_text, bool log2file /* = true */) {
|
const std::string& utf8_text, bool log2file /* = true */) {
|
||||||
LLIMSession* session = findIMSession(session_id);
|
LLIMSession* session = findIMSession(session_id);
|
||||||
|
|
||||||
if (!session)
|
if (!session)
|
||||||
|
|
@ -506,7 +499,7 @@ void LLIMModel::sendTypingState(LLUUID session_id, LLUUID other_participant_id,
|
||||||
gAgent.sendReliableMessage();
|
gAgent.sendReliableMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLIMModel::sendLeaveSession(LLUUID session_id, LLUUID other_participant_id)
|
void LLIMModel::sendLeaveSession(const LLUUID& session_id, const LLUUID& other_participant_id)
|
||||||
{
|
{
|
||||||
if(session_id.notNull())
|
if(session_id.notNull())
|
||||||
{
|
{
|
||||||
|
|
@ -1265,7 +1258,8 @@ void LLIMMgr::addMessage(
|
||||||
fixed_session_name = session_name;
|
fixed_session_name = session_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!LLIMModel::getInstance()->findIMSession(new_session_id))
|
bool new_session = !hasSession(session_id);
|
||||||
|
if (new_session)
|
||||||
{
|
{
|
||||||
LLIMModel::getInstance()->newSession(session_id, fixed_session_name, dialog, other_participant_id);
|
LLIMModel::getInstance()->newSession(session_id, fixed_session_name, dialog, other_participant_id);
|
||||||
}
|
}
|
||||||
|
|
@ -1284,15 +1278,16 @@ void LLIMMgr::addMessage(
|
||||||
// create IM window as necessary
|
// create IM window as necessary
|
||||||
if(!floater)
|
if(!floater)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
floater = createFloater(
|
floater = createFloater(
|
||||||
new_session_id,
|
new_session_id,
|
||||||
other_participant_id,
|
other_participant_id,
|
||||||
fixed_session_name,
|
fixed_session_name,
|
||||||
dialog,
|
dialog,
|
||||||
FALSE);
|
FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (new_session)
|
||||||
|
{
|
||||||
// When we get a new IM, and if you are a god, display a bit
|
// When we get a new IM, and if you are a god, display a bit
|
||||||
// of information about the source. This is to help liaisons
|
// of information about the source. This is to help liaisons
|
||||||
// when answering questions.
|
// when answering questions.
|
||||||
|
|
@ -1302,7 +1297,7 @@ void LLIMMgr::addMessage(
|
||||||
std::ostringstream bonus_info;
|
std::ostringstream bonus_info;
|
||||||
bonus_info << LLTrans::getString("***")+ " "+ LLTrans::getString("IMParentEstate") + ":" + " "
|
bonus_info << LLTrans::getString("***")+ " "+ LLTrans::getString("IMParentEstate") + ":" + " "
|
||||||
<< parent_estate_id
|
<< parent_estate_id
|
||||||
<< ((parent_estate_id == 1) ? "," + LLTrans::getString("IMMainland") : "")
|
<< ((parent_estate_id == 1) ? "," + LLTrans::getString("IMMainland") : "")
|
||||||
<< ((parent_estate_id == 5) ? "," + LLTrans::getString ("IMTeen") : "");
|
<< ((parent_estate_id == 5) ? "," + LLTrans::getString ("IMTeen") : "");
|
||||||
|
|
||||||
// once we have web-services (or something) which returns
|
// once we have web-services (or something) which returns
|
||||||
|
|
@ -1405,10 +1400,7 @@ S32 LLIMMgr::getNumberOfUnreadIM()
|
||||||
S32 num = 0;
|
S32 num = 0;
|
||||||
for(it = LLIMModel::sSessionsMap.begin(); it != LLIMModel::sSessionsMap.end(); ++it)
|
for(it = LLIMModel::sSessionsMap.begin(); it != LLIMModel::sSessionsMap.end(); ++it)
|
||||||
{
|
{
|
||||||
if((*it).first != mBeingRemovedSessionID)
|
num += (*it).second->mNumUnread;
|
||||||
{
|
|
||||||
num += (*it).second->mNumUnread;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return num;
|
return num;
|
||||||
|
|
@ -1517,41 +1509,25 @@ bool LLIMMgr::leaveSession(const LLUUID& session_id)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This removes the panel referenced by the uuid, and then restores
|
// Removes data associated with a particular session specified by session_id
|
||||||
// internal consistency. The internal pointer is not deleted? Did you mean
|
void LLIMMgr::removeSession(const LLUUID& session_id)
|
||||||
// a pointer to the corresponding LLIMSession? Session data is cleared now.
|
|
||||||
// Put a copy of UUID to avoid problem when passed reference becames invalid
|
|
||||||
// if it has been come from the object removed in observer.
|
|
||||||
void LLIMMgr::removeSession(LLUUID session_id)
|
|
||||||
{
|
{
|
||||||
if (mBeingRemovedSessionID == session_id)
|
llassert_always(hasSession(session_id));
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
//*TODO remove this floater thing when Communicate Floater is being deleted (IB)
|
||||||
LLFloaterIMPanel* floater = findFloaterBySession(session_id);
|
LLFloaterIMPanel* floater = findFloaterBySession(session_id);
|
||||||
if(floater)
|
if(floater)
|
||||||
{
|
{
|
||||||
mFloaters.erase(floater->getHandle());
|
mFloaters.erase(floater->getHandle());
|
||||||
LLFloaterChatterBox::getInstance()->removeFloater(floater);
|
LLFloaterChatterBox::getInstance()->removeFloater(floater);
|
||||||
//mTabContainer->removeTabPanel(floater);
|
|
||||||
|
|
||||||
clearPendingInvitation(session_id);
|
|
||||||
clearPendingAgentListUpdates(session_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// for some purposes storing ID of a sessios that is being removed
|
clearPendingInvitation(session_id);
|
||||||
mBeingRemovedSessionID = session_id;
|
clearPendingAgentListUpdates(session_id);
|
||||||
notifyObserverSessionRemoved(session_id);
|
|
||||||
|
|
||||||
//if we don't clear session data on removing the session
|
|
||||||
//we can't use LLBottomTray as observer of session creation/delettion and
|
|
||||||
//creating chiclets only on session created even, we need to handle chiclets creation
|
|
||||||
//the same way as LLFloaterIMPanels were managed.
|
|
||||||
LLIMModel::getInstance()->clearSession(session_id);
|
LLIMModel::getInstance()->clearSession(session_id);
|
||||||
|
|
||||||
// now this session is completely removed
|
notifyObserverSessionRemoved(session_id);
|
||||||
mBeingRemovedSessionID.setNull();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLIMMgr::inviteToSession(
|
void LLIMMgr::inviteToSession(
|
||||||
|
|
@ -1991,6 +1967,12 @@ void LLIMMgr::processIMTypingCore(const LLIMInfo* im_info, BOOL typing)
|
||||||
{
|
{
|
||||||
floater->processIMTyping(im_info, typing);
|
floater->processIMTyping(im_info, typing);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LLIMFloater* im_floater = LLIMFloater::findInstance(session_id);
|
||||||
|
if ( im_floater )
|
||||||
|
{
|
||||||
|
im_floater->processIMTyping(im_info, typing);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class LLViewerChatterBoxSessionStartReply : public LLHTTPNode
|
class LLViewerChatterBoxSessionStartReply : public LLHTTPNode
|
||||||
|
|
|
||||||
|
|
@ -104,18 +104,35 @@ public:
|
||||||
boost::signals2::connection addNewMsgCallback( session_callback_t cb ) { return mNewMsgSignal.connect(cb); }
|
boost::signals2::connection addNewMsgCallback( session_callback_t cb ) { return mNewMsgSignal.connect(cb); }
|
||||||
boost::signals2::connection addNoUnreadMsgsCallback( session_callback_t cb ) { return mNoUnreadMsgsSignal.connect(cb); }
|
boost::signals2::connection addNoUnreadMsgsCallback( session_callback_t cb ) { return mNoUnreadMsgsSignal.connect(cb); }
|
||||||
|
|
||||||
bool newSession(LLUUID session_id, std::string name, EInstantMessage type, LLUUID other_participant_id,
|
/**
|
||||||
|
* Create new session object in a model
|
||||||
|
*/
|
||||||
|
bool newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id,
|
||||||
const std::vector<LLUUID>& ids = std::vector<LLUUID>());
|
const std::vector<LLUUID>& ids = std::vector<LLUUID>());
|
||||||
bool clearSession(LLUUID session_id);
|
|
||||||
std::list<LLSD> getMessages(LLUUID session_id, int start_index = 0);
|
|
||||||
|
|
||||||
bool addMessage(LLUUID session_id, std::string from, LLUUID other_participant_id, std::string utf8_text, bool log2file = true);
|
/**
|
||||||
bool addToHistory(LLUUID session_id, std::string from, LLUUID from_id, std::string utf8_text);
|
* Remove all session data associated with a session specified by session_id
|
||||||
|
*/
|
||||||
|
bool clearSession(const LLUUID& session_id);
|
||||||
|
|
||||||
bool logToFile(const LLUUID& session_id, const std::string& from, const std::string& utf8_text);
|
/**
|
||||||
|
* Populate supplied std::list with messages starting from index specified by start_index
|
||||||
|
*/
|
||||||
|
void getMessages(const LLUUID& session_id, std::list<LLSD>& messages, int start_index = 0);
|
||||||
|
|
||||||
//used to get the name of the session, for use as the title
|
/**
|
||||||
//currently just the other avatar name
|
* Add a message to an IM Model - the message is saved in a message store associated with a session specified by session_id
|
||||||
|
* and also saved into a file if log2file is specified.
|
||||||
|
* It sends new message signal for each added message.
|
||||||
|
*/
|
||||||
|
bool addMessage(const LLUUID& session_id, const std::string& from, const LLUUID& other_participant_id, const std::string& utf8_text, bool log2file = true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a session's name.
|
||||||
|
* For a P2P chat - it's an avatar's name,
|
||||||
|
* For a group chat - it's a group's name
|
||||||
|
* For an ad-hoc chat - is received from the server and is in a from of "<Avatar's name> conference"
|
||||||
|
*/
|
||||||
const std::string& getName(const LLUUID& session_id) const;
|
const std::string& getName(const LLUUID& session_id) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -150,7 +167,7 @@ public:
|
||||||
*/
|
*/
|
||||||
LLIMSpeakerMgr* getSpeakerManager(const LLUUID& session_id) const;
|
LLIMSpeakerMgr* getSpeakerManager(const LLUUID& session_id) const;
|
||||||
|
|
||||||
static void sendLeaveSession(LLUUID session_id, LLUUID other_participant_id);
|
static void sendLeaveSession(const LLUUID& session_id, const LLUUID& other_participant_id);
|
||||||
static bool sendStartSession(const LLUUID& temp_session_id, const LLUUID& other_participant_id,
|
static bool sendStartSession(const LLUUID& temp_session_id, const LLUUID& other_participant_id,
|
||||||
const std::vector<LLUUID>& ids, EInstantMessage dialog);
|
const std::vector<LLUUID>& ids, EInstantMessage dialog);
|
||||||
static void sendTypingState(LLUUID session_id, LLUUID other_participant_id, BOOL typing);
|
static void sendTypingState(LLUUID session_id, LLUUID other_participant_id, BOOL typing);
|
||||||
|
|
@ -158,6 +175,19 @@ public:
|
||||||
const LLUUID& other_participant_id, EInstantMessage dialog);
|
const LLUUID& other_participant_id, EInstantMessage dialog);
|
||||||
|
|
||||||
void testMessages();
|
void testMessages();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add message to a list of message associated with session specified by session_id
|
||||||
|
*/
|
||||||
|
bool addToHistory(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, const std::string& utf8_text);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save an IM message into a file
|
||||||
|
*/
|
||||||
|
//*TODO should also save uuid of a sender
|
||||||
|
bool logToFile(const LLUUID& session_id, const std::string& from, const std::string& utf8_text);
|
||||||
};
|
};
|
||||||
|
|
||||||
class LLIMSessionObserver
|
class LLIMSessionObserver
|
||||||
|
|
@ -297,10 +327,11 @@ public:
|
||||||
bool endCall(const LLUUID& session_id);
|
bool endCall(const LLUUID& session_id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// This removes the panel referenced by the uuid, and then
|
|
||||||
// restores internal consistency. The internal pointer is not
|
/**
|
||||||
// deleted.
|
* Remove data associated with a particular session specified by session_id
|
||||||
void removeSession(LLUUID session_id);
|
*/
|
||||||
|
void removeSession(const LLUUID& session_id);
|
||||||
|
|
||||||
// create a panel and update internal representation for
|
// create a panel and update internal representation for
|
||||||
// consistency. Returns the pointer, caller (the class instance
|
// consistency. Returns the pointer, caller (the class instance
|
||||||
|
|
@ -341,9 +372,6 @@ private:
|
||||||
|
|
||||||
LLSD mPendingInvitations;
|
LLSD mPendingInvitations;
|
||||||
LLSD mPendingAgentListUpdates;
|
LLSD mPendingAgentListUpdates;
|
||||||
// ID of a session that is being removed: observers are already told
|
|
||||||
// that this session is being removed, but it is still present in the sessions' map
|
|
||||||
LLUUID mBeingRemovedSessionID;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class LLIncomingCallDialog : public LLModalDialog
|
class LLIncomingCallDialog : public LLModalDialog
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,6 @@
|
||||||
#include "llconsole.h"
|
#include "llconsole.h"
|
||||||
#include "llinventorymodel.h"
|
#include "llinventorymodel.h"
|
||||||
#include "llnotify.h"
|
#include "llnotify.h"
|
||||||
#include "llimview.h"
|
|
||||||
#include "llgesturemgr.h"
|
#include "llgesturemgr.h"
|
||||||
|
|
||||||
#include "llinventorybridge.h"
|
#include "llinventorybridge.h"
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,6 @@
|
||||||
#include "llstatview.h"
|
#include "llstatview.h"
|
||||||
#include "llsurface.h"
|
#include "llsurface.h"
|
||||||
#include "llsurfacepatch.h"
|
#include "llsurfacepatch.h"
|
||||||
#include "llimview.h"
|
|
||||||
#include "lltexlayer.h"
|
#include "lltexlayer.h"
|
||||||
#include "lltextbox.h"
|
#include "lltextbox.h"
|
||||||
#include "lltexturecache.h"
|
#include "lltexturecache.h"
|
||||||
|
|
|
||||||
|
|
@ -264,10 +264,6 @@
|
||||||
<string name="TrackYourCamera">Track your camera</string>
|
<string name="TrackYourCamera">Track your camera</string>
|
||||||
<string name="ControlYourCamera">Control your camera</string>
|
<string name="ControlYourCamera">Control your camera</string>
|
||||||
|
|
||||||
<!-- IM -->
|
|
||||||
<string name="IM_logging_string">-- Instant message logging enabled --</string>
|
|
||||||
<string name="Unnamed">(Unnamed)</string>
|
|
||||||
|
|
||||||
<!-- Sim Access labels -->
|
<!-- Sim Access labels -->
|
||||||
<string name="SIM_ACCESS_PG">PG</string>
|
<string name="SIM_ACCESS_PG">PG</string>
|
||||||
<string name="SIM_ACCESS_MATURE">Mature</string>
|
<string name="SIM_ACCESS_MATURE">Mature</string>
|
||||||
|
|
@ -2884,7 +2880,11 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
|
||||||
Failed to start viewer
|
Failed to start viewer
|
||||||
</string>
|
</string>
|
||||||
|
|
||||||
<!-- IM system messages -->
|
<!-- IM system messages -->
|
||||||
|
<string name="IM_logging_string">-- Instant message logging enabled --</string>
|
||||||
|
<string name="IM_typing_start_string">[NAME] is typing...</string>
|
||||||
|
<string name="Unnamed">(Unnamed)</string>
|
||||||
|
|
||||||
<string name="ringing-im">
|
<string name="ringing-im">
|
||||||
Joining Voice Chat...
|
Joining Voice Chat...
|
||||||
</string>
|
</string>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue