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