Bug fix on HG IM.
parent
f2f30a7890
commit
4696a9c95e
|
@ -187,12 +187,16 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
// Is the user a local user?
|
// Is the user a local user?
|
||||||
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, toAgentID);
|
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, toAgentID);
|
||||||
string url = string.Empty;
|
string url = string.Empty;
|
||||||
|
bool foreigner = false;
|
||||||
if (account == null) // foreign user
|
if (account == null) // foreign user
|
||||||
|
{
|
||||||
url = UserManagementModule.GetUserServerURL(toAgentID, "IMServerURI");
|
url = UserManagementModule.GetUserServerURL(toAgentID, "IMServerURI");
|
||||||
|
foreigner = true;
|
||||||
|
}
|
||||||
|
|
||||||
Util.FireAndForget(delegate
|
Util.FireAndForget(delegate
|
||||||
{
|
{
|
||||||
bool success = m_IMService.OutgoingInstantMessage(im, url);
|
bool success = m_IMService.OutgoingInstantMessage(im, url, foreigner);
|
||||||
if (!success && account == null)
|
if (!success && account == null)
|
||||||
{
|
{
|
||||||
// One last chance
|
// One last chance
|
||||||
|
@ -203,7 +207,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
UUID id; string u = string.Empty, first = string.Empty, last = string.Empty, secret = string.Empty;
|
UUID id; string u = string.Empty, first = string.Empty, last = string.Empty, secret = string.Empty;
|
||||||
if (Util.ParseUniversalUserIdentifier(recipientUUI, out id, out u, out first, out last, out secret))
|
if (Util.ParseUniversalUserIdentifier(recipientUUI, out id, out u, out first, out last, out secret))
|
||||||
{
|
{
|
||||||
success = m_IMService.OutgoingInstantMessage(im, u);
|
success = m_IMService.OutgoingInstantMessage(im, u, true);
|
||||||
if (success)
|
if (success)
|
||||||
UserManagementModule.AddUser(toAgentID, u + ";" + first + " " + last);
|
UserManagementModule.AddUser(toAgentID, u + ";" + first + " " + last);
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,23 +115,23 @@ namespace OpenSim.Services.HypergridService
|
||||||
return m_IMSimConnector.SendInstantMessage(im);
|
return m_IMSimConnector.SendInstantMessage(im);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return TrySendInstantMessage(im, "", true);
|
return TrySendInstantMessage(im, "", true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OutgoingInstantMessage(GridInstantMessage im, string url)
|
public bool OutgoingInstantMessage(GridInstantMessage im, string url, bool foreigner)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[HG IM SERVICE]: Sending message from {0} to {1}@{2}", im.fromAgentID, im.toAgentID, url);
|
m_log.DebugFormat("[HG IM SERVICE]: Sending message from {0} to {1}@{2}", im.fromAgentID, im.toAgentID, url);
|
||||||
if (url != string.Empty)
|
if (url != string.Empty)
|
||||||
return TrySendInstantMessage(im, url, true);
|
return TrySendInstantMessage(im, url, true, foreigner);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PresenceInfo upd = new PresenceInfo();
|
PresenceInfo upd = new PresenceInfo();
|
||||||
upd.RegionID = UUID.Zero;
|
upd.RegionID = UUID.Zero;
|
||||||
return TrySendInstantMessage(im, upd, true);
|
return TrySendInstantMessage(im, upd, true, foreigner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected bool TrySendInstantMessage(GridInstantMessage im, object previousLocation, bool firstTime)
|
protected bool TrySendInstantMessage(GridInstantMessage im, object previousLocation, bool firstTime, bool foreigner)
|
||||||
{
|
{
|
||||||
UUID toAgentID = new UUID(im.toAgentID);
|
UUID toAgentID = new UUID(im.toAgentID);
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ namespace OpenSim.Services.HypergridService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (upd == null)
|
if (upd == null && !foreigner)
|
||||||
{
|
{
|
||||||
// Let's check with the UAS if the user is elsewhere
|
// Let's check with the UAS if the user is elsewhere
|
||||||
m_log.DebugFormat("[HG IM SERVICE]: User is not present. Checking location with User Agent service");
|
m_log.DebugFormat("[HG IM SERVICE]: User is not present. Checking location with User Agent service");
|
||||||
|
@ -213,25 +213,25 @@ namespace OpenSim.Services.HypergridService
|
||||||
// ok, the user is around somewhere. Let's send back the reply with "success"
|
// ok, the user is around somewhere. Let's send back the reply with "success"
|
||||||
// even though the IM may still fail. Just don't keep the caller waiting for
|
// even though the IM may still fail. Just don't keep the caller waiting for
|
||||||
// the entire time we're trying to deliver the IM
|
// the entire time we're trying to deliver the IM
|
||||||
return SendIMToRegion(upd, im, toAgentID);
|
return SendIMToRegion(upd, im, toAgentID, foreigner);
|
||||||
}
|
}
|
||||||
else if (url != string.Empty)
|
else if (url != string.Empty)
|
||||||
{
|
{
|
||||||
// ok, the user is around somewhere. Let's send back the reply with "success"
|
// ok, the user is around somewhere. Let's send back the reply with "success"
|
||||||
// even though the IM may still fail. Just don't keep the caller waiting for
|
// even though the IM may still fail. Just don't keep the caller waiting for
|
||||||
// the entire time we're trying to deliver the IM
|
// the entire time we're trying to deliver the IM
|
||||||
return ForwardIMToGrid(url, im, toAgentID);
|
return ForwardIMToGrid(url, im, toAgentID, foreigner);
|
||||||
}
|
}
|
||||||
else if (firstTime && previousLocation is string && (string)previousLocation != string.Empty)
|
else if (firstTime && previousLocation is string && (string)previousLocation != string.Empty)
|
||||||
{
|
{
|
||||||
return ForwardIMToGrid((string)previousLocation, im, toAgentID);
|
return ForwardIMToGrid((string)previousLocation, im, toAgentID, foreigner);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_log.DebugFormat("[HG IM SERVICE]: Unable to locate user {0}", toAgentID);
|
m_log.DebugFormat("[HG IM SERVICE]: Unable to locate user {0}", toAgentID);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SendIMToRegion(PresenceInfo upd, GridInstantMessage im, UUID toAgentID)
|
bool SendIMToRegion(PresenceInfo upd, GridInstantMessage im, UUID toAgentID, bool foreigner)
|
||||||
{
|
{
|
||||||
bool imresult = false;
|
bool imresult = false;
|
||||||
GridRegion reginfo = null;
|
GridRegion reginfo = null;
|
||||||
|
@ -277,11 +277,11 @@ namespace OpenSim.Services.HypergridService
|
||||||
// The version that spawns the thread is SendGridInstantMessageViaXMLRPC
|
// The version that spawns the thread is SendGridInstantMessageViaXMLRPC
|
||||||
|
|
||||||
// This is recursive!!!!!
|
// This is recursive!!!!!
|
||||||
return TrySendInstantMessage(im, upd, false);
|
return TrySendInstantMessage(im, upd, false, foreigner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ForwardIMToGrid(string url, GridInstantMessage im, UUID toAgentID)
|
bool ForwardIMToGrid(string url, GridInstantMessage im, UUID toAgentID, bool foreigner)
|
||||||
{
|
{
|
||||||
if (InstantMessageServiceConnector.SendInstantMessage(url, im))
|
if (InstantMessageServiceConnector.SendInstantMessage(url, im))
|
||||||
{
|
{
|
||||||
|
@ -309,7 +309,7 @@ namespace OpenSim.Services.HypergridService
|
||||||
// The version that spawns the thread is SendGridInstantMessageViaXMLRPC
|
// The version that spawns the thread is SendGridInstantMessageViaXMLRPC
|
||||||
|
|
||||||
// This is recursive!!!!!
|
// This is recursive!!!!!
|
||||||
return TrySendInstantMessage(im, url, false);
|
return TrySendInstantMessage(im, url, false, foreigner);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ namespace OpenSim.Services.Interfaces
|
||||||
public interface IInstantMessage
|
public interface IInstantMessage
|
||||||
{
|
{
|
||||||
bool IncomingInstantMessage(GridInstantMessage im);
|
bool IncomingInstantMessage(GridInstantMessage im);
|
||||||
bool OutgoingInstantMessage(GridInstantMessage im, string url);
|
bool OutgoingInstantMessage(GridInstantMessage im, string url, bool foreigner);
|
||||||
}
|
}
|
||||||
public interface IFriendsSimConnector
|
public interface IFriendsSimConnector
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue