aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llimpanel.cpp
diff options
context:
space:
mode:
authorMcCabe Maxsted2010-09-03 09:01:46 -0700
committerMcCabe Maxsted2010-09-03 09:04:34 -0700
commit33fbe66dd105e7cc642c2d164bf2c5c58fae3a11 (patch)
treef2284098911c70ad88d3dbf5f791dc7057ef5f0c /linden/indra/newview/llimpanel.cpp
parentFixed 'cao on/off' commands not working in the chatbar (diff)
downloadmeta-impy-33fbe66dd105e7cc642c2d164bf2c5c58fae3a11.zip
meta-impy-33fbe66dd105e7cc642c2d164bf2c5c58fae3a11.tar.gz
meta-impy-33fbe66dd105e7cc642c2d164bf2c5c58fae3a11.tar.bz2
meta-impy-33fbe66dd105e7cc642c2d164bf2c5c58fae3a11.tar.xz
Made IM History feature enabled cross-platform (#182). Also fixes #250
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llimpanel.cpp121
1 files changed, 32 insertions, 89 deletions
diff --git a/linden/indra/newview/llimpanel.cpp b/linden/indra/newview/llimpanel.cpp
index be6df5b..6cf7ffb 100644
--- a/linden/indra/newview/llimpanel.cpp
+++ b/linden/indra/newview/llimpanel.cpp
@@ -1082,7 +1082,6 @@ LLFloaterIMPanel::LLFloaterIMPanel(
1082 LLFloater(session_label, LLRect(), session_label), 1082 LLFloater(session_label, LLRect(), session_label),
1083 mInputEditor(NULL), 1083 mInputEditor(NULL),
1084 mHistoryEditor(NULL), 1084 mHistoryEditor(NULL),
1085 mComboIM(NULL),
1086 mSessionUUID(session_id), 1085 mSessionUUID(session_id),
1087 mVoiceChannel(NULL), 1086 mVoiceChannel(NULL),
1088 mSessionInitialized(FALSE), 1087 mSessionInitialized(FALSE),
@@ -1283,10 +1282,6 @@ BOOL LLFloaterIMPanel::postBuild()
1283 requires<LLLineEditor>("chat_editor"); 1282 requires<LLLineEditor>("chat_editor");
1284 requires<LLTextEditor>("im_history"); 1283 requires<LLTextEditor>("im_history");
1285 1284
1286#if LL_LINUX || LL_DARWIN
1287 childSetVisible("history_btn", false);
1288#endif
1289
1290 if (checkRequirements()) 1285 if (checkRequirements())
1291 { 1286 {
1292 mInputEditor = getChild<LLLineEditor>("chat_editor"); 1287 mInputEditor = getChild<LLLineEditor>("chat_editor");
@@ -1300,18 +1295,8 @@ BOOL LLFloaterIMPanel::postBuild()
1300 mInputEditor->setReplaceNewlinesWithSpaces( FALSE ); 1295 mInputEditor->setReplaceNewlinesWithSpaces( FALSE );
1301 1296
1302 // Profile combobox in floater_instant_message.xml 1297 // Profile combobox in floater_instant_message.xml
1303 mComboIM = getChild<LLComboBox>("profile_callee_btn"); 1298 childSetCommitCallback("profile_callee_btn", onCommitCombo, this);
1304 mComboIM->setCommitCallback(onCommitCombo); 1299 childSetCommitCallback("group_info_btn", onCommitCombo, this);
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
1313 childSetAction("group_info_btn", onClickGroupInfo, this);
1314 childSetAction("history_btn", onClickHistory, this);
1315 1300
1316 childSetAction("start_call_btn", onClickStartCall, this); 1301 childSetAction("start_call_btn", onClickStartCall, this);
1317 childSetAction("end_call_btn", onClickEndCall, this); 1302 childSetAction("end_call_btn", onClickEndCall, this);
@@ -1804,41 +1789,6 @@ void LLFloaterIMPanel::onTabClick(void* userdata)
1804} 1789}
1805 1790
1806// static 1791// static
1807void LLFloaterIMPanel::onClickHistory( void* userdata )
1808{
1809 LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
1810
1811 if (self->mOtherParticipantUUID.notNull())
1812 {
1813 struct stat fileInfo;
1814 int result;
1815
1816 std::string fullname = self->getTitle();;
1817 //gCacheName->getFullName(self->mOtherParticipantUUID, fullname);
1818 //if(fullname == "(Loading...)")
1819 std::string file_path = gDirUtilp->getPerAccountChatLogsDir() + "\\" + fullname + ".txt";
1820
1821 // check if file exists by trying to get its attributes
1822 result = stat(file_path.c_str(), &fileInfo);
1823 if(result == 0)
1824 {
1825 char command[256];
1826 sprintf(command, "\"%s\\%s.txt\"", gDirUtilp->getPerAccountChatLogsDir().c_str(),fullname.c_str());
1827 gViewerWindow->getWindow()->ShellEx(command);
1828
1829 llinfos << command << llendl;
1830 }
1831 else
1832 {
1833 LLSD args;
1834 args["[NAME]"] = fullname;
1835 LLNotifications::instance().add("IMLogNotFound", args);
1836 llinfos << file_path << llendl;
1837 }
1838 }
1839}
1840
1841// static
1842void LLFloaterIMPanel::onClickGroupInfo( void* userdata ) 1792void LLFloaterIMPanel::onClickGroupInfo( void* userdata )
1843{ 1793{
1844 // Bring up the Profile window 1794 // Bring up the Profile window
@@ -1899,59 +1849,52 @@ void LLFloaterIMPanel::onCommitChat(LLUICtrl* caller, void* userdata)
1899void LLFloaterIMPanel::onCommitCombo(LLUICtrl* caller, void* userdata) 1849void LLFloaterIMPanel::onCommitCombo(LLUICtrl* caller, void* userdata)
1900{ 1850{
1901 LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata; 1851 LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
1902 LLCtrlListInterface* options = self->mComboIM ? self->mComboIM->getListInterface() : NULL; 1852 if (self->getOtherParticipantID().notNull())
1903 if (options)
1904 { 1853 {
1905 S32 index = options->getFirstSelectedIndex(); 1854 if (caller->getValue().asString() == "history_entry")
1906 if (index < 0)
1907 { 1855 {
1908 // Open profile or group window 1856 if (self->getOtherParticipantID().notNull())
1909 if (self->mOtherParticipantUUID.notNull())
1910 { 1857 {
1911 LLFloaterAvatarInfo::showFromDirectory(self->getOtherParticipantID()); 1858 std::string fullname = self->getTitle();
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); 1859 //gCacheName->getFullName(self->mOtherParticipantUUID, fullname);
1926 //if(fullname == "(Loading...)") 1860 //if(fullname == "(Loading...)")
1927 std::string file_path = gDirUtilp->getPerAccountChatLogsDir() + "\\" + fullname + ".txt"; 1861 std::string file = gDirUtilp->getPerAccountChatLogsDir() + "\\" + fullname + ".txt";
1928 1862
1929 // check if file exists by trying to get its attributes 1863 llstat stat_info;
1930 result = stat(file_path.c_str(), &fileInfo); 1864 if (LLFile::stat(file.c_str(), &stat_info))
1931 if(result == 0)
1932 { 1865 {
1933 char command[256]; 1866 LLSD args;
1934 sprintf(command, "\"%s\\%s.txt\"", gDirUtilp->getPerAccountChatLogsDir().c_str(),fullname.c_str()); 1867 args["[NAME]"] = fullname;
1935 gViewerWindow->getWindow()->ShellEx(command); 1868 LLNotifications::instance().add("IMLogNotFound", args, LLSD());
1936 1869 //llinfos << file << " not found" << llendl;
1937 llinfos << command << llendl;
1938 } 1870 }
1939 else 1871 else
1940 { 1872 {
1941 LLSD args; 1873 gViewerWindow->getWindow()->ShellEx(file);
1942 args["[NAME]"] = fullname; 1874 //llinfos << file << " found" << llendl;
1943 LLNotifications::instance().add("IMLogNotFound", args);
1944 llinfos << file_path << llendl;
1945 } 1875 }
1946 } 1876 }
1947 } 1877 }
1948 else if (selected == self->getString("pay_entry")) 1878 else if (caller->getValue().asString() == "pay_entry")
1949 { 1879 {
1950 handle_pay_by_id(self->mOtherParticipantUUID); 1880 handle_pay_by_id(self->getOtherParticipantID());
1951 } 1881 }
1952 else if (selected == self->getString("teleport_entry")) 1882 else if (caller->getValue().asString() == "teleport_entry")
1953 { 1883 {
1954 handle_lure(self->mOtherParticipantUUID); 1884 handle_lure(self->getOtherParticipantID());
1885 }
1886 else
1887 {
1888 // group
1889 if (self->getOtherParticipantID() == self->getSessionID())
1890 {
1891 LLFloaterGroupInfo::showFromUUID(self->getSessionID());
1892 }
1893 // profile
1894 else
1895 {
1896 LLFloaterAvatarInfo::showFromDirectory(self->getOtherParticipantID());
1897 }
1955 } 1898 }
1956 } 1899 }
1957} 1900}