diff options
3 files changed, 20 insertions, 16 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs index e0c404b..4de197e 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs | |||
@@ -187,12 +187,16 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
187 | // Is the user a local user? | 187 | // Is the user a local user? |
188 | UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, toAgentID); | 188 | UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, toAgentID); |
189 | string url = string.Empty; | 189 | string url = string.Empty; |
190 | bool foreigner = false; | ||
190 | if (account == null) // foreign user | 191 | if (account == null) // foreign user |
192 | { | ||
191 | url = UserManagementModule.GetUserServerURL(toAgentID, "IMServerURI"); | 193 | url = UserManagementModule.GetUserServerURL(toAgentID, "IMServerURI"); |
194 | foreigner = true; | ||
195 | } | ||
192 | 196 | ||
193 | Util.FireAndForget(delegate | 197 | Util.FireAndForget(delegate |
194 | { | 198 | { |
195 | bool success = m_IMService.OutgoingInstantMessage(im, url); | 199 | bool success = m_IMService.OutgoingInstantMessage(im, url, foreigner); |
196 | if (!success && account == null) | 200 | if (!success && account == null) |
197 | { | 201 | { |
198 | // One last chance | 202 | // One last chance |
@@ -203,7 +207,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
203 | UUID id; string u = string.Empty, first = string.Empty, last = string.Empty, secret = string.Empty; | 207 | UUID id; string u = string.Empty, first = string.Empty, last = string.Empty, secret = string.Empty; |
204 | if (Util.ParseUniversalUserIdentifier(recipientUUI, out id, out u, out first, out last, out secret)) | 208 | if (Util.ParseUniversalUserIdentifier(recipientUUI, out id, out u, out first, out last, out secret)) |
205 | { | 209 | { |
206 | success = m_IMService.OutgoingInstantMessage(im, u); | 210 | success = m_IMService.OutgoingInstantMessage(im, u, true); |
207 | if (success) | 211 | if (success) |
208 | UserManagementModule.AddUser(toAgentID, u + ";" + first + " " + last); | 212 | UserManagementModule.AddUser(toAgentID, u + ";" + first + " " + last); |
209 | } | 213 | } |
diff --git a/OpenSim/Services/HypergridService/HGInstantMessageService.cs b/OpenSim/Services/HypergridService/HGInstantMessageService.cs index dd5fd71..4f68e55 100644 --- a/OpenSim/Services/HypergridService/HGInstantMessageService.cs +++ b/OpenSim/Services/HypergridService/HGInstantMessageService.cs | |||
@@ -115,23 +115,23 @@ namespace OpenSim.Services.HypergridService | |||
115 | return m_IMSimConnector.SendInstantMessage(im); | 115 | return m_IMSimConnector.SendInstantMessage(im); |
116 | } | 116 | } |
117 | else | 117 | else |
118 | return TrySendInstantMessage(im, "", true); | 118 | return TrySendInstantMessage(im, "", true, false); |
119 | } | 119 | } |
120 | 120 | ||
121 | public bool OutgoingInstantMessage(GridInstantMessage im, string url) | 121 | public bool OutgoingInstantMessage(GridInstantMessage im, string url, bool foreigner) |
122 | { | 122 | { |
123 | m_log.DebugFormat("[HG IM SERVICE]: Sending message from {0} to {1}@{2}", im.fromAgentID, im.toAgentID, url); | 123 | m_log.DebugFormat("[HG IM SERVICE]: Sending message from {0} to {1}@{2}", im.fromAgentID, im.toAgentID, url); |
124 | if (url != string.Empty) | 124 | if (url != string.Empty) |
125 | return TrySendInstantMessage(im, url, true); | 125 | return TrySendInstantMessage(im, url, true, foreigner); |
126 | else | 126 | else |
127 | { | 127 | { |
128 | PresenceInfo upd = new PresenceInfo(); | 128 | PresenceInfo upd = new PresenceInfo(); |
129 | upd.RegionID = UUID.Zero; | 129 | upd.RegionID = UUID.Zero; |
130 | return TrySendInstantMessage(im, upd, true); | 130 | return TrySendInstantMessage(im, upd, true, foreigner); |
131 | } | 131 | } |
132 | } | 132 | } |
133 | 133 | ||
134 | protected bool TrySendInstantMessage(GridInstantMessage im, object previousLocation, bool firstTime) | 134 | protected bool TrySendInstantMessage(GridInstantMessage im, object previousLocation, bool firstTime, bool foreigner) |
135 | { | 135 | { |
136 | UUID toAgentID = new UUID(im.toAgentID); | 136 | UUID toAgentID = new UUID(im.toAgentID); |
137 | 137 | ||
@@ -185,7 +185,7 @@ namespace OpenSim.Services.HypergridService | |||
185 | } | 185 | } |
186 | } | 186 | } |
187 | 187 | ||
188 | if (upd == null) | 188 | if (upd == null && !foreigner) |
189 | { | 189 | { |
190 | // Let's check with the UAS if the user is elsewhere | 190 | // Let's check with the UAS if the user is elsewhere |
191 | m_log.DebugFormat("[HG IM SERVICE]: User is not present. Checking location with User Agent service"); | 191 | m_log.DebugFormat("[HG IM SERVICE]: User is not present. Checking location with User Agent service"); |
@@ -213,25 +213,25 @@ namespace OpenSim.Services.HypergridService | |||
213 | // ok, the user is around somewhere. Let's send back the reply with "success" | 213 | // ok, the user is around somewhere. Let's send back the reply with "success" |
214 | // even though the IM may still fail. Just don't keep the caller waiting for | 214 | // even though the IM may still fail. Just don't keep the caller waiting for |
215 | // the entire time we're trying to deliver the IM | 215 | // the entire time we're trying to deliver the IM |
216 | return SendIMToRegion(upd, im, toAgentID); | 216 | return SendIMToRegion(upd, im, toAgentID, foreigner); |
217 | } | 217 | } |
218 | else if (url != string.Empty) | 218 | else if (url != string.Empty) |
219 | { | 219 | { |
220 | // ok, the user is around somewhere. Let's send back the reply with "success" | 220 | // ok, the user is around somewhere. Let's send back the reply with "success" |
221 | // even though the IM may still fail. Just don't keep the caller waiting for | 221 | // even though the IM may still fail. Just don't keep the caller waiting for |
222 | // the entire time we're trying to deliver the IM | 222 | // the entire time we're trying to deliver the IM |
223 | return ForwardIMToGrid(url, im, toAgentID); | 223 | return ForwardIMToGrid(url, im, toAgentID, foreigner); |
224 | } | 224 | } |
225 | else if (firstTime && previousLocation is string && (string)previousLocation != string.Empty) | 225 | else if (firstTime && previousLocation is string && (string)previousLocation != string.Empty) |
226 | { | 226 | { |
227 | return ForwardIMToGrid((string)previousLocation, im, toAgentID); | 227 | return ForwardIMToGrid((string)previousLocation, im, toAgentID, foreigner); |
228 | } | 228 | } |
229 | else | 229 | else |
230 | m_log.DebugFormat("[HG IM SERVICE]: Unable to locate user {0}", toAgentID); | 230 | m_log.DebugFormat("[HG IM SERVICE]: Unable to locate user {0}", toAgentID); |
231 | return false; | 231 | return false; |
232 | } | 232 | } |
233 | 233 | ||
234 | bool SendIMToRegion(PresenceInfo upd, GridInstantMessage im, UUID toAgentID) | 234 | bool SendIMToRegion(PresenceInfo upd, GridInstantMessage im, UUID toAgentID, bool foreigner) |
235 | { | 235 | { |
236 | bool imresult = false; | 236 | bool imresult = false; |
237 | GridRegion reginfo = null; | 237 | GridRegion reginfo = null; |
@@ -277,11 +277,11 @@ namespace OpenSim.Services.HypergridService | |||
277 | // The version that spawns the thread is SendGridInstantMessageViaXMLRPC | 277 | // The version that spawns the thread is SendGridInstantMessageViaXMLRPC |
278 | 278 | ||
279 | // This is recursive!!!!! | 279 | // This is recursive!!!!! |
280 | return TrySendInstantMessage(im, upd, false); | 280 | return TrySendInstantMessage(im, upd, false, foreigner); |
281 | } | 281 | } |
282 | } | 282 | } |
283 | 283 | ||
284 | bool ForwardIMToGrid(string url, GridInstantMessage im, UUID toAgentID) | 284 | bool ForwardIMToGrid(string url, GridInstantMessage im, UUID toAgentID, bool foreigner) |
285 | { | 285 | { |
286 | if (InstantMessageServiceConnector.SendInstantMessage(url, im)) | 286 | if (InstantMessageServiceConnector.SendInstantMessage(url, im)) |
287 | { | 287 | { |
@@ -309,7 +309,7 @@ namespace OpenSim.Services.HypergridService | |||
309 | // The version that spawns the thread is SendGridInstantMessageViaXMLRPC | 309 | // The version that spawns the thread is SendGridInstantMessageViaXMLRPC |
310 | 310 | ||
311 | // This is recursive!!!!! | 311 | // This is recursive!!!!! |
312 | return TrySendInstantMessage(im, url, false); | 312 | return TrySendInstantMessage(im, url, false, foreigner); |
313 | } | 313 | } |
314 | 314 | ||
315 | } | 315 | } |
diff --git a/OpenSim/Services/Interfaces/IHypergridServices.cs b/OpenSim/Services/Interfaces/IHypergridServices.cs index 753c205..82ec8ce 100644 --- a/OpenSim/Services/Interfaces/IHypergridServices.cs +++ b/OpenSim/Services/Interfaces/IHypergridServices.cs | |||
@@ -72,7 +72,7 @@ namespace OpenSim.Services.Interfaces | |||
72 | public interface IInstantMessage | 72 | public interface IInstantMessage |
73 | { | 73 | { |
74 | bool IncomingInstantMessage(GridInstantMessage im); | 74 | bool IncomingInstantMessage(GridInstantMessage im); |
75 | bool OutgoingInstantMessage(GridInstantMessage im, string url); | 75 | bool OutgoingInstantMessage(GridInstantMessage im, string url, bool foreigner); |
76 | } | 76 | } |
77 | public interface IFriendsSimConnector | 77 | public interface IFriendsSimConnector |
78 | { | 78 | { |