aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs6
-rw-r--r--OpenSim/Data/MySQL/MySQLAssetData.cs8
-rw-r--r--OpenSim/Data/MySQL/Resources/007_AssetStore.sql5
-rw-r--r--OpenSim/Framework/AssetBase.cs22
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs87
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs78
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs22
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs4
-rw-r--r--OpenSim/Services/AssetService/AssetService.cs1
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs12
-rw-r--r--OpenSim/Services/HypergridService/UserAgentService.cs4
-rw-r--r--OpenSim/Services/Interfaces/IPresenceService.cs28
-rw-r--r--OpenSim/Services/PresenceService/PresenceService.cs6
-rw-r--r--OpenSim/Tests/Clients/Presence/PresenceClient.cs12
15 files changed, 146 insertions, 157 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 6da5558..d7904a6 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -1237,9 +1237,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1237 } 1237 }
1238 else 1238 else
1239 { 1239 {
1240 PresenceInfo[] pinfos = m_app.SceneManager.CurrentOrFirstScene.PresenceService.GetAgents(new string[] { account.PrincipalID.ToString() }); 1240 GridUserInfo guinfo = m_app.SceneManager.CurrentOrFirstScene.GridUserService.GetGridUserInfo(account.PrincipalID.ToString());
1241 if (pinfos != null && pinfos.Length >= 1) 1241 if (guinfo != null)
1242 responseData["lastlogin"] = pinfos[0].Login; 1242 responseData["lastlogin"] = guinfo.Login;
1243 else 1243 else
1244 responseData["lastlogin"] = 0; 1244 responseData["lastlogin"] = 0;
1245 1245
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs
index d55369a..5a2af4f 100644
--- a/OpenSim/Data/MySQL/MySQLAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLAssetData.cs
@@ -161,8 +161,8 @@ namespace OpenSim.Data.MySQL
161 161
162 MySqlCommand cmd = 162 MySqlCommand cmd =
163 new MySqlCommand( 163 new MySqlCommand(
164 "replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, data)" + 164 "replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, asset_flags, data)" +
165 "VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?data)", 165 "VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?data)",
166 dbcon); 166 dbcon);
167 167
168 string assetName = asset.Name; 168 string assetName = asset.Name;
@@ -194,6 +194,7 @@ namespace OpenSim.Data.MySQL
194 cmd.Parameters.AddWithValue("?temporary", asset.Temporary); 194 cmd.Parameters.AddWithValue("?temporary", asset.Temporary);
195 cmd.Parameters.AddWithValue("?create_time", now); 195 cmd.Parameters.AddWithValue("?create_time", now);
196 cmd.Parameters.AddWithValue("?access_time", now); 196 cmd.Parameters.AddWithValue("?access_time", now);
197 cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
197 cmd.Parameters.AddWithValue("?data", asset.Data); 198 cmd.Parameters.AddWithValue("?data", asset.Data);
198 cmd.ExecuteNonQuery(); 199 cmd.ExecuteNonQuery();
199 cmd.Dispose(); 200 cmd.Dispose();
@@ -302,7 +303,7 @@ namespace OpenSim.Data.MySQL
302 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 303 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
303 { 304 {
304 dbcon.Open(); 305 dbcon.Open();
305 MySqlCommand cmd = new MySqlCommand("SELECT name,description,assetType,temporary,id FROM assets LIMIT ?start, ?count", dbcon); 306 MySqlCommand cmd = new MySqlCommand("SELECT name,description,assetType,temporary,id,asset_flags FROM assets LIMIT ?start, ?count", dbcon);
306 cmd.Parameters.AddWithValue("?start", start); 307 cmd.Parameters.AddWithValue("?start", start);
307 cmd.Parameters.AddWithValue("?count", count); 308 cmd.Parameters.AddWithValue("?count", count);
308 309
@@ -317,6 +318,7 @@ namespace OpenSim.Data.MySQL
317 metadata.Description = (string)dbReader["description"]; 318 metadata.Description = (string)dbReader["description"];
318 metadata.Type = (sbyte)dbReader["assetType"]; 319 metadata.Type = (sbyte)dbReader["assetType"];
319 metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); // Not sure if this is correct. 320 metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); // Not sure if this is correct.
321 metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]);
320 metadata.FullID = new UUID((string)dbReader["id"]); 322 metadata.FullID = new UUID((string)dbReader["id"]);
321 323
322 // Current SHA1s are not stored/computed. 324 // Current SHA1s are not stored/computed.
diff --git a/OpenSim/Data/MySQL/Resources/007_AssetStore.sql b/OpenSim/Data/MySQL/Resources/007_AssetStore.sql
new file mode 100644
index 0000000..f06121a
--- /dev/null
+++ b/OpenSim/Data/MySQL/Resources/007_AssetStore.sql
@@ -0,0 +1,5 @@
1BEGIN;
2
3ALTER TABLE assets ADD COLUMN asset_flags INTEGER NOT NULL DEFAULT 0;
4
5COMMIT;
diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs
index 19ca232..7ecf198 100644
--- a/OpenSim/Framework/AssetBase.cs
+++ b/OpenSim/Framework/AssetBase.cs
@@ -33,6 +33,15 @@ using OpenMetaverse;
33 33
34namespace OpenSim.Framework 34namespace OpenSim.Framework
35{ 35{
36 [Flags]
37 public enum AssetFlags : int
38 {
39 Normal = 0,
40 Maptile = 1,
41 Rewritable = 2,
42 Collectable = 4
43 }
44
36 /// <summary> 45 /// <summary>
37 /// Asset class. All Assets are reference by this class or a class derived from this class 46 /// Asset class. All Assets are reference by this class or a class derived from this class
38 /// </summary> 47 /// </summary>
@@ -206,6 +215,12 @@ namespace OpenSim.Framework
206 set { m_metadata.Temporary = value; } 215 set { m_metadata.Temporary = value; }
207 } 216 }
208 217
218 public AssetFlags Flags
219 {
220 get { return m_metadata.Flags; }
221 set { m_metadata.Flags = value; }
222 }
223
209 [XmlIgnore] 224 [XmlIgnore]
210 public AssetMetadata Metadata 225 public AssetMetadata Metadata
211 { 226 {
@@ -233,6 +248,7 @@ namespace OpenSim.Framework
233 private bool m_local; 248 private bool m_local;
234 private bool m_temporary; 249 private bool m_temporary;
235 private string m_creatorid; 250 private string m_creatorid;
251 private AssetFlags m_flags;
236 252
237 public UUID FullID 253 public UUID FullID
238 { 254 {
@@ -330,5 +346,11 @@ namespace OpenSim.Framework
330 get { return m_creatorid; } 346 get { return m_creatorid; }
331 set { m_creatorid = value; } 347 set { m_creatorid = value; }
332 } 348 }
349
350 public AssetFlags Flags
351 {
352 get { return m_flags; }
353 set { m_flags = value; }
354 }
333 } 355 }
334} 356}
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index febd4ca..0c81f44 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -345,8 +345,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
345 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, new UUID(im.fromAgentID)); 345 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, new UUID(im.fromAgentID));
346 im.fromAgentName = account.FirstName + " " + account.LastName; 346 im.fromAgentName = account.FirstName + " " + account.LastName;
347 347
348 PresenceInfo presence = null;
348 PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid }); 349 PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid });
349 PresenceInfo presence = PresenceInfo.GetOnlinePresence(presences); 350 if (presences != null && presences.Length > 0)
351 presence = presences[0];
350 if (presence != null) 352 if (presence != null)
351 im.offline = 0; 353 im.offline = 0;
352 354
@@ -380,13 +382,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
380 PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray()); 382 PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray());
381 383
382 foreach (PresenceInfo pi in presence) 384 foreach (PresenceInfo pi in presence)
383 { 385 online.Add(new UUID(pi.UserID));
384 if (pi.Online) 386 //m_log.DebugFormat("[XXX] {0} friend online {1}", userID, pi.UserID);
385 {
386 online.Add(new UUID(pi.UserID));
387 //m_log.DebugFormat("[XXX] {0} friend online {1}", userID, pi.UserID);
388 }
389 }
390 387
391 return online; 388 return online;
392 } 389 }
@@ -462,11 +459,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
462 459
463 // The friend is not here [as root]. Let's forward. 460 // The friend is not here [as root]. Let's forward.
464 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); 461 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
465 PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions); 462 if (friendSessions != null && friendSessions.Length > 0)
466 if (friendSession != null)
467 { 463 {
468 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 464 PresenceInfo friendSession = friendSessions[0];
469 m_FriendsSimConnector.StatusNotify(region, userID, friendID, online); 465 if (friendSession != null)
466 {
467 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
468 m_FriendsSimConnector.StatusNotify(region, userID, friendID, online);
469 }
470 } 470 }
471 471
472 // Friend is not online. Ignore. 472 // Friend is not online. Ignore.
@@ -504,13 +504,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
504 504
505 // The prospective friend is not here [as root]. Let's forward. 505 // The prospective friend is not here [as root]. Let's forward.
506 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); 506 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
507 PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions); 507 if (friendSessions != null && friendSessions.Length > 0)
508 if (friendSession != null)
509 { 508 {
510 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 509 PresenceInfo friendSession = friendSessions[0];
511 m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message); 510 if (friendSession != null)
511 {
512 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
513 m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message);
514 }
512 } 515 }
513
514 // If the prospective friend is not online, he'll get the message upon login. 516 // If the prospective friend is not online, he'll get the message upon login.
515 } 517 }
516 518
@@ -536,14 +538,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
536 538
537 // The friend is not here 539 // The friend is not here
538 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); 540 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
539 PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions); 541 if (friendSessions != null && friendSessions.Length > 0)
540 if (friendSession != null)
541 { 542 {
542 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 543 PresenceInfo friendSession = friendSessions[0];
543 m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID); 544 if (friendSession != null)
544 client.SendAgentOnline(new UUID[] { friendID }); 545 {
546 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
547 m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID);
548 client.SendAgentOnline(new UUID[] { friendID });
549 }
545 } 550 }
546
547 } 551 }
548 552
549 private void OnDenyFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders) 553 private void OnDenyFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders)
@@ -562,11 +566,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
562 return; 566 return;
563 567
564 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); 568 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
565 PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions); 569 if (friendSessions != null && friendSessions.Length > 0)
566 if (friendSession != null)
567 { 570 {
568 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 571 PresenceInfo friendSession = friendSessions[0];
569 m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID); 572 if (friendSession != null)
573 {
574 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
575 m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
576 }
570 } 577 }
571 } 578 }
572 579
@@ -589,11 +596,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
589 return; 596 return;
590 597
591 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() }); 598 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() });
592 PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions); 599 if (friendSessions != null && friendSessions.Length > 0)
593 if (friendSession != null)
594 { 600 {
595 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 601 PresenceInfo friendSession = friendSessions[0];
596 m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID); 602 if (friendSession != null)
603 {
604 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
605 m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID);
606 }
597 } 607 }
598 } 608 }
599 609
@@ -631,13 +641,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
631 return; 641 return;
632 642
633 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() }); 643 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() });
634 PresenceInfo friendSession = PresenceInfo.GetOnlinePresence(friendSessions); 644 if (friendSessions != null && friendSessions.Length > 0)
635 if (friendSession != null)
636 { 645 {
637 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 646 PresenceInfo friendSession = friendSessions[0];
638 // TODO: You might want to send the delta to save the lookup 647 if (friendSession != null)
639 // on the other end!! 648 {
640 m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights); 649 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
650 // TODO: You might want to send the delta to save the lookup
651 // on the other end!!
652 m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights);
653 }
641 } 654 }
642 } 655 }
643 } 656 }
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)
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 137dfec..7d26e3f 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -245,6 +245,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
245 return; 245 return;
246 } 246 }
247 247
248 // Let's find out if this is a foreign user or a local user
249 UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, obj.AgentId);
250 if (account != null)
251 {
252 // local grid user
253 return;
254 }
255
248 AgentCircuitData aCircuit = ((Scene)(obj.Scene)).AuthenticateHandler.GetAgentCircuitData(obj.CircuitCode); 256 AgentCircuitData aCircuit = ((Scene)(obj.Scene)).AuthenticateHandler.GetAgentCircuitData(obj.CircuitCode);
249 257
250 if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) 258 if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 6ab3c62..ca0feed 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4108,8 +4108,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4108 4108
4109 UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, uuid); 4109 UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, uuid);
4110 4110
4111 PresenceInfo pinfo = null;
4111 PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() }); 4112 PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() });
4112 PresenceInfo pinfo = PresenceInfo.GetOnlinePresence(pinfos); 4113 if (pinfos != null && pinfos.Length > 0)
4114 pinfo = pinfos[0];
4113 4115
4114 if (pinfo == null) 4116 if (pinfo == null)
4115 return UUID.Zero.ToString(); 4117 return UUID.Zero.ToString();
diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs
index 4e512e7..2114933 100644
--- a/OpenSim/Services/AssetService/AssetService.cs
+++ b/OpenSim/Services/AssetService/AssetService.cs
@@ -181,6 +181,7 @@ namespace OpenSim.Services.AssetService
181 MainConsole.Instance.Output(String.Format("Description: {0}", asset.Description)); 181 MainConsole.Instance.Output(String.Format("Description: {0}", asset.Description));
182 MainConsole.Instance.Output(String.Format("Type: {0}", asset.Type)); 182 MainConsole.Instance.Output(String.Format("Type: {0}", asset.Type));
183 MainConsole.Instance.Output(String.Format("Content-type: {0}", asset.Metadata.ContentType)); 183 MainConsole.Instance.Output(String.Format("Content-type: {0}", asset.Metadata.ContentType));
184 MainConsole.Instance.Output(String.Format("Flags: {0}", asset.Metadata.Flags.ToString()));
184 185
185 for (i = 0 ; i < 5 ; i++) 186 for (i = 0 ; i < 5 ; i++)
186 { 187 {
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
index e48b7de..b86c45c 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
@@ -511,20 +511,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
511 511
512 PresenceInfo info = new PresenceInfo(); 512 PresenceInfo info = new PresenceInfo();
513 513
514 info.Online = true;
515 info.UserID = sessionResponse["UserID"].AsUUID().ToString(); 514 info.UserID = sessionResponse["UserID"].AsUUID().ToString();
516 info.RegionID = sessionResponse["SceneID"].AsUUID(); 515 info.RegionID = sessionResponse["SceneID"].AsUUID();
517 info.Position = sessionResponse["ScenePosition"].AsVector3();
518 info.LookAt = sessionResponse["SceneLookAt"].AsVector3();
519
520 if (userResponse != null && userResponse["User"] is OSDMap)
521 {
522 OSDMap user = (OSDMap)userResponse["User"];
523
524 info.Login = user["LastLoginDate"].AsDate();
525 info.Logout = user["LastLogoutDate"].AsDate();
526 DeserializeLocation(user["HomeLocation"].AsString(), out info.HomeRegionID, out info.HomePosition, out info.HomeLookAt);
527 }
528 516
529 return info; 517 return info;
530 } 518 }
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs
index 3af7ef9..64f7e8a 100644
--- a/OpenSim/Services/HypergridService/UserAgentService.cs
+++ b/OpenSim/Services/HypergridService/UserAgentService.cs
@@ -185,6 +185,10 @@ namespace OpenSim.Services.HypergridService
185 foreach (UUID session in travels) 185 foreach (UUID session in travels)
186 m_TravelingAgents.Remove(session); 186 m_TravelingAgents.Remove(session);
187 } 187 }
188
189 GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(userID.ToString());
190 if (guinfo != null)
191 m_GridUserService.LoggedOut(userID.ToString(), guinfo.LastRegionID, guinfo.LastPosition, guinfo.LastLookAt);
188 } 192 }
189 193
190 // We need to prevent foreign users with the same UUID as a local user 194 // We need to prevent foreign users with the same UUID as a local user
diff --git a/OpenSim/Services/Interfaces/IPresenceService.cs b/OpenSim/Services/Interfaces/IPresenceService.cs
index abbae2c..8d583ff 100644
--- a/OpenSim/Services/Interfaces/IPresenceService.cs
+++ b/OpenSim/Services/Interfaces/IPresenceService.cs
@@ -36,14 +36,6 @@ namespace OpenSim.Services.Interfaces
36 { 36 {
37 public string UserID; 37 public string UserID;
38 public UUID RegionID; 38 public UUID RegionID;
39 public bool Online;
40 public DateTime Login;
41 public DateTime Logout;
42 public Vector3 Position;
43 public Vector3 LookAt;
44 public UUID HomeRegionID;
45 public Vector3 HomePosition;
46 public Vector3 HomeLookAt;
47 39
48 public PresenceInfo() 40 public PresenceInfo()
49 { 41 {
@@ -65,26 +57,6 @@ namespace OpenSim.Services.Interfaces
65 57
66 return result; 58 return result;
67 } 59 }
68
69 public static PresenceInfo[] GetOnlinePresences(PresenceInfo[] pinfos)
70 {
71 if (pinfos == null)
72 return null;
73
74 List<PresenceInfo> lst = new List<PresenceInfo>(pinfos);
75 lst = lst.FindAll(delegate(PresenceInfo each) { return each.Online; });
76
77 return lst.ToArray();
78 }
79
80 public static PresenceInfo GetOnlinePresence(PresenceInfo[] pinfos)
81 {
82 pinfos = GetOnlinePresences(pinfos);
83 if (pinfos != null && pinfos.Length >= 1)
84 return pinfos[0];
85
86 return null;
87 }
88 } 60 }
89 61
90 public interface IPresenceService 62 public interface IPresenceService
diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs
index 7e7e98e..19f636a 100644
--- a/OpenSim/Services/PresenceService/PresenceService.cs
+++ b/OpenSim/Services/PresenceService/PresenceService.cs
@@ -115,10 +115,6 @@ namespace OpenSim.Services.PresenceService
115 115
116 ret.UserID = data.UserID; 116 ret.UserID = data.UserID;
117 ret.RegionID = data.RegionID; 117 ret.RegionID = data.RegionID;
118 if (data.Data.ContainsKey("Position"))
119 ret.Position = Vector3.Parse(data.Data["Position"]);
120 if (data.Data.ContainsKey("LookAt"))
121 ret.LookAt = Vector3.Parse(data.Data["LookAt"]);
122 118
123 return ret; 119 return ret;
124 } 120 }
@@ -138,8 +134,6 @@ namespace OpenSim.Services.PresenceService
138 134
139 ret.UserID = d.UserID; 135 ret.UserID = d.UserID;
140 ret.RegionID = d.RegionID; 136 ret.RegionID = d.RegionID;
141 ret.Position = Vector3.Parse(d.Data["Position"]);
142 ret.LookAt = Vector3.Parse(d.Data["LookAt"]);
143 137
144 info.Add(ret); 138 info.Add(ret);
145 } 139 }
diff --git a/OpenSim/Tests/Clients/Presence/PresenceClient.cs b/OpenSim/Tests/Clients/Presence/PresenceClient.cs
index 0f6b80e..fd3905a 100644
--- a/OpenSim/Tests/Clients/Presence/PresenceClient.cs
+++ b/OpenSim/Tests/Clients/Presence/PresenceClient.cs
@@ -73,8 +73,8 @@ namespace OpenSim.Tests.Clients.PresenceClient
73 if (pinfo == null) 73 if (pinfo == null)
74 m_log.InfoFormat("[PRESENCE CLIENT]: Unable to retrieve presence for {0}", user1); 74 m_log.InfoFormat("[PRESENCE CLIENT]: Unable to retrieve presence for {0}", user1);
75 else 75 else
76 m_log.InfoFormat("[PRESENCE CLIENT]: Presence retrieved correctly: userID={0}; Online={1}; regionID={2}; homeRegion={3}", 76 m_log.InfoFormat("[PRESENCE CLIENT]: Presence retrieved correctly: userID={0}; regionID={1}",
77 pinfo.UserID, pinfo.Online, pinfo.RegionID, pinfo.HomeRegionID); 77 pinfo.UserID, pinfo.RegionID);
78 78
79 System.Console.WriteLine("\n"); 79 System.Console.WriteLine("\n");
80 success = m_Connector.ReportAgent(session1, region1); 80 success = m_Connector.ReportAgent(session1, region1);
@@ -86,8 +86,8 @@ namespace OpenSim.Tests.Clients.PresenceClient
86 if (pinfo == null) 86 if (pinfo == null)
87 m_log.InfoFormat("[PRESENCE CLIENT]: Unable to retrieve presence for {0} for second time", user1); 87 m_log.InfoFormat("[PRESENCE CLIENT]: Unable to retrieve presence for {0} for second time", user1);
88 else 88 else
89 m_log.InfoFormat("[PRESENCE CLIENT]: Presence retrieved correctly: userID={0}; Online={1}; regionID={2}; homeRegion={3}", 89 m_log.InfoFormat("[PRESENCE CLIENT]: Presence retrieved correctly: userID={0}; regionID={2}",
90 pinfo.UserID, pinfo.Online, pinfo.RegionID, pinfo.HomeRegionID); 90 pinfo.UserID, pinfo.RegionID);
91 91
92 System.Console.WriteLine("\n"); 92 System.Console.WriteLine("\n");
93 success = m_Connector.LogoutAgent(session1); 93 success = m_Connector.LogoutAgent(session1);
@@ -99,8 +99,8 @@ namespace OpenSim.Tests.Clients.PresenceClient
99 if (pinfo == null) 99 if (pinfo == null)
100 m_log.InfoFormat("[PRESENCE CLIENT]: Unable to retrieve presence for {0} for fourth time", user1); 100 m_log.InfoFormat("[PRESENCE CLIENT]: Unable to retrieve presence for {0} for fourth time", user1);
101 else 101 else
102 m_log.InfoFormat("[PRESENCE CLIENT]: Presence retrieved correctly: userID={0}; Online={1}; regionID={2}; homeRegion={3}", 102 m_log.InfoFormat("[PRESENCE CLIENT]: Presence retrieved correctly: userID={0}; regionID={1}",
103 pinfo.UserID, pinfo.Online, pinfo.RegionID, pinfo.HomeRegionID); 103 pinfo.UserID, pinfo.RegionID);
104 104
105 System.Console.WriteLine("\n"); 105 System.Console.WriteLine("\n");
106 success = m_Connector.ReportAgent(session1, UUID.Random()); 106 success = m_Connector.ReportAgent(session1, UUID.Random());