diff options
Diffstat (limited to 'linden/indra/newview/llimpanel.cpp')
-rw-r--r-- | linden/indra/newview/llimpanel.cpp | 101 |
1 files changed, 78 insertions, 23 deletions
diff --git a/linden/indra/newview/llimpanel.cpp b/linden/indra/newview/llimpanel.cpp index a5950ce..9a044d7 100644 --- a/linden/indra/newview/llimpanel.cpp +++ b/linden/indra/newview/llimpanel.cpp | |||
@@ -47,6 +47,7 @@ | |||
47 | #include "llbutton.h" | 47 | #include "llbutton.h" |
48 | #include "llcallingcard.h" | 48 | #include "llcallingcard.h" |
49 | #include "llchat.h" | 49 | #include "llchat.h" |
50 | #include "llcombobox.h" | ||
50 | #include "llconsole.h" | 51 | #include "llconsole.h" |
51 | #include "llfloater.h" | 52 | #include "llfloater.h" |
52 | #include "llfloatergroupinfo.h" | 53 | #include "llfloatergroupinfo.h" |
@@ -60,6 +61,7 @@ | |||
60 | #include "llfloaterchat.h" | 61 | #include "llfloaterchat.h" |
61 | #include "llkeyboard.h" | 62 | #include "llkeyboard.h" |
62 | #include "lllineeditor.h" | 63 | #include "lllineeditor.h" |
64 | #include "llmenucommands.h" | ||
63 | #include "llnotify.h" | 65 | #include "llnotify.h" |
64 | #include "llresmgr.h" | 66 | #include "llresmgr.h" |
65 | #include "lltabcontainer.h" | 67 | #include "lltabcontainer.h" |
@@ -1080,6 +1082,7 @@ LLFloaterIMPanel::LLFloaterIMPanel( | |||
1080 | LLFloater(session_label, LLRect(), session_label), | 1082 | LLFloater(session_label, LLRect(), session_label), |
1081 | mInputEditor(NULL), | 1083 | mInputEditor(NULL), |
1082 | mHistoryEditor(NULL), | 1084 | mHistoryEditor(NULL), |
1085 | mComboIM(NULL), | ||
1083 | mSessionUUID(session_id), | 1086 | mSessionUUID(session_id), |
1084 | mVoiceChannel(NULL), | 1087 | mVoiceChannel(NULL), |
1085 | mSessionInitialized(FALSE), | 1088 | mSessionInitialized(FALSE), |
@@ -1197,7 +1200,7 @@ void LLFloaterIMPanel::init(const std::string& session_label) | |||
1197 | 1200 | ||
1198 | setTitle(mSessionLabel); | 1201 | setTitle(mSessionLabel); |
1199 | 1202 | ||
1200 | mInputEditor->setMaxTextLength(1023); | 1203 | mInputEditor->setMaxTextLength(DB_IM_MSG_STR_LEN); |
1201 | // enable line history support for instant message bar | 1204 | // enable line history support for instant message bar |
1202 | mInputEditor->setEnableLineHistory(TRUE); | 1205 | mInputEditor->setEnableLineHistory(TRUE); |
1203 | 1206 | ||
@@ -1296,7 +1299,17 @@ BOOL LLFloaterIMPanel::postBuild() | |||
1296 | mInputEditor->setRevertOnEsc( FALSE ); | 1299 | mInputEditor->setRevertOnEsc( FALSE ); |
1297 | mInputEditor->setReplaceNewlinesWithSpaces( FALSE ); | 1300 | mInputEditor->setReplaceNewlinesWithSpaces( FALSE ); |
1298 | 1301 | ||
1299 | childSetAction("profile_callee_btn", onClickProfile, this); | 1302 | // Profile combobox in floater_instant_message.xml |
1303 | mComboIM = getChild<LLComboBox>("profile_callee_btn"); | ||
1304 | mComboIM->setCommitCallback(onCommitCombo); | ||
1305 | mComboIM->setCallbackUserData(this); | ||
1306 | |||
1307 | #ifdef LL_WINDOWS | ||
1308 | mComboIM->add(getString("history_entry")); | ||
1309 | #endif | ||
1310 | mComboIM->add(getString("pay_entry")); | ||
1311 | mComboIM->add(getString("teleport_entry")); | ||
1312 | |||
1300 | childSetAction("group_info_btn", onClickGroupInfo, this); | 1313 | childSetAction("group_info_btn", onClickGroupInfo, this); |
1301 | childSetAction("history_btn", onClickHistory, this); | 1314 | childSetAction("history_btn", onClickHistory, this); |
1302 | 1315 | ||
@@ -1304,7 +1317,6 @@ BOOL LLFloaterIMPanel::postBuild() | |||
1304 | childSetAction("end_call_btn", onClickEndCall, this); | 1317 | childSetAction("end_call_btn", onClickEndCall, this); |
1305 | childSetAction("send_btn", onClickSend, this); | 1318 | childSetAction("send_btn", onClickSend, this); |
1306 | childSetAction("toggle_active_speakers_btn", onClickToggleActiveSpeakers, this); | 1319 | childSetAction("toggle_active_speakers_btn", onClickToggleActiveSpeakers, this); |
1307 | childSetAction("offer_tp_btn", onClickOfferTeleport, this); | ||
1308 | 1320 | ||
1309 | childSetAction("moderator_kick_speaker", onKickSpeaker, this); | 1321 | childSetAction("moderator_kick_speaker", onKickSpeaker, this); |
1310 | //LLButton* close_btn = getChild<LLButton>("close_btn"); | 1322 | //LLButton* close_btn = getChild<LLButton>("close_btn"); |
@@ -1792,26 +1804,6 @@ void LLFloaterIMPanel::onTabClick(void* userdata) | |||
1792 | } | 1804 | } |
1793 | 1805 | ||
1794 | // static | 1806 | // static |
1795 | void LLFloaterIMPanel::onClickOfferTeleport(void* userdata) | ||
1796 | { | ||
1797 | LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata; | ||
1798 | |||
1799 | handle_lure(self->mOtherParticipantUUID); | ||
1800 | } | ||
1801 | |||
1802 | // static | ||
1803 | void LLFloaterIMPanel::onClickProfile( void* userdata ) | ||
1804 | { | ||
1805 | // Bring up the Profile window | ||
1806 | LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata; | ||
1807 | |||
1808 | if (self->mOtherParticipantUUID.notNull()) | ||
1809 | { | ||
1810 | LLFloaterAvatarInfo::showFromDirectory(self->getOtherParticipantID()); | ||
1811 | } | ||
1812 | } | ||
1813 | |||
1814 | // static | ||
1815 | void LLFloaterIMPanel::onClickHistory( void* userdata ) | 1807 | void LLFloaterIMPanel::onClickHistory( void* userdata ) |
1816 | { | 1808 | { |
1817 | LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata; | 1809 | LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata; |
@@ -1904,6 +1896,67 @@ void LLFloaterIMPanel::onCommitChat(LLUICtrl* caller, void* userdata) | |||
1904 | } | 1896 | } |
1905 | 1897 | ||
1906 | // static | 1898 | // static |
1899 | void LLFloaterIMPanel::onCommitCombo(LLUICtrl* caller, void* userdata) | ||
1900 | { | ||
1901 | LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata; | ||
1902 | LLCtrlListInterface* options = self->mComboIM ? self->mComboIM->getListInterface() : NULL; | ||
1903 | if (options) | ||
1904 | { | ||
1905 | S32 index = options->getFirstSelectedIndex(); | ||
1906 | if (index < 0) | ||
1907 | { | ||
1908 | // Open profile or group window | ||
1909 | if (self->mOtherParticipantUUID.notNull()) | ||
1910 | { | ||
1911 | LLFloaterAvatarInfo::showFromDirectory(self->getOtherParticipantID()); | ||
1912 | } | ||
1913 | return; | ||
1914 | } | ||
1915 | |||
1916 | std::string selected = self->mComboIM->getSelectedValue().asString(); | ||
1917 | if (selected == self->getString("history_entry")) | ||
1918 | { | ||
1919 | if (self->mOtherParticipantUUID.notNull()) | ||
1920 | { | ||
1921 | struct stat fileInfo; | ||
1922 | int result; | ||
1923 | |||
1924 | std::string fullname = self->getTitle();; | ||
1925 | //gCacheName->getFullName(self->mOtherParticipantUUID, fullname); | ||
1926 | //if(fullname == "(Loading...)") | ||
1927 | std::string file_path = gDirUtilp->getPerAccountChatLogsDir() + "\\" + fullname + ".txt"; | ||
1928 | |||
1929 | // check if file exists by trying to get its attributes | ||
1930 | result = stat(file_path.c_str(), &fileInfo); | ||
1931 | if(result == 0) | ||
1932 | { | ||
1933 | char command[256]; | ||
1934 | sprintf(command, "\"%s\\%s.txt\"", gDirUtilp->getPerAccountChatLogsDir().c_str(),fullname.c_str()); | ||
1935 | gViewerWindow->getWindow()->ShellEx(command); | ||
1936 | |||
1937 | llinfos << command << llendl; | ||
1938 | } | ||
1939 | else | ||
1940 | { | ||
1941 | LLSD args; | ||
1942 | args["[NAME]"] = fullname; | ||
1943 | LLNotifications::instance().add("IMLogNotFound", args); | ||
1944 | llinfos << file_path << llendl; | ||
1945 | } | ||
1946 | } | ||
1947 | } | ||
1948 | else if (selected == self->getString("pay_entry")) | ||
1949 | { | ||
1950 | handle_pay_by_id(self->mOtherParticipantUUID); | ||
1951 | } | ||
1952 | else if (selected == self->getString("teleport_entry")) | ||
1953 | { | ||
1954 | handle_lure(self->mOtherParticipantUUID); | ||
1955 | } | ||
1956 | } | ||
1957 | } | ||
1958 | |||
1959 | // static | ||
1907 | void LLFloaterIMPanel::onInputEditorFocusReceived( LLFocusableElement* caller, void* userdata ) | 1960 | void LLFloaterIMPanel::onInputEditorFocusReceived( LLFocusableElement* caller, void* userdata ) |
1908 | { | 1961 | { |
1909 | LLFloaterIMPanel* self= (LLFloaterIMPanel*) userdata; | 1962 | LLFloaterIMPanel* self= (LLFloaterIMPanel*) userdata; |
@@ -2052,6 +2105,8 @@ void LLFloaterIMPanel::sendMsg() | |||
2052 | LLWString text = mInputEditor->getConvertedText(); | 2105 | LLWString text = mInputEditor->getConvertedText(); |
2053 | if(!text.empty()) | 2106 | if(!text.empty()) |
2054 | { | 2107 | { |
2108 | // store sent line in history, duplicates will get filtered | ||
2109 | if (mInputEditor) mInputEditor->updateHistory(); | ||
2055 | // Truncate and convert to UTF8 for transport | 2110 | // Truncate and convert to UTF8 for transport |
2056 | std::string utf8_text = wstring_to_utf8str(text); | 2111 | std::string utf8_text = wstring_to_utf8str(text); |
2057 | utf8_text = utf8str_truncate(utf8_text, MAX_MSG_BUF_SIZE - 1); | 2112 | utf8_text = utf8str_truncate(utf8_text, MAX_MSG_BUF_SIZE - 1); |