This fixes the crash reported in http://opensimulator.org/mantis/view.php?id=5529 related to sending IMs to foreign friends who are offline. Hopefully.

bulletsim
Diva Canto 2011-06-07 10:51:12 -07:00
parent 1a23d322ac
commit f5d82350bb
6 changed files with 32 additions and 33 deletions

View File

@ -196,10 +196,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
Util.FireAndForget(delegate
{
bool success = m_IMService.OutgoingInstantMessage(im, url, foreigner);
if (!success && account == null)
bool success = false;
if (foreigner && url == string.Empty) // we don't know about this user
{
// One last chance
string recipientUUI = TryGetRecipientUUI(new UUID(im.fromAgentID), toAgentID);
m_log.DebugFormat("[HG MESSAGE TRANSFER]: Got UUI {0}", recipientUUI);
if (recipientUUI != string.Empty)
@ -213,6 +212,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
}
}
}
else
success = m_IMService.OutgoingInstantMessage(im, url, foreigner);
if (!success && !foreigner)
HandleUndeliveredMessage(im, result);
else

View File

@ -268,18 +268,18 @@ namespace OpenSim.Server.Handlers.Hypergrid
ids.Add(requestData[key].ToString());
}
List<UUID> online = m_HomeUsersService.GetOnlineFriends(userID, ids);
if (online.Count > 0)
{
int i = 0;
foreach (UUID id in online)
{
hash["friend_" + i.ToString()] = id.ToString();
i++;
}
}
else
hash["result"] = "No Friends Online";
//List<UUID> online = m_HomeUsersService.GetOnlineFriends(userID, ids);
//if (online.Count > 0)
//{
// int i = 0;
// foreach (UUID id in online)
// {
// hash["friend_" + i.ToString()] = id.ToString();
// i++;
// }
//}
//else
// hash["result"] = "No Friends Online";
}
XmlRpcResponse response = new XmlRpcResponse();

View File

@ -185,7 +185,6 @@ namespace OpenSim.Services.HypergridService
{
lookupAgent = true;
upd = null;
url = string.Empty;
}
}
else
@ -221,19 +220,16 @@ namespace OpenSim.Services.HypergridService
url = m_UserAgentService.LocateUser(toAgentID);
}
if (upd != null || url != string.Empty)
// check if we've tried this before..
// This is one way to end the recursive loop
//
if (!firstTime && ((previousLocation is PresenceInfo && upd != null && upd.RegionID == ((PresenceInfo)previousLocation).RegionID) ||
(previousLocation is string && upd == null && previousLocation.Equals(url))))
{
// check if we've tried this before..
// This is one way to end the recursive loop
//
if (!firstTime && ((previousLocation is PresenceInfo && upd != null && upd.RegionID == ((PresenceInfo)previousLocation).RegionID) ||
(previousLocation is string && upd == null && previousLocation.Equals(url))))
{
// m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message");
m_log.DebugFormat("[HG IM SERVICE]: Fail 2 {0} {1}", previousLocation, url);
// m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message");
m_log.DebugFormat("[HG IM SERVICE]: Fail 2 {0} {1}", previousLocation, url);
return false;
}
return false;
}
}
@ -332,10 +328,6 @@ namespace OpenSim.Services.HypergridService
else
{
// try again, but lookup user this time.
// Warning, this must call the Async version
// of this method or we'll be making thousands of threads
// The version within the spawned thread is SendGridInstantMessageViaXMLRPCAsync
// The version that spawns the thread is SendGridInstantMessageViaXMLRPC
// This is recursive!!!!!
return TrySendInstantMessage(im, url, false, foreigner);
@ -348,13 +340,17 @@ namespace OpenSim.Services.HypergridService
if (m_RestURL != string.Empty && (im.offline != 0)
&& (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages)))
{
m_log.DebugFormat("[HG IM SERVICE]: Message saved");
return SynchronousRestObjectPoster.BeginPostObject<GridInstantMessage, bool>(
"POST", m_RestURL + "/SaveMessage/", im);
}
else
{
m_log.DebugFormat("[HG IM SERVICE]: No offline IM service, message not saved");
return false;
}
}
}
}

View File

@ -482,7 +482,7 @@ namespace OpenSim.Services.HypergridService
{
foreach (TravelingAgentInfo t in m_TravelingAgents.Values)
{
if (t.UserID == userID)
if (t.UserID == userID && !m_GridName.Equals(t.GridExternalName))
return t.GridExternalName;
}

View File

@ -62,7 +62,7 @@ namespace OpenSim.Services.Interfaces
string GetUUI(UUID userID, UUID targetUserID);
void StatusNotification(List<string> friends, UUID userID, bool online);
List<UUID> GetOnlineFriends(UUID userID, List<string> friends);
//List<UUID> GetOnlineFriends(UUID userID, List<string> friends);
bool AgentIsComingHome(UUID sessionID, string thisGridExternalName);
bool VerifyAgent(UUID sessionID, string token);

View File

@ -160,6 +160,7 @@
GridService = "OpenSim.Services.GridService.dll:GridService"
PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService"
InGatekeeper = True
;; This should always be the very last thing on this file