aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs81
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs3
2 files changed, 60 insertions, 24 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
index 9a97925..a77646c 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
@@ -50,6 +50,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
50 { 50 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 52
53 IUserManagement m_uMan;
54 IUserManagement UserManagementModule
55 {
56 get
57 {
58 if (m_uMan == null)
59 m_uMan = m_Scenes[0].RequestModuleInterface<IUserManagement>();
60 return m_uMan;
61 }
62 }
63
53 #region ISharedRegionModule 64 #region ISharedRegionModule
54 public override string Name 65 public override string Name
55 { 66 {
@@ -369,9 +380,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
369 protected override FriendInfo[] GetFriendsFromService(IClientAPI client) 380 protected override FriendInfo[] GetFriendsFromService(IClientAPI client)
370 { 381 {
371// m_log.DebugFormat("[HGFRIENDS MODULE]: Entering GetFriendsFromService for {0}", client.Name); 382// m_log.DebugFormat("[HGFRIENDS MODULE]: Entering GetFriendsFromService for {0}", client.Name);
383 Boolean agentIsLocal = true;
384 if (UserManagementModule != null)
385 agentIsLocal = UserManagementModule.IsLocalGridUser(client.AgentId);
372 386
373 UserAccount account1 = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, client.AgentId); 387 if (agentIsLocal)
374 if (account1 != null)
375 return base.GetFriendsFromService(client); 388 return base.GetFriendsFromService(client);
376 389
377 FriendInfo[] finfos = new FriendInfo[0]; 390 FriendInfo[] finfos = new FriendInfo[0];
@@ -392,16 +405,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
392 405
393 protected override bool StoreRights(UUID agentID, UUID friendID, int rights) 406 protected override bool StoreRights(UUID agentID, UUID friendID, int rights)
394 { 407 {
395 UserAccount account1 = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, agentID); 408 Boolean agentIsLocal = true;
396 UserAccount account2 = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, friendID); 409 Boolean friendIsLocal = true;
410 if (UserManagementModule != null)
411 {
412 agentIsLocal = UserManagementModule.IsLocalGridUser(agentID);
413 friendIsLocal = UserManagementModule.IsLocalGridUser(friendID);
414 }
415
397 // Are they both local users? 416 // Are they both local users?
398 if (account1 != null && account2 != null) 417 if (agentIsLocal && friendIsLocal)
399 { 418 {
400 // local grid users 419 // local grid users
401 return base.StoreRights(agentID, friendID, rights); 420 return base.StoreRights(agentID, friendID, rights);
402 } 421 }
403 422
404 if (account1 != null) // agent is local, friend is foreigner 423 if (agentIsLocal) // agent is local, friend is foreigner
405 { 424 {
406 FriendInfo[] finfos = GetFriends(agentID); 425 FriendInfo[] finfos = GetFriends(agentID);
407 FriendInfo finfo = GetFriend(finfos, friendID); 426 FriendInfo finfo = GetFriend(finfos, friendID);
@@ -412,7 +431,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
412 } 431 }
413 } 432 }
414 433
415 if (account2 != null) // agent is foreigner, friend is local 434 if (friendIsLocal) // agent is foreigner, friend is local
416 { 435 {
417 string agentUUI = GetUUI(friendID, agentID); 436 string agentUUI = GetUUI(friendID, agentID);
418 if (agentUUI != string.Empty) 437 if (agentUUI != string.Empty)
@@ -427,10 +446,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
427 446
428 protected override void StoreBackwards(UUID friendID, UUID agentID) 447 protected override void StoreBackwards(UUID friendID, UUID agentID)
429 { 448 {
430 UserAccount account1 = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, agentID); 449 Boolean agentIsLocal = true;
431 UserAccount account2 = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, friendID); 450 Boolean friendIsLocal = true;
451 if (UserManagementModule != null)
452 {
453 agentIsLocal = UserManagementModule.IsLocalGridUser(agentID);
454 friendIsLocal = UserManagementModule.IsLocalGridUser(friendID);
455 }
456
432 // Are they both local users? 457 // Are they both local users?
433 if (account1 != null && account2 != null) 458 if (agentIsLocal && friendIsLocal)
434 { 459 {
435 // local grid users 460 // local grid users
436 m_log.DebugFormat("[HGFRIENDS MODULE]: Users are both local"); 461 m_log.DebugFormat("[HGFRIENDS MODULE]: Users are both local");
@@ -444,10 +469,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
444 469
445 protected override void StoreFriendships(UUID agentID, UUID friendID) 470 protected override void StoreFriendships(UUID agentID, UUID friendID)
446 { 471 {
447 UserAccount agentAccount = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, agentID); 472 Boolean agentIsLocal = true;
448 UserAccount friendAccount = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, friendID); 473 Boolean friendIsLocal = true;
474 if (UserManagementModule != null)
475 {
476 agentIsLocal = UserManagementModule.IsLocalGridUser(agentID);
477 friendIsLocal = UserManagementModule.IsLocalGridUser(friendID);
478 }
479
449 // Are they both local users? 480 // Are they both local users?
450 if (agentAccount != null && friendAccount != null) 481 if (agentIsLocal && friendIsLocal)
451 { 482 {
452 // local grid users 483 // local grid users
453 m_log.DebugFormat("[HGFRIENDS MODULE]: Users are both local"); 484 m_log.DebugFormat("[HGFRIENDS MODULE]: Users are both local");
@@ -465,13 +496,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
465 string agentFriendService = string.Empty; 496 string agentFriendService = string.Empty;
466 string friendFriendService = string.Empty; 497 string friendFriendService = string.Empty;
467 498
468 if (agentClient != null) 499 if (agentIsLocal)
469 { 500 {
470 agentClientCircuit = ((Scene)(agentClient.Scene)).AuthenticateHandler.GetAgentCircuitData(agentClient.CircuitCode); 501 agentClientCircuit = ((Scene)(agentClient.Scene)).AuthenticateHandler.GetAgentCircuitData(agentClient.CircuitCode);
471 agentUUI = Util.ProduceUserUniversalIdentifier(agentClientCircuit); 502 agentUUI = Util.ProduceUserUniversalIdentifier(agentClientCircuit);
472 agentFriendService = agentClientCircuit.ServiceURLs["FriendsServerURI"].ToString(); 503 agentFriendService = agentClientCircuit.ServiceURLs["FriendsServerURI"].ToString();
473 } 504 }
474 if (friendClient != null) 505 if (friendIsLocal)
475 { 506 {
476 friendClientCircuit = ((Scene)(friendClient.Scene)).AuthenticateHandler.GetAgentCircuitData(friendClient.CircuitCode); 507 friendClientCircuit = ((Scene)(friendClient.Scene)).AuthenticateHandler.GetAgentCircuitData(friendClient.CircuitCode);
477 friendUUI = Util.ProduceUserUniversalIdentifier(friendClientCircuit); 508 friendUUI = Util.ProduceUserUniversalIdentifier(friendClientCircuit);
@@ -484,7 +515,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
484 // Generate a random 8-character hex number that will sign this friendship 515 // Generate a random 8-character hex number that will sign this friendship
485 string secret = UUID.Random().ToString().Substring(0, 8); 516 string secret = UUID.Random().ToString().Substring(0, 8);
486 517
487 if (agentAccount != null) // agent is local, 'friend' is foreigner 518 if (agentIsLocal) // agent is local, 'friend' is foreigner
488 { 519 {
489 // This may happen when the agent returned home, in which case the friend is not there 520 // This may happen when the agent returned home, in which case the friend is not there
490 // We need to look for its information in the friends list itself 521 // We need to look for its information in the friends list itself
@@ -520,7 +551,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
520 friendsConn.NewFriendship(friendID, agentUUI + ";" + secret); 551 friendsConn.NewFriendship(friendID, agentUUI + ";" + secret);
521 } 552 }
522 } 553 }
523 else if (friendAccount != null) // 'friend' is local, agent is foreigner 554 else if (friendIsLocal) // 'friend' is local, agent is foreigner
524 { 555 {
525 // store in the local friends service a reference to the foreign agent 556 // store in the local friends service a reference to the foreign agent
526 FriendsService.StoreFriend(friendID.ToString(), agentUUI + ";" + secret, 1); 557 FriendsService.StoreFriend(friendID.ToString(), agentUUI + ";" + secret, 1);
@@ -553,10 +584,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
553 584
554 protected override bool DeleteFriendship(UUID agentID, UUID exfriendID) 585 protected override bool DeleteFriendship(UUID agentID, UUID exfriendID)
555 { 586 {
556 UserAccount agentAccount = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, agentID); 587 Boolean agentIsLocal = true;
557 UserAccount friendAccount = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, exfriendID); 588 Boolean friendIsLocal = true;
589 if (UserManagementModule != null)
590 {
591 agentIsLocal = UserManagementModule.IsLocalGridUser(agentID);
592 friendIsLocal = UserManagementModule.IsLocalGridUser(exfriendID);
593 }
594
558 // Are they both local users? 595 // Are they both local users?
559 if (agentAccount != null && friendAccount != null) 596 if (agentIsLocal && friendIsLocal)
560 { 597 {
561 // local grid users 598 // local grid users
562 return base.DeleteFriendship(agentID, exfriendID); 599 return base.DeleteFriendship(agentID, exfriendID);
@@ -566,7 +603,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
566 string agentUUI = string.Empty; 603 string agentUUI = string.Empty;
567 string friendUUI = string.Empty; 604 string friendUUI = string.Empty;
568 605
569 if (agentAccount != null) // agent is local, 'friend' is foreigner 606 if (agentIsLocal) // agent is local, 'friend' is foreigner
570 { 607 {
571 // We need to look for its information in the friends list itself 608 // We need to look for its information in the friends list itself
572 FriendInfo[] finfos = GetFriends(agentID); 609 FriendInfo[] finfos = GetFriends(agentID);
@@ -587,7 +624,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
587 return true; 624 return true;
588 } 625 }
589 } 626 }
590 else if (friendAccount != null) // agent is foreigner, 'friend' is local 627 else if (friendIsLocal) // agent is foreigner, 'friend' is local
591 { 628 {
592 agentUUI = GetUUI(exfriendID, agentID); 629 agentUUI = GetUUI(exfriendID, agentID);
593 630
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs
index 560d913..bf1d787 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs
@@ -180,10 +180,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
180 180
181// m_log.DebugFormat("[HG INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID); 181// m_log.DebugFormat("[HG INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID);
182 // Is the user a local user? 182 // Is the user a local user?
183 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, toAgentID);
184 string url = string.Empty; 183 string url = string.Empty;
185 bool foreigner = false; 184 bool foreigner = false;
186 if (account == null) // foreign user 185 if (UserManagementModule != null && !UserManagementModule.IsLocalGridUser(toAgentID)) // foreign user
187 { 186 {
188 url = UserManagementModule.GetUserServerURL(toAgentID, "IMServerURI"); 187 url = UserManagementModule.GetUserServerURL(toAgentID, "IMServerURI");
189 foreigner = true; 188 foreigner = true;