diff options
author | Jacek Antonelli | 2008-09-06 18:24:57 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-09-06 18:25:07 -0500 |
commit | 798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch) | |
tree | 1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/newview/llimpanel.cpp | |
parent | Second Life viewer sources 1.20.15 (diff) | |
download | meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2 meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz |
Second Life viewer sources 1.21.0-RC
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llimpanel.cpp | 235 |
1 files changed, 139 insertions, 96 deletions
diff --git a/linden/indra/newview/llimpanel.cpp b/linden/indra/newview/llimpanel.cpp index ae8bd4b..c2b54f3 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 | // |
89 | static LLString sTitleString = "Instant Message with [NAME]"; | 89 | static std::string sTitleString = "Instant Message with [NAME]"; |
90 | static LLString sTypingStartString = "[NAME]: ..."; | 90 | static std::string sTypingStartString = "[NAME]: ..."; |
91 | static LLString sSessionStartString = "Starting session with [NAME] please wait."; | 91 | static std::string sSessionStartString = "Starting session with [NAME] please wait."; |
92 | 92 | ||
93 | LLVoiceChannel::voice_channel_map_t LLVoiceChannel::sVoiceChannelMap; | 93 | LLVoiceChannel::voice_channel_map_t LLVoiceChannel::sVoiceChannelMap; |
94 | LLVoiceChannel::voice_channel_map_uri_t LLVoiceChannel::sVoiceChannelURIMap; | 94 | LLVoiceChannel::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 | // |
345 | LLVoiceChannel::LLVoiceChannel(const LLUUID& session_id, const LLString& session_name) : | 345 | LLVoiceChannel::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 | ||
375 | void LLVoiceChannel::setChannelInfo( | 375 | void 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 |
566 | LLVoiceChannel* LLVoiceChannel::getChannelByURI(LLString uri) | 566 | LLVoiceChannel* 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 | ||
587 | void LLVoiceChannel::setURI(LLString uri) | 587 | void 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 | ||
657 | LLVoiceChannelGroup::LLVoiceChannelGroup(const LLUUID& session_id, const LLString& session_name) : | 657 | LLVoiceChannelGroup::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 | ||
703 | void LLVoiceChannelGroup::setChannelInfo( | 703 | void 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 | // |
824 | LLVoiceChannelProximal::LLVoiceChannelProximal() : | 824 | LLVoiceChannelProximal::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 | // |
917 | LLVoiceChannelP2P::LLVoiceChannelP2P(const LLUUID& session_id, const LLString& session_name, const LLUUID& other_user_id) : | 917 | LLVoiceChannelP2P::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 |
1003 | void LLVoiceChannelP2P::setSessionHandle(const LLString& handle) | 1003 | void 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 | ||
1112 | void LLFloaterIMPanel::init(const LLString& session_label) | 1112 | void 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); |
@@ -1460,7 +1461,7 @@ BOOL LLFloaterIMPanel::inviteToSession(const LLDynamicArray<LLUUID>& ids) | |||
1460 | return TRUE; | 1461 | return TRUE; |
1461 | } | 1462 | } |
1462 | 1463 | ||
1463 | void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4& color, bool log_to_file, const LLUUID& source, const char *name) | 1464 | void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4& color, bool log_to_file, const LLUUID& source, const std::string& name) |
1464 | { | 1465 | { |
1465 | // start tab flashing when receiving im for background session from user | 1466 | // start tab flashing when receiving im for background session from user |
1466 | if (source != LLUUID::null) | 1467 | if (source != LLUUID::null) |
@@ -1480,7 +1481,7 @@ void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4 | |||
1480 | removeTypingIndicator(NULL); | 1481 | removeTypingIndicator(NULL); |
1481 | 1482 | ||
1482 | // Actually add the line | 1483 | // Actually add the line |
1483 | LLString timestring; | 1484 | std::string timestring; |
1484 | bool prepend_newline = true; | 1485 | bool prepend_newline = true; |
1485 | if (gSavedSettings.getBOOL("IMShowTimestamps")) | 1486 | if (gSavedSettings.getBOOL("IMShowTimestamps")) |
1486 | { | 1487 | { |
@@ -1489,10 +1490,10 @@ void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4 | |||
1489 | } | 1490 | } |
1490 | 1491 | ||
1491 | // 'name' is a sender name that we want to hotlink so that clicking on it opens a profile. | 1492 | // '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. | 1493 | if (!name.empty()) // If name exists, then add it to the front of the message. |
1493 | { | 1494 | { |
1494 | // Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text. | 1495 | // 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)) | 1496 | if (name == SYSTEM_FROM) |
1496 | { | 1497 | { |
1497 | mHistoryEditor->appendColoredText(name,false,prepend_newline,color); | 1498 | mHistoryEditor->appendColoredText(name,false,prepend_newline,color); |
1498 | } | 1499 | } |
@@ -1509,11 +1510,11 @@ void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4 | |||
1509 | if (log_to_file | 1510 | if (log_to_file |
1510 | && gSavedPerAccountSettings.getBOOL("LogInstantMessages") ) | 1511 | && gSavedPerAccountSettings.getBOOL("LogInstantMessages") ) |
1511 | { | 1512 | { |
1512 | LLString histstr; | 1513 | std::string histstr; |
1513 | if (gSavedPerAccountSettings.getBOOL("IMLogTimestamp")) | 1514 | if (gSavedPerAccountSettings.getBOOL("IMLogTimestamp")) |
1514 | histstr = LLLogChat::timestamp(gSavedPerAccountSettings.getBOOL("LogTimestampDate")) + LLString(name) + utf8msg; | 1515 | histstr = LLLogChat::timestamp(gSavedPerAccountSettings.getBOOL("LogTimestampDate")) + name + utf8msg; |
1515 | else | 1516 | else |
1516 | histstr = LLString(name) + utf8msg; | 1517 | histstr = name + utf8msg; |
1517 | 1518 | ||
1518 | LLLogChat::saveHistory(getTitle(),histstr); | 1519 | LLLogChat::saveHistory(getTitle(),histstr); |
1519 | } | 1520 | } |
@@ -1603,17 +1604,54 @@ BOOL LLFloaterIMPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, | |||
1603 | EDragAndDropType cargo_type, | 1604 | EDragAndDropType cargo_type, |
1604 | void* cargo_data, | 1605 | void* cargo_data, |
1605 | EAcceptance* accept, | 1606 | EAcceptance* accept, |
1606 | LLString& tooltip_msg) | 1607 | std::string& tooltip_msg) |
1607 | { | 1608 | { |
1608 | BOOL accepted = FALSE; | 1609 | BOOL accepted = FALSE; |
1609 | switch(cargo_type) | 1610 | switch(cargo_type) |
1610 | { | 1611 | { |
1611 | case DAD_CALLINGCARD: | 1612 | case DAD_CALLINGCARD: |
1612 | accepted = dropCallingCard((LLInventoryItem*)cargo_data, drop); | 1613 | { |
1613 | break; | 1614 | accepted = dropCallingCard((LLInventoryItem*)cargo_data, drop); |
1614 | case DAD_CATEGORY: | 1615 | break; |
1615 | accepted = dropCategory((LLInventoryCategory*)cargo_data, drop); | 1616 | } |
1616 | break; | 1617 | case DAD_CATEGORY: |
1618 | { | ||
1619 | accepted = dropCategory((LLInventoryCategory*)cargo_data, drop); | ||
1620 | break; | ||
1621 | } | ||
1622 | |||
1623 | // See stdenums.h | ||
1624 | case DAD_TEXTURE: | ||
1625 | case DAD_SOUND: | ||
1626 | // DAD_CALLINGCARD above | ||
1627 | case DAD_LANDMARK: | ||
1628 | case DAD_SCRIPT: | ||
1629 | case DAD_CLOTHING: | ||
1630 | case DAD_OBJECT: | ||
1631 | case DAD_NOTECARD: | ||
1632 | // DAD_CATEGORY above | ||
1633 | case DAD_BODYPART: | ||
1634 | case DAD_ANIMATION: | ||
1635 | case DAD_GESTURE: | ||
1636 | { | ||
1637 | if (mDialog == IM_NOTHING_SPECIAL) | ||
1638 | { | ||
1639 | // See LLDropTarget for similar code. | ||
1640 | LLViewerInventoryItem* inv_item = (LLViewerInventoryItem*)cargo_data; | ||
1641 | if(gInventory.getItem(inv_item->getUUID()) | ||
1642 | && LLToolDragAndDrop::isInventoryGiveAcceptable(inv_item)) | ||
1643 | { | ||
1644 | accepted = true; | ||
1645 | if(drop) | ||
1646 | { | ||
1647 | LLToolDragAndDrop::giveInventory(mOtherParticipantUUID, inv_item); | ||
1648 | LLStringUtil::format_map_t args; | ||
1649 | gIMMgr->addSystemMessage(mSessionUUID, "inventory_item_offered", args); | ||
1650 | } | ||
1651 | } | ||
1652 | } | ||
1653 | break; | ||
1654 | } | ||
1617 | default: | 1655 | default: |
1618 | break; | 1656 | break; |
1619 | } | 1657 | } |
@@ -1782,7 +1820,7 @@ void LLFloaterIMPanel::onInputEditorFocusLost(LLFocusableElement* caller, void* | |||
1782 | void LLFloaterIMPanel::onInputEditorKeystroke(LLLineEditor* caller, void* userdata) | 1820 | void LLFloaterIMPanel::onInputEditorKeystroke(LLLineEditor* caller, void* userdata) |
1783 | { | 1821 | { |
1784 | LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata; | 1822 | LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata; |
1785 | LLString text = self->mInputEditor->getText(); | 1823 | std::string text = self->mInputEditor->getText(); |
1786 | if (!text.empty()) | 1824 | if (!text.empty()) |
1787 | { | 1825 | { |
1788 | self->setTyping(TRUE); | 1826 | self->setTyping(TRUE); |
@@ -1808,8 +1846,8 @@ void LLFloaterIMPanel::onClose(bool app_quitting) | |||
1808 | FALSE, | 1846 | FALSE, |
1809 | gAgent.getSessionID(), | 1847 | gAgent.getSessionID(), |
1810 | mOtherParticipantUUID, | 1848 | mOtherParticipantUUID, |
1811 | name.c_str(), | 1849 | name, |
1812 | "", | 1850 | LLStringUtil::null, |
1813 | IM_ONLINE, | 1851 | IM_ONLINE, |
1814 | IM_SESSION_LEAVE, | 1852 | IM_SESSION_LEAVE, |
1815 | mSessionUUID); | 1853 | mSessionUUID); |
@@ -1855,8 +1893,8 @@ void deliver_message(const std::string& utf8_text, | |||
1855 | FALSE, | 1893 | FALSE, |
1856 | gAgent.getSessionID(), | 1894 | gAgent.getSessionID(), |
1857 | other_participant_id, | 1895 | other_participant_id, |
1858 | name.c_str(), | 1896 | name, |
1859 | utf8_text.c_str(), | 1897 | utf8_text, |
1860 | offline, | 1898 | offline, |
1861 | (EInstantMessage)new_dialog, | 1899 | (EInstantMessage)new_dialog, |
1862 | im_session_id); | 1900 | im_session_id); |
@@ -1888,8 +1926,6 @@ void deliver_message(const std::string& utf8_text, | |||
1888 | 1926 | ||
1889 | void LLFloaterIMPanel::sendMsg() | 1927 | void LLFloaterIMPanel::sendMsg() |
1890 | { | 1928 | { |
1891 | LLWString text = mInputEditor->getWText(); | ||
1892 | LLWString::trim(text); | ||
1893 | if (!gAgent.isGodlike() | 1929 | if (!gAgent.isGodlike() |
1894 | && (mDialog == IM_NOTHING_SPECIAL) | 1930 | && (mDialog == IM_NOTHING_SPECIAL) |
1895 | && mOtherParticipantUUID.isNull()) | 1931 | && mOtherParticipantUUID.isNull()) |
@@ -1897,64 +1933,65 @@ void LLFloaterIMPanel::sendMsg() | |||
1897 | llinfos << "Cannot send IM to everyone unless you're a god." << llendl; | 1933 | llinfos << "Cannot send IM to everyone unless you're a god." << llendl; |
1898 | return; | 1934 | return; |
1899 | } | 1935 | } |
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 | 1936 | ||
1906 | if ( mSessionInitialized ) | 1937 | if (mInputEditor) |
1938 | { | ||
1939 | LLWString text = mInputEditor->getConvertedText(); | ||
1940 | if(!text.empty()) | ||
1907 | { | 1941 | { |
1908 | deliver_message(utf8_text, | 1942 | // Truncate and convert to UTF8 for transport |
1909 | mSessionUUID, | 1943 | std::string utf8_text = wstring_to_utf8str(text); |
1910 | mOtherParticipantUUID, | 1944 | utf8_text = utf8str_truncate(utf8_text, MAX_MSG_BUF_SIZE - 1); |
1911 | mDialog); | 1945 | |
1912 | 1946 | if ( mSessionInitialized ) | |
1913 | // local echo | ||
1914 | if((mDialog == IM_NOTHING_SPECIAL) && | ||
1915 | (mOtherParticipantUUID.notNull())) | ||
1916 | { | 1947 | { |
1917 | std::string history_echo; | 1948 | deliver_message(utf8_text, |
1918 | gAgent.buildFullname(history_echo); | 1949 | mSessionUUID, |
1919 | 1950 | mOtherParticipantUUID, | |
1920 | // Look for IRC-style emotes here. | 1951 | mDialog); |
1921 | char tmpstr[5]; /* Flawfinder: ignore */ | 1952 | |
1922 | strncpy(tmpstr, | 1953 | // local echo |
1923 | utf8_text.substr(0,4).c_str(), | 1954 | if((mDialog == IM_NOTHING_SPECIAL) && |
1924 | sizeof(tmpstr) -1); /* Flawfinder: ignore */ | 1955 | (mOtherParticipantUUID.notNull())) |
1925 | tmpstr[sizeof(tmpstr) -1] = '\0'; | ||
1926 | if (!strncmp(tmpstr, "/me ", 4) || | ||
1927 | !strncmp(tmpstr, "/me'", 4)) | ||
1928 | { | 1956 | { |
1929 | utf8_text.replace(0,3,""); | 1957 | std::string history_echo; |
1930 | } | 1958 | gAgent.buildFullname(history_echo); |
1931 | else | 1959 | |
1932 | { | 1960 | // Look for IRC-style emotes here. |
1933 | history_echo += ": "; | 1961 | std::string prefix = utf8_text.substr(0, 4); |
1934 | } | 1962 | if (prefix == "/me " || prefix == "/me'") |
1935 | history_echo += utf8_text; | 1963 | { |
1936 | 1964 | utf8_text.replace(0,3,""); | |
1937 | BOOL other_was_typing = mOtherTyping; | 1965 | } |
1966 | else | ||
1967 | { | ||
1968 | history_echo += ": "; | ||
1969 | } | ||
1970 | history_echo += utf8_text; | ||
1971 | |||
1972 | BOOL other_was_typing = mOtherTyping; | ||
1973 | |||
1974 | addHistoryLine(history_echo, gSavedSettings.getColor("IMChatColor"), true, gAgent.getID()); | ||
1975 | |||
1976 | if (other_was_typing) | ||
1977 | { | ||
1978 | addTypingIndicator(mOtherTypingName); | ||
1979 | } | ||
1938 | 1980 | ||
1939 | addHistoryLine(history_echo, gSavedSettings.getColor("IMChatColor"), true, gAgent.getID()); | ||
1940 | |||
1941 | if (other_was_typing) | ||
1942 | { | ||
1943 | addTypingIndicator(mOtherTypingName); | ||
1944 | } | 1981 | } |
1945 | |||
1946 | } | 1982 | } |
1947 | } | 1983 | else |
1948 | else | 1984 | { |
1949 | { | 1985 | //queue up the message to send once the session is |
1950 | //queue up the message to send once the session is | 1986 | //initialized |
1951 | //initialized | 1987 | mQueuedMsgsForInit.append(utf8_text); |
1952 | mQueuedMsgsForInit.append(utf8_text); | 1988 | } |
1953 | } | 1989 | } |
1954 | 1990 | ||
1955 | LLViewerStats::getInstance()->incStat(LLViewerStats::ST_IM_COUNT); | 1991 | LLViewerStats::getInstance()->incStat(LLViewerStats::ST_IM_COUNT); |
1992 | |||
1956 | } | 1993 | } |
1957 | mInputEditor->setText(LLString::null); | 1994 | mInputEditor->setText(LLStringUtil::null); |
1958 | 1995 | ||
1959 | // Don't need to actually send the typing stop message, the other | 1996 | // Don't need to actually send the typing stop message, the other |
1960 | // client will infer it from receiving the message. | 1997 | // client will infer it from receiving the message. |
@@ -1977,7 +2014,7 @@ void LLFloaterIMPanel::processSessionUpdate(const LLSD& session_update) | |||
1977 | 2014 | ||
1978 | if (voice_moderated) | 2015 | if (voice_moderated) |
1979 | { | 2016 | { |
1980 | setTitle(mSessionLabel + LLString(" ") + getString("moderated_chat_label")); | 2017 | setTitle(mSessionLabel + std::string(" ") + getString("moderated_chat_label")); |
1981 | } | 2018 | } |
1982 | else | 2019 | else |
1983 | { | 2020 | { |
@@ -2074,8 +2111,8 @@ void LLFloaterIMPanel::sendTypingState(BOOL typing) | |||
2074 | FALSE, | 2111 | FALSE, |
2075 | gAgent.getSessionID(), | 2112 | gAgent.getSessionID(), |
2076 | mOtherParticipantUUID, | 2113 | mOtherParticipantUUID, |
2077 | name.c_str(), | 2114 | name, |
2078 | "typing", | 2115 | std::string("typing"), |
2079 | IM_ONLINE, | 2116 | IM_ONLINE, |
2080 | (typing ? IM_TYPING_START : IM_TYPING_STOP), | 2117 | (typing ? IM_TYPING_START : IM_TYPING_STOP), |
2081 | mSessionUUID); | 2118 | mSessionUUID); |
@@ -2132,7 +2169,7 @@ void LLFloaterIMPanel::removeTypingIndicator(const LLIMInfo* im_info) | |||
2132 | } | 2169 | } |
2133 | 2170 | ||
2134 | //static | 2171 | //static |
2135 | void LLFloaterIMPanel::chatFromLogFile(LLLogChat::ELogLineType type, LLString line, void* userdata) | 2172 | void LLFloaterIMPanel::chatFromLogFile(LLLogChat::ELogLineType type, std::string line, void* userdata) |
2136 | { | 2173 | { |
2137 | LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata; | 2174 | LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata; |
2138 | LLUIString message = line; | 2175 | LLUIString message = line; |
@@ -2141,11 +2178,17 @@ void LLFloaterIMPanel::chatFromLogFile(LLLogChat::ELogLineType type, LLString li | |||
2141 | { | 2178 | { |
2142 | case LLLogChat::LOG_EMPTY: | 2179 | case LLLogChat::LOG_EMPTY: |
2143 | // add warning log enabled message | 2180 | // add warning log enabled message |
2144 | message = LLFloaterChat::getInstance()->getUIString("IM_logging_string"); | 2181 | if (gSavedPerAccountSettings.getBOOL("LogInstantMessages")) |
2182 | { | ||
2183 | message = LLFloaterChat::getInstance()->getUIString("IM_logging_string"); | ||
2184 | } | ||
2145 | break; | 2185 | break; |
2146 | case LLLogChat::LOG_END: | 2186 | case LLLogChat::LOG_END: |
2147 | // add log end message | 2187 | // add log end message |
2148 | message = LLFloaterChat::getInstance()->getUIString("IM_logging_string"); | 2188 | if (gSavedPerAccountSettings.getBOOL("LogInstantMessages")) |
2189 | { | ||
2190 | message = LLFloaterChat::getInstance()->getUIString("IM_logging_string"); | ||
2191 | } | ||
2149 | break; | 2192 | break; |
2150 | case LLLogChat::LOG_LINE: | 2193 | case LLLogChat::LOG_LINE: |
2151 | // just add normal lines from file | 2194 | // just add normal lines from file |
@@ -2172,7 +2215,7 @@ void LLFloaterIMPanel::showSessionStartError( | |||
2172 | //their own XML file which would be read in by any LLIMPanel | 2215 | //their own XML file which would be read in by any LLIMPanel |
2173 | //post build function instead of repeating the same info | 2216 | //post build function instead of repeating the same info |
2174 | //in the group, adhoc and normal IM xml files. | 2217 | //in the group, adhoc and normal IM xml files. |
2175 | LLString::format_map_t args; | 2218 | LLStringUtil::format_map_t args; |
2176 | args["[REASON]"] = | 2219 | args["[REASON]"] = |
2177 | LLFloaterIM::sErrorStringsMap[error_string]; | 2220 | LLFloaterIM::sErrorStringsMap[error_string]; |
2178 | args["[RECIPIENT]"] = getTitle(); | 2221 | args["[RECIPIENT]"] = getTitle(); |
@@ -2188,7 +2231,7 @@ void LLFloaterIMPanel::showSessionEventError( | |||
2188 | const std::string& event_string, | 2231 | const std::string& event_string, |
2189 | const std::string& error_string) | 2232 | const std::string& error_string) |
2190 | { | 2233 | { |
2191 | LLString::format_map_t args; | 2234 | LLStringUtil::format_map_t args; |
2192 | args["[REASON]"] = | 2235 | args["[REASON]"] = |
2193 | LLFloaterIM::sErrorStringsMap[error_string]; | 2236 | LLFloaterIM::sErrorStringsMap[error_string]; |
2194 | args["[EVENT]"] = | 2237 | args["[EVENT]"] = |
@@ -2203,7 +2246,7 @@ void LLFloaterIMPanel::showSessionEventError( | |||
2203 | void LLFloaterIMPanel::showSessionForceClose( | 2246 | void LLFloaterIMPanel::showSessionForceClose( |
2204 | const std::string& reason_string) | 2247 | const std::string& reason_string) |
2205 | { | 2248 | { |
2206 | LLString::format_map_t args; | 2249 | LLStringUtil::format_map_t args; |
2207 | 2250 | ||
2208 | args["[NAME]"] = getTitle(); | 2251 | args["[NAME]"] = getTitle(); |
2209 | args["[REASON]"] = LLFloaterIM::sForceCloseSessionMap[reason_string]; | 2252 | args["[REASON]"] = LLFloaterIM::sForceCloseSessionMap[reason_string]; |
@@ -2212,7 +2255,7 @@ void LLFloaterIMPanel::showSessionForceClose( | |||
2212 | "ForceCloseChatterBoxSession", | 2255 | "ForceCloseChatterBoxSession", |
2213 | args, | 2256 | args, |
2214 | LLFloaterIMPanel::onConfirmForceCloseError, | 2257 | LLFloaterIMPanel::onConfirmForceCloseError, |
2215 | this); | 2258 | new LLUUID(mSessionUUID)); |
2216 | 2259 | ||
2217 | } | 2260 | } |
2218 | 2261 | ||