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.cpp88
1 files changed, 63 insertions, 25 deletions
diff --git a/linden/indra/newview/llimpanel.cpp b/linden/indra/newview/llimpanel.cpp
index 0c9333e..6d77354 100644
--- a/linden/indra/newview/llimpanel.cpp
+++ b/linden/indra/newview/llimpanel.cpp
@@ -357,7 +357,7 @@ LLVoiceChannel::LLVoiceChannel(const LLUUID& session_id, const std::string& sess
357 llwarns << "Duplicate voice channels registered for session_id " << session_id << llendl; 357 llwarns << "Duplicate voice channels registered for session_id " << session_id << llendl;
358 } 358 }
359 359
360 LLVoiceClient::getInstance()->addStatusObserver(this); 360 LLVoiceClient::getInstance()->addObserver(this);
361} 361}
362 362
363LLVoiceChannel::~LLVoiceChannel() 363LLVoiceChannel::~LLVoiceChannel()
@@ -365,7 +365,7 @@ LLVoiceChannel::~LLVoiceChannel()
365 // Don't use LLVoiceClient::getInstance() here -- this can get called during atexit() time and that singleton MAY have already been destroyed. 365 // Don't use LLVoiceClient::getInstance() here -- this can get called during atexit() time and that singleton MAY have already been destroyed.
366 if(gVoiceClient) 366 if(gVoiceClient)
367 { 367 {
368 gVoiceClient->removeStatusObserver(this); 368 gVoiceClient->removeObserver(this);
369 } 369 }
370 370
371 sVoiceChannelMap.erase(mSessionID); 371 sVoiceChannelMap.erase(mSessionID);
@@ -983,7 +983,8 @@ void LLVoiceChannelP2P::activate()
983 // otherwise answering the call 983 // otherwise answering the call
984 else 984 else
985 { 985 {
986 LLVoiceClient::getInstance()->answerInvite(mSessionHandle, mOtherUserID); 986 LLVoiceClient::getInstance()->answerInvite(mSessionHandle);
987
987 // using the session handle invalidates it. Clear it out here so we can't reuse it by accident. 988 // using the session handle invalidates it. Clear it out here so we can't reuse it by accident.
988 mSessionHandle.clear(); 989 mSessionHandle.clear();
989 } 990 }
@@ -1000,7 +1001,7 @@ void LLVoiceChannelP2P::getChannelInfo()
1000} 1001}
1001 1002
1002// receiving session from other user who initiated call 1003// receiving session from other user who initiated call
1003void LLVoiceChannelP2P::setSessionHandle(const std::string& handle) 1004void LLVoiceChannelP2P::setSessionHandle(const std::string& handle, const std::string &inURI)
1004{ 1005{
1005 BOOL needs_activate = FALSE; 1006 BOOL needs_activate = FALSE;
1006 if (callStarted()) 1007 if (callStarted())
@@ -1023,8 +1024,17 @@ void LLVoiceChannelP2P::setSessionHandle(const std::string& handle)
1023 } 1024 }
1024 1025
1025 mSessionHandle = handle; 1026 mSessionHandle = handle;
1027
1026 // The URI of a p2p session should always be the other end's SIP URI. 1028 // The URI of a p2p session should always be the other end's SIP URI.
1027 setURI(LLVoiceClient::getInstance()->sipURIFromID(mOtherUserID)); 1029 if(!inURI.empty())
1030 {
1031 setURI(inURI);
1032 }
1033 else
1034 {
1035 setURI(LLVoiceClient::getInstance()->sipURIFromID(mOtherUserID));
1036 }
1037
1028 mReceivedCall = TRUE; 1038 mReceivedCall = TRUE;
1029 1039
1030 if (needs_activate) 1040 if (needs_activate)
@@ -1207,7 +1217,23 @@ LLFloaterIMPanel::~LLFloaterIMPanel()
1207{ 1217{
1208 delete mSpeakers; 1218 delete mSpeakers;
1209 mSpeakers = NULL; 1219 mSpeakers = NULL;
1210 1220
1221 // End the text IM session if necessary
1222 if(gVoiceClient && mOtherParticipantUUID.notNull())
1223 {
1224 switch(mDialog)
1225 {
1226 case IM_NOTHING_SPECIAL:
1227 case IM_SESSION_P2P_INVITE:
1228 gVoiceClient->endUserIMSession(mOtherParticipantUUID);
1229 break;
1230
1231 default:
1232 // Appease the compiler
1233 break;
1234 }
1235 }
1236
1211 //kicks you out of the voice channel if it is currently active 1237 //kicks you out of the voice channel if it is currently active
1212 1238
1213 // HAVE to do this here -- if it happens in the LLVoiceChannel destructor it will call the wrong version (since the object's partially deconstructed at that point). 1239 // HAVE to do this here -- if it happens in the LLVoiceChannel destructor it will call the wrong version (since the object's partially deconstructed at that point).
@@ -1872,33 +1898,45 @@ void deliver_message(const std::string& utf8_text,
1872 EInstantMessage dialog) 1898 EInstantMessage dialog)
1873{ 1899{
1874 std::string name; 1900 std::string name;
1901 bool sent = false;
1875 gAgent.buildFullname(name); 1902 gAgent.buildFullname(name);
1876 1903
1877 const LLRelationship* info = NULL; 1904 const LLRelationship* info = NULL;
1878 info = LLAvatarTracker::instance().getBuddyInfo(other_participant_id); 1905 info = LLAvatarTracker::instance().getBuddyInfo(other_participant_id);
1906
1879 U8 offline = (!info || info->isOnline()) ? IM_ONLINE : IM_OFFLINE; 1907 U8 offline = (!info || info->isOnline()) ? IM_ONLINE : IM_OFFLINE;
1880 1908
1881 // default to IM_SESSION_SEND unless it's nothing special - in 1909 if((offline == IM_OFFLINE) && (LLVoiceClient::getInstance()->isOnlineSIP(other_participant_id)))
1882 // which case it's probably an IM to everyone.
1883 U8 new_dialog = dialog;
1884
1885 if ( dialog != IM_NOTHING_SPECIAL )
1886 { 1910 {
1887 new_dialog = IM_SESSION_SEND; 1911 // User is online through the OOW connector, but not with a regular viewer. Try to send the message via SLVoice.
1912 sent = gVoiceClient->sendTextMessage(other_participant_id, utf8_text);
1888 } 1913 }
1914
1915 if(!sent)
1916 {
1917 // Send message normally.
1889 1918
1890 pack_instant_message( 1919 // default to IM_SESSION_SEND unless it's nothing special - in
1891 gMessageSystem, 1920 // which case it's probably an IM to everyone.
1892 gAgent.getID(), 1921 U8 new_dialog = dialog;
1893 FALSE, 1922
1894 gAgent.getSessionID(), 1923 if ( dialog != IM_NOTHING_SPECIAL )
1895 other_participant_id, 1924 {
1896 name, 1925 new_dialog = IM_SESSION_SEND;
1897 utf8_text, 1926 }
1898 offline, 1927 pack_instant_message(
1899 (EInstantMessage)new_dialog, 1928 gMessageSystem,
1900 im_session_id); 1929 gAgent.getID(),
1901 gAgent.sendReliableMessage(); 1930 FALSE,
1931 gAgent.getSessionID(),
1932 other_participant_id,
1933 name.c_str(),
1934 utf8_text.c_str(),
1935 offline,
1936 (EInstantMessage)new_dialog,
1937 im_session_id);
1938 gAgent.sendReliableMessage();
1939 }
1902 1940
1903 // If there is a mute list and this is not a group chat... 1941 // If there is a mute list and this is not a group chat...
1904 if ( LLMuteList::getInstance() ) 1942 if ( LLMuteList::getInstance() )