aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/InstantMessage
diff options
context:
space:
mode:
authorDiva Canto2010-05-08 07:44:07 -0700
committerDiva Canto2010-05-08 07:44:07 -0700
commitd72769930aebb14ae4bfee9803adb13fbb44eb8b (patch)
tree32e9a36cab73a8ddb3528d50281c261815c44658 /OpenSim/Region/CoreModules/Avatar/InstantMessage
parenttest commit for panda (diff)
downloadopensim-SC_OLD-d72769930aebb14ae4bfee9803adb13fbb44eb8b.zip
opensim-SC_OLD-d72769930aebb14ae4bfee9803adb13fbb44eb8b.tar.gz
opensim-SC_OLD-d72769930aebb14ae4bfee9803adb13fbb44eb8b.tar.bz2
opensim-SC_OLD-d72769930aebb14ae4bfee9803adb13fbb44eb8b.tar.xz
More cleaning on presence. Friends online/offline works again.
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/InstantMessage')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs78
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs22
2 files changed, 39 insertions, 61 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index ad050a1..5d20e63 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -471,7 +471,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
471 if (m_UserRegionMap.ContainsKey(toAgentID)) 471 if (m_UserRegionMap.ContainsKey(toAgentID))
472 { 472 {
473 upd = new PresenceInfo(); 473 upd = new PresenceInfo();
474 upd.Online = true;
475 upd.RegionID = m_UserRegionMap[toAgentID]; 474 upd.RegionID = m_UserRegionMap[toAgentID];
476 475
477 // We need to compare the current regionhandle with the previous region handle 476 // We need to compare the current regionhandle with the previous region handle
@@ -493,15 +492,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
493 { 492 {
494 // Non-cached user agent lookup. 493 // Non-cached user agent lookup.
495 PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() }); 494 PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() });
496 if (presences != null) 495 if (presences != null && presences.Length > 0)
497 { 496 upd = presences[0];
498 foreach (PresenceInfo p in presences)
499 if (p.Online)
500 {
501 upd = presences[0];
502 break;
503 }
504 }
505 497
506 if (upd != null) 498 if (upd != null)
507 { 499 {
@@ -525,61 +517,53 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
525 517
526 if (upd != null) 518 if (upd != null)
527 { 519 {
528 if (upd.Online) 520 GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID,
521 upd.RegionID);
522 if (reginfo != null)
529 { 523 {
530 GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, 524 Hashtable msgdata = ConvertGridInstantMessageToXMLRPC(im);
531 upd.RegionID); 525 // Not actually used anymore, left in for compatibility
532 if (reginfo != null) 526 // Remove at next interface change
527 //
528 msgdata["region_handle"] = 0;
529 bool imresult = doIMSending(reginfo, msgdata);
530 if (imresult)
533 { 531 {
534 Hashtable msgdata = ConvertGridInstantMessageToXMLRPC(im); 532 // IM delivery successful, so store the Agent's location in our local cache.
535 // Not actually used anymore, left in for compatibility 533 lock (m_UserRegionMap)
536 // Remove at next interface change
537 //
538 msgdata["region_handle"] = 0;
539 bool imresult = doIMSending(reginfo, msgdata);
540 if (imresult)
541 { 534 {
542 // IM delivery successful, so store the Agent's location in our local cache. 535 if (m_UserRegionMap.ContainsKey(toAgentID))
543 lock (m_UserRegionMap)
544 { 536 {
545 if (m_UserRegionMap.ContainsKey(toAgentID)) 537 m_UserRegionMap[toAgentID] = upd.RegionID;
546 { 538 }
547 m_UserRegionMap[toAgentID] = upd.RegionID; 539 else
548 } 540 {
549 else 541 m_UserRegionMap.Add(toAgentID, upd.RegionID);
550 {
551 m_UserRegionMap.Add(toAgentID, upd.RegionID);
552 }
553 } 542 }
554 result(true);
555 }
556 else
557 {
558 // try again, but lookup user this time.
559 // Warning, this must call the Async version
560 // of this method or we'll be making thousands of threads
561 // The version within the spawned thread is SendGridInstantMessageViaXMLRPCAsync
562 // The version that spawns the thread is SendGridInstantMessageViaXMLRPC
563
564 // This is recursive!!!!!
565 SendGridInstantMessageViaXMLRPCAsync(im, result,
566 upd.RegionID);
567 } 543 }
544 result(true);
568 } 545 }
569 else 546 else
570 { 547 {
571 m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find region {0}", upd.RegionID); 548 // try again, but lookup user this time.
572 HandleUndeliveredMessage(im, result); 549 // Warning, this must call the Async version
550 // of this method or we'll be making thousands of threads
551 // The version within the spawned thread is SendGridInstantMessageViaXMLRPCAsync
552 // The version that spawns the thread is SendGridInstantMessageViaXMLRPC
553
554 // This is recursive!!!!!
555 SendGridInstantMessageViaXMLRPCAsync(im, result,
556 upd.RegionID);
573 } 557 }
574 } 558 }
575 else 559 else
576 { 560 {
561 m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find region {0}", upd.RegionID);
577 HandleUndeliveredMessage(im, result); 562 HandleUndeliveredMessage(im, result);
578 } 563 }
579 } 564 }
580 else 565 else
581 { 566 {
582 m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find user {0}", toAgentID);
583 HandleUndeliveredMessage(im, result); 567 HandleUndeliveredMessage(im, result);
584 } 568 }
585 } 569 }
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs
index bafad82..dd17f3c 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs
@@ -133,20 +133,14 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
133 foreach (PresenceInfo pi in status) 133 foreach (PresenceInfo pi in status)
134 { 134 {
135 UUID uuid = new UUID(pi.UserID); 135 UUID uuid = new UUID(pi.UserID);
136 if (pi.Online) 136 if (!online.Contains(uuid))
137 { 137 online.Add(uuid);
138 if (!online.Contains(uuid)) 138 }
139 { 139 foreach (string s in args)
140 online.Add(uuid); 140 {
141 if (offline.Contains(uuid)) 141 UUID uuid = new UUID(s);
142 offline.Remove(uuid); 142 if (!online.Contains(uuid) && !offline.Contains(uuid))
143 } 143 offline.Add(uuid);
144 }
145 else
146 {
147 if (!online.Contains(uuid) && !offline.Contains(uuid))
148 offline.Add(uuid);
149 }
150 } 144 }
151 145
152 if (online.Count > 0) 146 if (online.Count > 0)