aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/Resources/FriendsStore.migrations3
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs8
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs4
-rw-r--r--OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs19
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs24
-rw-r--r--OpenSim/Services/Connectors/InstantMessage/InstantMessageServiceConnector.cs2
-rw-r--r--OpenSim/Services/HypergridService/HGInstantMessageService.cs26
-rw-r--r--OpenSim/Services/HypergridService/UserAgentService.cs7
-rw-r--r--OpenSim/Services/Interfaces/IHypergridServices.cs2
-rw-r--r--OpenSim/Tests/Clients/InstantMessage/IMClient.cs75
11 files changed, 134 insertions, 38 deletions
diff --git a/OpenSim/Data/MySQL/Resources/FriendsStore.migrations b/OpenSim/Data/MySQL/Resources/FriendsStore.migrations
index 35e5e93..7848e49 100644
--- a/OpenSim/Data/MySQL/Resources/FriendsStore.migrations
+++ b/OpenSim/Data/MySQL/Resources/FriendsStore.migrations
@@ -25,7 +25,8 @@ COMMIT;
25 25
26BEGIN; 26BEGIN;
27 27
28ALTER TABLE `Friends` DROP PRIMARY KEY;
29ALTER TABLE `Friends` ADD PRIMARY KEY(PrincipalID(36), Friend(36));
28ALTER TABLE `Friends` MODIFY COLUMN PrincipalID varchar(255) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; 30ALTER TABLE `Friends` MODIFY COLUMN PrincipalID varchar(255) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
29 31
30COMMIT; 32COMMIT;
31
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/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs
index e04fff6..079e1b6 100644
--- a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs
@@ -57,9 +57,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile
57 57
58 public void Initialise(IConfigSource config) 58 public void Initialise(IConfigSource config)
59 { 59 {
60 if (config.Configs["Profiles"] != null) 60 if (config.Configs["Profile"] != null)
61 { 61 {
62 if (config.Configs["Profiles"].GetString("Module", string.Empty) != "BasicProfileModule") 62 if (config.Configs["Profile"].GetString("Module", string.Empty) != "BasicProfileModule")
63 return; 63 return;
64 } 64 }
65 65
diff --git a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs
index 9969086..fc97d8c 100644
--- a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs
@@ -160,9 +160,9 @@ namespace OpenSim.Server.Handlers.Friends
160 160
161 byte[] StoreFriend(Dictionary<string, object> request) 161 byte[] StoreFriend(Dictionary<string, object> request)
162 { 162 {
163 FriendInfo friend = new FriendInfo(request); 163 string principalID = string.Empty, friend = string.Empty; int flags = 0;
164 164 FromKeyValuePairs(request, out principalID, out friend, out flags);
165 bool success = m_FriendsService.StoreFriend(friend.PrincipalID.ToString(), friend.Friend, friend.MyFlags); 165 bool success = m_FriendsService.StoreFriend(principalID, friend, flags);
166 166
167 if (success) 167 if (success)
168 return SuccessResult(); 168 return SuccessResult();
@@ -275,6 +275,19 @@ namespace OpenSim.Server.Handlers.Friends
275 return ms.ToArray(); 275 return ms.ToArray();
276 } 276 }
277 277
278 void FromKeyValuePairs(Dictionary<string, object> kvp, out string principalID, out string friend, out int flags)
279 {
280 principalID = string.Empty;
281 if (kvp.ContainsKey("PrincipalID") && kvp["PrincipalID"] != null)
282 principalID = kvp["PrincipalID"].ToString();
283 friend = string.Empty;
284 if (kvp.ContainsKey("Friend") && kvp["Friend"] != null)
285 friend = kvp["Friend"].ToString();
286 flags = 0;
287 if (kvp.ContainsKey("MyFlags") && kvp["MyFlags"] != null)
288 Int32.TryParse(kvp["MyFlags"].ToString(), out flags);
289 }
290
278 #endregion 291 #endregion
279 } 292 }
280} 293}
diff --git a/OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs
index 74b7422..80eb5d2 100644
--- a/OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs
@@ -72,7 +72,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
72 if (m_IMService == null) 72 if (m_IMService == null)
73 throw new Exception("InstantMessage server connector cannot proceed because of missing service"); 73 throw new Exception("InstantMessage server connector cannot proceed because of missing service");
74 74
75 MainServer.Instance.AddXmlRPCHandler("grid_instant_message", ProcessInstantMessage, false); 75 server.AddXmlRPCHandler("grid_instant_message", ProcessInstantMessage, false);
76 76
77 } 77 }
78 78
diff --git a/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs
index 08f1dc3..c5ae0c0 100644
--- a/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs
@@ -161,19 +161,8 @@ namespace OpenSim.Services.Connectors.Friends
161 161
162 public bool StoreFriend(string PrincipalID, string Friend, int flags) 162 public bool StoreFriend(string PrincipalID, string Friend, int flags)
163 { 163 {
164 FriendInfo finfo = new FriendInfo();
165 try
166 {
167 finfo.PrincipalID = new UUID(PrincipalID);
168 }
169 catch
170 {
171 return false;
172 }
173 finfo.Friend = Friend;
174 finfo.MyFlags = flags;
175 164
176 Dictionary<string, object> sendData = finfo.ToKeyValuePairs(); 165 Dictionary<string, object> sendData = ToKeyValuePairs(PrincipalID, Friend, flags);
177 166
178 sendData["METHOD"] = "storefriend"; 167 sendData["METHOD"] = "storefriend";
179 168
@@ -267,5 +256,16 @@ namespace OpenSim.Services.Connectors.Friends
267 } 256 }
268 257
269 #endregion 258 #endregion
259
260 public Dictionary<string, object> ToKeyValuePairs(string principalID, string friend, int flags)
261 {
262 Dictionary<string, object> result = new Dictionary<string, object>();
263 result["PrincipalID"] = principalID;
264 result["Friend"] = friend;
265 result["MyFlags"] = flags;
266
267 return result;
268 }
269
270 } 270 }
271} \ No newline at end of file 271} \ No newline at end of file
diff --git a/OpenSim/Services/Connectors/InstantMessage/InstantMessageServiceConnector.cs b/OpenSim/Services/Connectors/InstantMessage/InstantMessageServiceConnector.cs
index 161be02..dbce9f6 100644
--- a/OpenSim/Services/Connectors/InstantMessage/InstantMessageServiceConnector.cs
+++ b/OpenSim/Services/Connectors/InstantMessage/InstantMessageServiceConnector.cs
@@ -61,7 +61,7 @@ namespace OpenSim.Services.Connectors.InstantMessage
61 try 61 try
62 { 62 {
63 63
64 XmlRpcResponse GridResp = GridReq.Send(url, 3000); 64 XmlRpcResponse GridResp = GridReq.Send(url, 10000);
65 65
66 Hashtable responseData = (Hashtable)GridResp.Value; 66 Hashtable responseData = (Hashtable)GridResp.Value;
67 67
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/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs
index 387547e..2f2ebfb 100644
--- a/OpenSim/Services/HypergridService/UserAgentService.cs
+++ b/OpenSim/Services/HypergridService/UserAgentService.cs
@@ -197,8 +197,11 @@ namespace OpenSim.Services.HypergridService
197 agentCircuit.firstname, agentCircuit.lastname, region.ServerURI, reason); 197 agentCircuit.firstname, agentCircuit.lastname, region.ServerURI, reason);
198 198
199 // restore the old travel info 199 // restore the old travel info
200 lock (m_TravelingAgents) 200 if(reason != "Logins Disabled")
201 m_TravelingAgents[agentCircuit.SessionID] = old; 201 {
202 lock (m_TravelingAgents)
203 m_TravelingAgents[agentCircuit.SessionID] = old;
204 }
202 205
203 return false; 206 return false;
204 } 207 }
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 {
diff --git a/OpenSim/Tests/Clients/InstantMessage/IMClient.cs b/OpenSim/Tests/Clients/InstantMessage/IMClient.cs
new file mode 100644
index 0000000..e7304a2
--- /dev/null
+++ b/OpenSim/Tests/Clients/InstantMessage/IMClient.cs
@@ -0,0 +1,75 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Text;
31using System.Reflection;
32
33using OpenMetaverse;
34using log4net;
35using log4net.Appender;
36using log4net.Layout;
37
38using OpenSim.Framework;
39using OpenSim.Services.Interfaces;
40using OpenSim.Services.Connectors.InstantMessage;
41
42namespace OpenSim.Tests.Clients.InstantMessage
43{
44 public class IMClient
45 {
46 private static readonly ILog m_log =
47 LogManager.GetLogger(
48 MethodBase.GetCurrentMethod().DeclaringType);
49
50 public static void Main(string[] args)
51 {
52 ConsoleAppender consoleAppender = new ConsoleAppender();
53 consoleAppender.Layout =
54 new PatternLayout("%date [%thread] %-5level %logger [%property{NDC}] - %message%newline");
55 log4net.Config.BasicConfigurator.Configure(consoleAppender);
56
57 string serverURI = "http://127.0.0.1:8002";
58 GridInstantMessage im = new GridInstantMessage();
59 im.fromAgentID = new Guid();
60 im.toAgentID = new Guid();
61 im.message = "Hello";
62 im.imSessionID = new Guid();
63
64 bool success = InstantMessageServiceConnector.SendInstantMessage(serverURI, im);
65
66 if (success)
67 m_log.InfoFormat("[IM CLIENT]: Successfully IMed {0}", serverURI);
68 else
69 m_log.InfoFormat("[IM CLIENT]: failed to IM {0}", serverURI);
70
71 System.Console.WriteLine("\n");
72 }
73
74 }
75}