aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llimpanel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llimpanel.cpp')
-rw-r--r--linden/indra/newview/llimpanel.cpp259
1 files changed, 158 insertions, 101 deletions
diff --git a/linden/indra/newview/llimpanel.cpp b/linden/indra/newview/llimpanel.cpp
index ae8bd4b..5e260ec 100644
--- a/linden/indra/newview/llimpanel.cpp
+++ b/linden/indra/newview/llimpanel.cpp
@@ -86,9 +86,9 @@ const U32 DEFAULT_RETRIES_COUNT = 3;
86// Statics 86// Statics
87// 87//
88// 88//
89static LLString sTitleString = "Instant Message with [NAME]"; 89static std::string sTitleString = "Instant Message with [NAME]";
90static LLString sTypingStartString = "[NAME]: ..."; 90static std::string sTypingStartString = "[NAME]: ...";
91static LLString sSessionStartString = "Starting session with [NAME] please wait."; 91static std::string sSessionStartString = "Starting session with [NAME] please wait.";
92 92
93LLVoiceChannel::voice_channel_map_t LLVoiceChannel::sVoiceChannelMap; 93LLVoiceChannel::voice_channel_map_t LLVoiceChannel::sVoiceChannelMap;
94LLVoiceChannel::voice_channel_map_uri_t LLVoiceChannel::sVoiceChannelURIMap; 94LLVoiceChannel::voice_channel_map_uri_t LLVoiceChannel::sVoiceChannelURIMap;
@@ -121,7 +121,7 @@ void session_starter_helper(
121 gAgent.buildFullname(name); 121 gAgent.buildFullname(name);
122 122
123 msg->addStringFast(_PREHASH_FromAgentName, name); 123 msg->addStringFast(_PREHASH_FromAgentName, name);
124 msg->addStringFast(_PREHASH_Message, LLString::null); 124 msg->addStringFast(_PREHASH_Message, LLStringUtil::null);
125 msg->addU32Fast(_PREHASH_ParentEstateID, 0); 125 msg->addU32Fast(_PREHASH_ParentEstateID, 0);
126 msg->addUUIDFast(_PREHASH_RegionID, LLUUID::null); 126 msg->addUUIDFast(_PREHASH_RegionID, LLUUID::null);
127 msg->addVector3Fast(_PREHASH_Position, gAgent.getPositionAgent()); 127 msg->addVector3Fast(_PREHASH_Position, gAgent.getPositionAgent());
@@ -342,7 +342,7 @@ void LLVoiceCallCapResponder::result(const LLSD& content)
342// 342//
343// LLVoiceChannel 343// LLVoiceChannel
344// 344//
345LLVoiceChannel::LLVoiceChannel(const LLUUID& session_id, const LLString& session_name) : 345LLVoiceChannel::LLVoiceChannel(const LLUUID& session_id, const std::string& session_name) :
346 mSessionID(session_id), 346 mSessionID(session_id),
347 mState(STATE_NO_CHANNEL_INFO), 347 mState(STATE_NO_CHANNEL_INFO),
348 mSessionName(session_name), 348 mSessionName(session_name),
@@ -373,8 +373,8 @@ LLVoiceChannel::~LLVoiceChannel()
373} 373}
374 374
375void LLVoiceChannel::setChannelInfo( 375void LLVoiceChannel::setChannelInfo(
376 const LLString& uri, 376 const std::string& uri,
377 const LLString& credentials) 377 const std::string& credentials)
378{ 378{
379 setURI(uri); 379 setURI(uri);
380 380
@@ -563,7 +563,7 @@ LLVoiceChannel* LLVoiceChannel::getChannelByID(const LLUUID& session_id)
563} 563}
564 564
565//static 565//static
566LLVoiceChannel* LLVoiceChannel::getChannelByURI(LLString uri) 566LLVoiceChannel* LLVoiceChannel::getChannelByURI(std::string uri)
567{ 567{
568 voice_channel_map_uri_t::iterator found_it = sVoiceChannelURIMap.find(uri); 568 voice_channel_map_uri_t::iterator found_it = sVoiceChannelURIMap.find(uri);
569 if (found_it == sVoiceChannelURIMap.end()) 569 if (found_it == sVoiceChannelURIMap.end())
@@ -584,7 +584,7 @@ void LLVoiceChannel::updateSessionID(const LLUUID& new_session_id)
584 sVoiceChannelMap.insert(std::make_pair(mSessionID, this)); 584 sVoiceChannelMap.insert(std::make_pair(mSessionID, this));
585} 585}
586 586
587void LLVoiceChannel::setURI(LLString uri) 587void LLVoiceChannel::setURI(std::string uri)
588{ 588{
589 sVoiceChannelURIMap.erase(mURI); 589 sVoiceChannelURIMap.erase(mURI);
590 mURI = uri; 590 mURI = uri;
@@ -654,7 +654,7 @@ void LLVoiceChannel::resume()
654// LLVoiceChannelGroup 654// LLVoiceChannelGroup
655// 655//
656 656
657LLVoiceChannelGroup::LLVoiceChannelGroup(const LLUUID& session_id, const LLString& session_name) : 657LLVoiceChannelGroup::LLVoiceChannelGroup(const LLUUID& session_id, const std::string& session_name) :
658 LLVoiceChannel(session_id, session_name) 658 LLVoiceChannel(session_id, session_name)
659{ 659{
660 mRetries = DEFAULT_RETRIES_COUNT; 660 mRetries = DEFAULT_RETRIES_COUNT;
@@ -701,8 +701,8 @@ void LLVoiceChannelGroup::getChannelInfo()
701} 701}
702 702
703void LLVoiceChannelGroup::setChannelInfo( 703void LLVoiceChannelGroup::setChannelInfo(
704 const LLString& uri, 704 const std::string& uri,
705 const LLString& credentials) 705 const std::string& credentials)
706{ 706{
707 setURI(uri); 707 setURI(uri);
708 708
@@ -795,7 +795,7 @@ void LLVoiceChannelGroup::handleError(EStatusType status)
795 { 795 {
796 LLNotifyBox::showXml(notify, mNotifyArgs); 796 LLNotifyBox::showXml(notify, mNotifyArgs);
797 // echo to im window 797 // echo to im window
798 gIMMgr->addMessage(mSessionID, LLUUID::null, SYSTEM_FROM, LLNotifyBox::getTemplateMessage(notify, mNotifyArgs).c_str()); 798 gIMMgr->addMessage(mSessionID, LLUUID::null, SYSTEM_FROM, LLNotifyBox::getTemplateMessage(notify, mNotifyArgs));
799 } 799 }
800 800
801 LLVoiceChannel::handleError(status); 801 LLVoiceChannel::handleError(status);
@@ -822,7 +822,7 @@ void LLVoiceChannelGroup::setState(EState state)
822// LLVoiceChannelProximal 822// LLVoiceChannelProximal
823// 823//
824LLVoiceChannelProximal::LLVoiceChannelProximal() : 824LLVoiceChannelProximal::LLVoiceChannelProximal() :
825 LLVoiceChannel(LLUUID::null, LLString::null) 825 LLVoiceChannel(LLUUID::null, LLStringUtil::null)
826{ 826{
827 activate(); 827 activate();
828} 828}
@@ -914,7 +914,7 @@ void LLVoiceChannelProximal::deactivate()
914// 914//
915// LLVoiceChannelP2P 915// LLVoiceChannelP2P
916// 916//
917LLVoiceChannelP2P::LLVoiceChannelP2P(const LLUUID& session_id, const LLString& session_name, const LLUUID& other_user_id) : 917LLVoiceChannelP2P::LLVoiceChannelP2P(const LLUUID& session_id, const std::string& session_name, const LLUUID& other_user_id) :
918 LLVoiceChannelGroup(session_id, session_name), 918 LLVoiceChannelGroup(session_id, session_name),
919 mOtherUserID(other_user_id), 919 mOtherUserID(other_user_id),
920 mReceivedCall(FALSE) 920 mReceivedCall(FALSE)
@@ -1000,7 +1000,7 @@ void LLVoiceChannelP2P::getChannelInfo()
1000} 1000}
1001 1001
1002// receiving session from other user who initiated call 1002// receiving session from other user who initiated call
1003void LLVoiceChannelP2P::setSessionHandle(const LLString& handle) 1003void LLVoiceChannelP2P::setSessionHandle(const std::string& handle)
1004{ 1004{
1005 BOOL needs_activate = FALSE; 1005 BOOL needs_activate = FALSE;
1006 if (callStarted()) 1006 if (callStarted())
@@ -1109,11 +1109,11 @@ LLFloaterIMPanel::LLFloaterIMPanel(
1109} 1109}
1110 1110
1111 1111
1112void LLFloaterIMPanel::init(const LLString& session_label) 1112void LLFloaterIMPanel::init(const std::string& session_label)
1113{ 1113{
1114 mSessionLabel = session_label; 1114 mSessionLabel = session_label;
1115 1115
1116 LLString xml_filename; 1116 std::string xml_filename;
1117 switch(mDialog) 1117 switch(mDialog)
1118 { 1118 {
1119 case IM_SESSION_GROUP_START: 1119 case IM_SESSION_GROUP_START:
@@ -1238,6 +1238,7 @@ BOOL LLFloaterIMPanel::postBuild()
1238 mInputEditor->setCallbackUserData(this); 1238 mInputEditor->setCallbackUserData(this);
1239 mInputEditor->setCommitOnFocusLost( FALSE ); 1239 mInputEditor->setCommitOnFocusLost( FALSE );
1240 mInputEditor->setRevertOnEsc( FALSE ); 1240 mInputEditor->setRevertOnEsc( FALSE );
1241 mInputEditor->setReplaceNewlinesWithSpaces( FALSE );
1241 1242
1242 childSetAction("profile_callee_btn", onClickProfile, this); 1243 childSetAction("profile_callee_btn", onClickProfile, this);
1243 childSetAction("group_info_btn", onClickGroupInfo, this); 1244 childSetAction("group_info_btn", onClickGroupInfo, this);
@@ -1246,6 +1247,7 @@ BOOL LLFloaterIMPanel::postBuild()
1246 childSetAction("end_call_btn", onClickEndCall, this); 1247 childSetAction("end_call_btn", onClickEndCall, this);
1247 childSetAction("send_btn", onClickSend, this); 1248 childSetAction("send_btn", onClickSend, this);
1248 childSetAction("toggle_active_speakers_btn", onClickToggleActiveSpeakers, this); 1249 childSetAction("toggle_active_speakers_btn", onClickToggleActiveSpeakers, this);
1250 childSetAction("offer_tp_btn", onClickOfferTeleport, this);
1249 1251
1250 childSetAction("moderator_kick_speaker", onKickSpeaker, this); 1252 childSetAction("moderator_kick_speaker", onKickSpeaker, this);
1251 //LLButton* close_btn = getChild<LLButton>("close_btn"); 1253 //LLButton* close_btn = getChild<LLButton>("close_btn");
@@ -1395,6 +1397,7 @@ void LLFloaterIMPanel::draw()
1395 childSetValue("mute_btn", LLMuteList::getInstance()->isMuted(mOtherParticipantUUID, LLMute::flagVoiceChat)); 1397 childSetValue("mute_btn", LLMuteList::getInstance()->isMuted(mOtherParticipantUUID, LLMute::flagVoiceChat));
1396 childSetVisible("mute_btn", LLVoiceClient::voiceEnabled() && mVoiceChannel->isActive()); 1398 childSetVisible("mute_btn", LLVoiceClient::voiceEnabled() && mVoiceChannel->isActive());
1397 } 1399 }
1400
1398 LLFloater::draw(); 1401 LLFloater::draw();
1399} 1402}
1400 1403
@@ -1460,7 +1463,7 @@ BOOL LLFloaterIMPanel::inviteToSession(const LLDynamicArray<LLUUID>& ids)
1460 return TRUE; 1463 return TRUE;
1461} 1464}
1462 1465
1463void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4& color, bool log_to_file, const LLUUID& source, const char *name) 1466void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4& color, bool log_to_file, const LLUUID& source, const std::string& name)
1464{ 1467{
1465 // start tab flashing when receiving im for background session from user 1468 // start tab flashing when receiving im for background session from user
1466 if (source != LLUUID::null) 1469 if (source != LLUUID::null)
@@ -1480,7 +1483,7 @@ void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4
1480 removeTypingIndicator(NULL); 1483 removeTypingIndicator(NULL);
1481 1484
1482 // Actually add the line 1485 // Actually add the line
1483 LLString timestring; 1486 std::string timestring;
1484 bool prepend_newline = true; 1487 bool prepend_newline = true;
1485 if (gSavedSettings.getBOOL("IMShowTimestamps")) 1488 if (gSavedSettings.getBOOL("IMShowTimestamps"))
1486 { 1489 {
@@ -1489,10 +1492,10 @@ void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4
1489 } 1492 }
1490 1493
1491 // 'name' is a sender name that we want to hotlink so that clicking on it opens a profile. 1494 // 'name' is a sender name that we want to hotlink so that clicking on it opens a profile.
1492 if (name != NULL) // If name exists, then add it to the front of the message. 1495 if (!name.empty()) // If name exists, then add it to the front of the message.
1493 { 1496 {
1494 // Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text. 1497 // Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text.
1495 if (!strcmp(name,SYSTEM_FROM)) 1498 if (name == SYSTEM_FROM)
1496 { 1499 {
1497 mHistoryEditor->appendColoredText(name,false,prepend_newline,color); 1500 mHistoryEditor->appendColoredText(name,false,prepend_newline,color);
1498 } 1501 }
@@ -1509,11 +1512,11 @@ void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4
1509 if (log_to_file 1512 if (log_to_file
1510 && gSavedPerAccountSettings.getBOOL("LogInstantMessages") ) 1513 && gSavedPerAccountSettings.getBOOL("LogInstantMessages") )
1511 { 1514 {
1512 LLString histstr; 1515 std::string histstr;
1513 if (gSavedPerAccountSettings.getBOOL("IMLogTimestamp")) 1516 if (gSavedPerAccountSettings.getBOOL("IMLogTimestamp"))
1514 histstr = LLLogChat::timestamp(gSavedPerAccountSettings.getBOOL("LogTimestampDate")) + LLString(name) + utf8msg; 1517 histstr = LLLogChat::timestamp(gSavedPerAccountSettings.getBOOL("LogTimestampDate")) + name + utf8msg;
1515 else 1518 else
1516 histstr = LLString(name) + utf8msg; 1519 histstr = name + utf8msg;
1517 1520
1518 LLLogChat::saveHistory(getTitle(),histstr); 1521 LLLogChat::saveHistory(getTitle(),histstr);
1519 } 1522 }
@@ -1603,17 +1606,54 @@ BOOL LLFloaterIMPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
1603 EDragAndDropType cargo_type, 1606 EDragAndDropType cargo_type,
1604 void* cargo_data, 1607 void* cargo_data,
1605 EAcceptance* accept, 1608 EAcceptance* accept,
1606 LLString& tooltip_msg) 1609 std::string& tooltip_msg)
1607{ 1610{
1608 BOOL accepted = FALSE; 1611 BOOL accepted = FALSE;
1609 switch(cargo_type) 1612 switch(cargo_type)
1610 { 1613 {
1611 case DAD_CALLINGCARD: 1614 case DAD_CALLINGCARD:
1612 accepted = dropCallingCard((LLInventoryItem*)cargo_data, drop); 1615 {
1613 break; 1616 accepted = dropCallingCard((LLInventoryItem*)cargo_data, drop);
1614 case DAD_CATEGORY: 1617 break;
1615 accepted = dropCategory((LLInventoryCategory*)cargo_data, drop); 1618 }
1616 break; 1619 case DAD_CATEGORY:
1620 {
1621 accepted = dropCategory((LLInventoryCategory*)cargo_data, drop);
1622 break;
1623 }
1624
1625 // See stdenums.h
1626 case DAD_TEXTURE:
1627 case DAD_SOUND:
1628 // DAD_CALLINGCARD above
1629 case DAD_LANDMARK:
1630 case DAD_SCRIPT:
1631 case DAD_CLOTHING:
1632 case DAD_OBJECT:
1633 case DAD_NOTECARD:
1634 // DAD_CATEGORY above
1635 case DAD_BODYPART:
1636 case DAD_ANIMATION:
1637 case DAD_GESTURE:
1638 {
1639 if (mDialog == IM_NOTHING_SPECIAL)
1640 {
1641 // See LLDropTarget for similar code.
1642 LLViewerInventoryItem* inv_item = (LLViewerInventoryItem*)cargo_data;
1643 if(gInventory.getItem(inv_item->getUUID())
1644 && LLToolDragAndDrop::isInventoryGiveAcceptable(inv_item))
1645 {
1646 accepted = true;
1647 if(drop)
1648 {
1649 LLToolDragAndDrop::giveInventory(mOtherParticipantUUID, inv_item);
1650 LLStringUtil::format_map_t args;
1651 gIMMgr->addSystemMessage(mSessionUUID, "inventory_item_offered", args);
1652 }
1653 }
1654 }
1655 break;
1656 }
1617 default: 1657 default:
1618 break; 1658 break;
1619 } 1659 }
@@ -1694,6 +1734,13 @@ void LLFloaterIMPanel::onTabClick(void* userdata)
1694 self->setInputFocus(TRUE); 1734 self->setInputFocus(TRUE);
1695} 1735}
1696 1736
1737// static
1738void LLFloaterIMPanel::onClickOfferTeleport(void* userdata)
1739{
1740 LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
1741
1742 handle_lure(self->mOtherParticipantUUID);
1743}
1697 1744
1698// static 1745// static
1699void LLFloaterIMPanel::onClickProfile( void* userdata ) 1746void LLFloaterIMPanel::onClickProfile( void* userdata )
@@ -1782,7 +1829,7 @@ void LLFloaterIMPanel::onInputEditorFocusLost(LLFocusableElement* caller, void*
1782void LLFloaterIMPanel::onInputEditorKeystroke(LLLineEditor* caller, void* userdata) 1829void LLFloaterIMPanel::onInputEditorKeystroke(LLLineEditor* caller, void* userdata)
1783{ 1830{
1784 LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata; 1831 LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata;
1785 LLString text = self->mInputEditor->getText(); 1832 std::string text = self->mInputEditor->getText();
1786 if (!text.empty()) 1833 if (!text.empty())
1787 { 1834 {
1788 self->setTyping(TRUE); 1835 self->setTyping(TRUE);
@@ -1808,8 +1855,8 @@ void LLFloaterIMPanel::onClose(bool app_quitting)
1808 FALSE, 1855 FALSE,
1809 gAgent.getSessionID(), 1856 gAgent.getSessionID(),
1810 mOtherParticipantUUID, 1857 mOtherParticipantUUID,
1811 name.c_str(), 1858 name,
1812 "", 1859 LLStringUtil::null,
1813 IM_ONLINE, 1860 IM_ONLINE,
1814 IM_SESSION_LEAVE, 1861 IM_SESSION_LEAVE,
1815 mSessionUUID); 1862 mSessionUUID);
@@ -1855,8 +1902,8 @@ void deliver_message(const std::string& utf8_text,
1855 FALSE, 1902 FALSE,
1856 gAgent.getSessionID(), 1903 gAgent.getSessionID(),
1857 other_participant_id, 1904 other_participant_id,
1858 name.c_str(), 1905 name,
1859 utf8_text.c_str(), 1906 utf8_text,
1860 offline, 1907 offline,
1861 (EInstantMessage)new_dialog, 1908 (EInstantMessage)new_dialog,
1862 im_session_id); 1909 im_session_id);
@@ -1888,8 +1935,6 @@ void deliver_message(const std::string& utf8_text,
1888 1935
1889void LLFloaterIMPanel::sendMsg() 1936void LLFloaterIMPanel::sendMsg()
1890{ 1937{
1891 LLWString text = mInputEditor->getWText();
1892 LLWString::trim(text);
1893 if (!gAgent.isGodlike() 1938 if (!gAgent.isGodlike()
1894 && (mDialog == IM_NOTHING_SPECIAL) 1939 && (mDialog == IM_NOTHING_SPECIAL)
1895 && mOtherParticipantUUID.isNull()) 1940 && mOtherParticipantUUID.isNull())
@@ -1897,64 +1942,65 @@ void LLFloaterIMPanel::sendMsg()
1897 llinfos << "Cannot send IM to everyone unless you're a god." << llendl; 1942 llinfos << "Cannot send IM to everyone unless you're a god." << llendl;
1898 return; 1943 return;
1899 } 1944 }
1900 if(text.length() > 0)
1901 {
1902 // Truncate and convert to UTF8 for transport
1903 std::string utf8_text = wstring_to_utf8str(text);
1904 utf8_text = utf8str_truncate(utf8_text, MAX_MSG_BUF_SIZE - 1);
1905 1945
1906 if ( mSessionInitialized ) 1946 if (mInputEditor)
1947 {
1948 LLWString text = mInputEditor->getConvertedText();
1949 if(!text.empty())
1907 { 1950 {
1908 deliver_message(utf8_text, 1951 // Truncate and convert to UTF8 for transport
1909 mSessionUUID, 1952 std::string utf8_text = wstring_to_utf8str(text);
1910 mOtherParticipantUUID, 1953 utf8_text = utf8str_truncate(utf8_text, MAX_MSG_BUF_SIZE - 1);
1911 mDialog); 1954
1912 1955 if ( mSessionInitialized )
1913 // local echo
1914 if((mDialog == IM_NOTHING_SPECIAL) &&
1915 (mOtherParticipantUUID.notNull()))
1916 { 1956 {
1917 std::string history_echo; 1957 deliver_message(utf8_text,
1918 gAgent.buildFullname(history_echo); 1958 mSessionUUID,
1919 1959 mOtherParticipantUUID,
1920 // Look for IRC-style emotes here. 1960 mDialog);
1921 char tmpstr[5]; /* Flawfinder: ignore */ 1961
1922 strncpy(tmpstr, 1962 // local echo
1923 utf8_text.substr(0,4).c_str(), 1963 if((mDialog == IM_NOTHING_SPECIAL) &&
1924 sizeof(tmpstr) -1); /* Flawfinder: ignore */ 1964 (mOtherParticipantUUID.notNull()))
1925 tmpstr[sizeof(tmpstr) -1] = '\0';
1926 if (!strncmp(tmpstr, "/me ", 4) ||
1927 !strncmp(tmpstr, "/me'", 4))
1928 { 1965 {
1929 utf8_text.replace(0,3,""); 1966 std::string history_echo;
1930 } 1967 gAgent.buildFullname(history_echo);
1931 else 1968
1932 { 1969 // Look for IRC-style emotes here.
1933 history_echo += ": "; 1970 std::string prefix = utf8_text.substr(0, 4);
1934 } 1971 if (prefix == "/me " || prefix == "/me'")
1935 history_echo += utf8_text; 1972 {
1973 utf8_text.replace(0,3,"");
1974 }
1975 else
1976 {
1977 history_echo += ": ";
1978 }
1979 history_echo += utf8_text;
1980
1981 BOOL other_was_typing = mOtherTyping;
1982
1983 addHistoryLine(history_echo, gSavedSettings.getColor("IMChatColor"), true, gAgent.getID());
1984
1985 if (other_was_typing)
1986 {
1987 addTypingIndicator(mOtherTypingName);
1988 }
1936 1989
1937 BOOL other_was_typing = mOtherTyping;
1938
1939 addHistoryLine(history_echo, gSavedSettings.getColor("IMChatColor"), true, gAgent.getID());
1940
1941 if (other_was_typing)
1942 {
1943 addTypingIndicator(mOtherTypingName);
1944 } 1990 }
1945
1946 } 1991 }
1947 } 1992 else
1948 else 1993 {
1949 { 1994 //queue up the message to send once the session is
1950 //queue up the message to send once the session is 1995 //initialized
1951 //initialized 1996 mQueuedMsgsForInit.append(utf8_text);
1952 mQueuedMsgsForInit.append(utf8_text); 1997 }
1953 } 1998 }
1954 1999
1955 LLViewerStats::getInstance()->incStat(LLViewerStats::ST_IM_COUNT); 2000 LLViewerStats::getInstance()->incStat(LLViewerStats::ST_IM_COUNT);
2001
1956 } 2002 }
1957 mInputEditor->setText(LLString::null); 2003 mInputEditor->setText(LLStringUtil::null);
1958 2004
1959 // Don't need to actually send the typing stop message, the other 2005 // Don't need to actually send the typing stop message, the other
1960 // client will infer it from receiving the message. 2006 // client will infer it from receiving the message.
@@ -1977,7 +2023,7 @@ void LLFloaterIMPanel::processSessionUpdate(const LLSD& session_update)
1977 2023
1978 if (voice_moderated) 2024 if (voice_moderated)
1979 { 2025 {
1980 setTitle(mSessionLabel + LLString(" ") + getString("moderated_chat_label")); 2026 setTitle(mSessionLabel + std::string(" ") + getString("moderated_chat_label"));
1981 } 2027 }
1982 else 2028 else
1983 { 2029 {
@@ -2074,8 +2120,8 @@ void LLFloaterIMPanel::sendTypingState(BOOL typing)
2074 FALSE, 2120 FALSE,
2075 gAgent.getSessionID(), 2121 gAgent.getSessionID(),
2076 mOtherParticipantUUID, 2122 mOtherParticipantUUID,
2077 name.c_str(), 2123 name,
2078 "typing", 2124 std::string("typing"),
2079 IM_ONLINE, 2125 IM_ONLINE,
2080 (typing ? IM_TYPING_START : IM_TYPING_STOP), 2126 (typing ? IM_TYPING_START : IM_TYPING_STOP),
2081 mSessionUUID); 2127 mSessionUUID);
@@ -2132,20 +2178,26 @@ void LLFloaterIMPanel::removeTypingIndicator(const LLIMInfo* im_info)
2132} 2178}
2133 2179
2134//static 2180//static
2135void LLFloaterIMPanel::chatFromLogFile(LLLogChat::ELogLineType type, LLString line, void* userdata) 2181void LLFloaterIMPanel::chatFromLogFile(LLLogChat::ELogLineType type, std::string line, void* userdata)
2136{ 2182{
2137 LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata; 2183 LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata;
2138 LLUIString message = line; 2184 std::string message = line;
2139 2185
2140 switch (type) 2186 switch (type)
2141 { 2187 {
2142 case LLLogChat::LOG_EMPTY: 2188 case LLLogChat::LOG_EMPTY:
2143 // add warning log enabled message 2189 // add warning log enabled message
2144 message = LLFloaterChat::getInstance()->getUIString("IM_logging_string"); 2190 if (gSavedPerAccountSettings.getBOOL("LogInstantMessages"))
2191 {
2192 message = LLFloaterChat::getInstance()->getString("IM_logging_string");
2193 }
2145 break; 2194 break;
2146 case LLLogChat::LOG_END: 2195 case LLLogChat::LOG_END:
2147 // add log end message 2196 // add log end message
2148 message = LLFloaterChat::getInstance()->getUIString("IM_logging_string"); 2197 if (gSavedPerAccountSettings.getBOOL("LogInstantMessages"))
2198 {
2199 message = LLFloaterChat::getInstance()->getString("IM_logging_string");
2200 }
2149 break; 2201 break;
2150 case LLLogChat::LOG_LINE: 2202 case LLLogChat::LOG_LINE:
2151 // just add normal lines from file 2203 // just add normal lines from file
@@ -2172,7 +2224,7 @@ void LLFloaterIMPanel::showSessionStartError(
2172 //their own XML file which would be read in by any LLIMPanel 2224 //their own XML file which would be read in by any LLIMPanel
2173 //post build function instead of repeating the same info 2225 //post build function instead of repeating the same info
2174 //in the group, adhoc and normal IM xml files. 2226 //in the group, adhoc and normal IM xml files.
2175 LLString::format_map_t args; 2227 LLStringUtil::format_map_t args;
2176 args["[REASON]"] = 2228 args["[REASON]"] =
2177 LLFloaterIM::sErrorStringsMap[error_string]; 2229 LLFloaterIM::sErrorStringsMap[error_string];
2178 args["[RECIPIENT]"] = getTitle(); 2230 args["[RECIPIENT]"] = getTitle();
@@ -2188,12 +2240,17 @@ void LLFloaterIMPanel::showSessionEventError(
2188 const std::string& event_string, 2240 const std::string& event_string,
2189 const std::string& error_string) 2241 const std::string& error_string)
2190{ 2242{
2191 LLString::format_map_t args; 2243 LLStringUtil::format_map_t args;
2192 args["[REASON]"] = 2244 std::string event;
2193 LLFloaterIM::sErrorStringsMap[error_string]; 2245
2194 args["[EVENT]"] = 2246 event = LLFloaterIM::sEventStringsMap[event_string];
2195 LLFloaterIM::sEventStringsMap[event_string];
2196 args["[RECIPIENT]"] = getTitle(); 2247 args["[RECIPIENT]"] = getTitle();
2248 LLStringUtil::format(event, args);
2249
2250
2251 args = LLStringUtil::format_map_t();
2252 args["[REASON]"] = LLFloaterIM::sErrorStringsMap[error_string];
2253 args["[EVENT]"] = event;
2197 2254
2198 gViewerWindow->alertXml( 2255 gViewerWindow->alertXml(
2199 "ChatterBoxSessionEventError", 2256 "ChatterBoxSessionEventError",
@@ -2203,7 +2260,7 @@ void LLFloaterIMPanel::showSessionEventError(
2203void LLFloaterIMPanel::showSessionForceClose( 2260void LLFloaterIMPanel::showSessionForceClose(
2204 const std::string& reason_string) 2261 const std::string& reason_string)
2205{ 2262{
2206 LLString::format_map_t args; 2263 LLStringUtil::format_map_t args;
2207 2264
2208 args["[NAME]"] = getTitle(); 2265 args["[NAME]"] = getTitle();
2209 args["[REASON]"] = LLFloaterIM::sForceCloseSessionMap[reason_string]; 2266 args["[REASON]"] = LLFloaterIM::sForceCloseSessionMap[reason_string];
@@ -2212,7 +2269,7 @@ void LLFloaterIMPanel::showSessionForceClose(
2212 "ForceCloseChatterBoxSession", 2269 "ForceCloseChatterBoxSession",
2213 args, 2270 args,
2214 LLFloaterIMPanel::onConfirmForceCloseError, 2271 LLFloaterIMPanel::onConfirmForceCloseError,
2215 this); 2272 new LLUUID(mSessionUUID));
2216 2273
2217} 2274}
2218 2275