diff options
author | Diva Canto | 2010-06-04 10:59:59 -0700 |
---|---|---|
committer | Diva Canto | 2010-06-04 10:59:59 -0700 |
commit | 952029380a6a038e382dd3b2c312b3e16ff08625 (patch) | |
tree | 400586c159859d0ff437685d4c37179e8cba89f1 | |
parent | Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff) | |
download | opensim-SC_OLD-952029380a6a038e382dd3b2c312b3e16ff08625.zip opensim-SC_OLD-952029380a6a038e382dd3b2c312b3e16ff08625.tar.gz opensim-SC_OLD-952029380a6a038e382dd3b2c312b3e16ff08625.tar.bz2 opensim-SC_OLD-952029380a6a038e382dd3b2c312b3e16ff08625.tar.xz |
Fixed a couple of buglets in Friendship offers / acceptance / decline when avies are in different sims.
9 files changed, 58 insertions, 34 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 0c81f44..0050653 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -111,10 +111,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
111 | 111 | ||
112 | protected IGridService GridService | 112 | protected IGridService GridService |
113 | { | 113 | { |
114 | get | 114 | get { return m_Scenes[0].GridService; } |
115 | { | 115 | } |
116 | return m_Scenes[0].GridService; | 116 | |
117 | } | 117 | public IUserAccountService UserAccountService |
118 | { | ||
119 | get { return m_Scenes[0].UserAccountService; } | ||
118 | } | 120 | } |
119 | 121 | ||
120 | public IScene Scene | 122 | public IScene Scene |
@@ -220,33 +222,37 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
220 | 222 | ||
221 | client.OnLogout += OnLogout; | 223 | client.OnLogout += OnLogout; |
222 | 224 | ||
223 | if (m_Friends.ContainsKey(client.AgentId)) | 225 | lock (m_Friends) |
224 | { | 226 | { |
225 | m_Friends[client.AgentId].Refcount++; | 227 | if (m_Friends.ContainsKey(client.AgentId)) |
226 | return; | 228 | { |
227 | } | 229 | m_Friends[client.AgentId].Refcount++; |
230 | return; | ||
231 | } | ||
228 | 232 | ||
229 | UserFriendData newFriends = new UserFriendData(); | 233 | UserFriendData newFriends = new UserFriendData(); |
230 | 234 | ||
231 | newFriends.PrincipalID = client.AgentId; | 235 | newFriends.PrincipalID = client.AgentId; |
232 | newFriends.Friends = m_FriendsService.GetFriends(client.AgentId); | 236 | newFriends.Friends = m_FriendsService.GetFriends(client.AgentId); |
233 | newFriends.Refcount = 1; | 237 | newFriends.Refcount = 1; |
234 | newFriends.RegionID = UUID.Zero; | 238 | newFriends.RegionID = UUID.Zero; |
235 | 239 | ||
236 | m_Friends.Add(client.AgentId, newFriends); | 240 | m_Friends.Add(client.AgentId, newFriends); |
241 | } | ||
237 | 242 | ||
238 | //StatusChange(client.AgentId, true); | 243 | //StatusChange(client.AgentId, true); |
239 | } | 244 | } |
240 | 245 | ||
241 | private void OnClientClosed(UUID agentID, Scene scene) | 246 | private void OnClientClosed(UUID agentID, Scene scene) |
242 | { | 247 | { |
243 | if (m_Friends.ContainsKey(agentID)) | 248 | lock (m_Friends) |
244 | { | 249 | if (m_Friends.ContainsKey(agentID)) |
245 | if (m_Friends[agentID].Refcount == 1) | 250 | { |
246 | m_Friends.Remove(agentID); | 251 | if (m_Friends[agentID].Refcount == 1) |
247 | else | 252 | m_Friends.Remove(agentID); |
248 | m_Friends[agentID].Refcount--; | 253 | else |
249 | } | 254 | m_Friends[agentID].Refcount--; |
255 | } | ||
250 | } | 256 | } |
251 | 257 | ||
252 | private void OnLogout(IClientAPI client) | 258 | private void OnLogout(IClientAPI client) |
@@ -518,12 +524,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
518 | 524 | ||
519 | private void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders) | 525 | private void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders) |
520 | { | 526 | { |
527 | m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", agentID, friendID); | ||
528 | |||
521 | FriendsService.StoreFriend(agentID, friendID.ToString(), 1); | 529 | FriendsService.StoreFriend(agentID, friendID.ToString(), 1); |
522 | FriendsService.StoreFriend(friendID, agentID.ToString(), 1); | 530 | FriendsService.StoreFriend(friendID, agentID.ToString(), 1); |
523 | // update the local cache | 531 | // update the local cache |
524 | m_Friends[agentID].Friends = FriendsService.GetFriends(agentID); | 532 | m_Friends[agentID].Friends = FriendsService.GetFriends(agentID); |
525 | 533 | ||
526 | m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", agentID, friendID); | ||
527 | 534 | ||
528 | // | 535 | // |
529 | // Notify the friend | 536 | // Notify the friend |
@@ -572,7 +579,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
572 | if (friendSession != null) | 579 | if (friendSession != null) |
573 | { | 580 | { |
574 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); | 581 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); |
575 | m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID); | 582 | if (region != null) |
583 | m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID); | ||
584 | else | ||
585 | m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID); | ||
576 | } | 586 | } |
577 | } | 587 | } |
578 | } | 588 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs index 0883c5b..496f2ab 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs | |||
@@ -35,6 +35,7 @@ using OpenSim.Framework; | |||
35 | using OpenSim.Server.Base; | 35 | using OpenSim.Server.Base; |
36 | using OpenSim.Framework.Servers.HttpServer; | 36 | using OpenSim.Framework.Servers.HttpServer; |
37 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; | 37 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; |
38 | using OpenSim.Services.Interfaces; | ||
38 | 39 | ||
39 | using OpenMetaverse; | 40 | using OpenMetaverse; |
40 | using log4net; | 41 | using log4net; |
@@ -61,7 +62,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
61 | sr.Close(); | 62 | sr.Close(); |
62 | body = body.Trim(); | 63 | body = body.Trim(); |
63 | 64 | ||
64 | m_log.DebugFormat("[XXX]: query String: {0}", body); | 65 | //m_log.DebugFormat("[XXX]: query String: {0}", body); |
65 | 66 | ||
66 | try | 67 | try |
67 | { | 68 | { |
@@ -115,9 +116,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
115 | if (!UUID.TryParse(request["ToID"].ToString(), out toID)) | 116 | if (!UUID.TryParse(request["ToID"].ToString(), out toID)) |
116 | return FailureResult(); | 117 | return FailureResult(); |
117 | 118 | ||
118 | GridInstantMessage im = new GridInstantMessage(m_FriendsModule.Scene, fromID, "", toID, | 119 | UserAccount account = m_FriendsModule.UserAccountService.GetUserAccount(m_FriendsModule.Scene.RegionInfo.ScopeID, fromID); |
120 | string name = (account == null) ? "Unknown" : account.FirstName + " " + account.LastName; | ||
121 | |||
122 | GridInstantMessage im = new GridInstantMessage(m_FriendsModule.Scene, fromID, name, toID, | ||
119 | (byte)InstantMessageDialog.FriendshipOffered, message, false, Vector3.Zero); | 123 | (byte)InstantMessageDialog.FriendshipOffered, message, false, Vector3.Zero); |
120 | 124 | ||
125 | // !! HACK | ||
126 | im.imSessionID = im.fromAgentID; | ||
127 | |||
121 | if (m_FriendsModule.LocalFriendshipOffered(toID, im)) | 128 | if (m_FriendsModule.LocalFriendshipOffered(toID, im)) |
122 | return SuccessResult(); | 129 | return SuccessResult(); |
123 | 130 | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs index a355661..e1bc243 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs | |||
@@ -44,10 +44,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
44 | 44 | ||
45 | public UserAccountCache() | 45 | public UserAccountCache() |
46 | { | 46 | { |
47 | // Warning: the size values are a bit fuzzy. What matters | ||
48 | // most for this cache is the count value (128 entries). | ||
49 | m_UUIDCache = new ExpiringCache<UUID, UserAccount>(); | 47 | m_UUIDCache = new ExpiringCache<UUID, UserAccount>(); |
50 | m_NameCache = new ExpiringCache<string, UUID>(); // this one is unbound | 48 | m_NameCache = new ExpiringCache<string, UUID>(); |
51 | } | 49 | } |
52 | 50 | ||
53 | public void Cache(UUID userID, UserAccount account) | 51 | public void Cache(UUID userID, UserAccount account) |
diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index b0fee6d..6e580f1 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs | |||
@@ -149,7 +149,7 @@ namespace OpenSim.Server.Handlers.Asset | |||
149 | } | 149 | } |
150 | catch (Exception e) | 150 | catch (Exception e) |
151 | { | 151 | { |
152 | m_log.Debug("[XINVENTORY HANDLER]: Exception {0}" + e); | 152 | m_log.Debug("[XINVENTORY HANDLER]: Exception {0}", e); |
153 | } | 153 | } |
154 | 154 | ||
155 | return FailureResult(); | 155 | return FailureResult(); |
diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index c9bf996..5bb529c 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | |||
@@ -83,7 +83,7 @@ namespace OpenSim.Server.Handlers.Login | |||
83 | clientVersion = requestData["version"].ToString(); | 83 | clientVersion = requestData["version"].ToString(); |
84 | // We should do something interesting with the client version... | 84 | // We should do something interesting with the client version... |
85 | 85 | ||
86 | m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion); | 86 | //m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion); |
87 | 87 | ||
88 | LoginResponse reply = null; | 88 | LoginResponse reply = null; |
89 | reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, clientVersion, remoteClient); | 89 | reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, clientVersion, remoteClient); |
diff --git a/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs index baefebd..d7a5731 100644 --- a/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs +++ b/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs | |||
@@ -196,7 +196,7 @@ namespace OpenSim.Services.Connectors | |||
196 | { | 196 | { |
197 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 197 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
198 | sendData["PRINCIPALID"] = PrincipalID.ToString(); | 198 | sendData["PRINCIPALID"] = PrincipalID.ToString(); |
199 | sendData["FRIENDS"] = Friend; | 199 | sendData["FRIEND"] = Friend; |
200 | sendData["METHOD"] = "deletefriend"; | 200 | sendData["METHOD"] = "deletefriend"; |
201 | 201 | ||
202 | string reqString = ServerUtils.BuildQueryString(sendData); | 202 | string reqString = ServerUtils.BuildQueryString(sendData); |
diff --git a/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs index d7cb015..0a7b277 100644 --- a/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs +++ b/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs | |||
@@ -74,6 +74,9 @@ namespace OpenSim.Services.Connectors.Friends | |||
74 | 74 | ||
75 | public bool FriendshipDenied(GridRegion region, UUID userID, string userName, UUID friendID) | 75 | public bool FriendshipDenied(GridRegion region, UUID userID, string userName, UUID friendID) |
76 | { | 76 | { |
77 | if (region == null) | ||
78 | return false; | ||
79 | |||
77 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 80 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
78 | //sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); | 81 | //sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); |
79 | //sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); | 82 | //sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); |
@@ -131,7 +134,11 @@ namespace OpenSim.Services.Connectors.Friends | |||
131 | private bool Call(GridRegion region, Dictionary<string, object> sendData) | 134 | private bool Call(GridRegion region, Dictionary<string, object> sendData) |
132 | { | 135 | { |
133 | string reqString = ServerUtils.BuildQueryString(sendData); | 136 | string reqString = ServerUtils.BuildQueryString(sendData); |
134 | // m_log.DebugFormat("[FRIENDS CONNECTOR]: queryString = {0}", reqString); | 137 | //m_log.DebugFormat("[FRIENDS CONNECTOR]: queryString = {0}", reqString); |
138 | if (region == null) | ||
139 | return false; | ||
140 | |||
141 | m_log.DebugFormat("[FRIENDS CONNECTOR]: region: {0}", region.ExternalHostName + ":" + region.HttpPort); | ||
135 | try | 142 | try |
136 | { | 143 | { |
137 | string url = "http://" + region.ExternalHostName + ":" + region.HttpPort; | 144 | string url = "http://" + region.ExternalHostName + ":" + region.HttpPort; |
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 6319cc4..00fffff 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs | |||
@@ -209,6 +209,8 @@ namespace OpenSim.Services.LLLoginService | |||
209 | bool success = false; | 209 | bool success = false; |
210 | UUID session = UUID.Random(); | 210 | UUID session = UUID.Random(); |
211 | 211 | ||
212 | m_log.InfoFormat("[LLOGIN SERVICE]: Login request for {0} {1} from {2} with user agent {3} starting in {4}", | ||
213 | firstName, lastName, clientIP.Address.ToString(), clientVersion, startLocation); | ||
212 | try | 214 | try |
213 | { | 215 | { |
214 | // | 216 | // |
diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs index 601a69f..976153f 100644 --- a/OpenSim/Services/PresenceService/PresenceService.cs +++ b/OpenSim/Services/PresenceService/PresenceService.cs | |||
@@ -55,7 +55,7 @@ namespace OpenSim.Services.PresenceService | |||
55 | UUID secureSessionID) | 55 | UUID secureSessionID) |
56 | { | 56 | { |
57 | //PresenceData[] d = m_Database.Get("UserID", userID); | 57 | //PresenceData[] d = m_Database.Get("UserID", userID); |
58 | m_Database.Get("UserID", userID); | 58 | //m_Database.Get("UserID", userID); |
59 | 59 | ||
60 | PresenceData data = new PresenceData(); | 60 | PresenceData data = new PresenceData(); |
61 | 61 | ||